STATION DATA FORTRAN SEQUENTIAL FORMAT

James T. Potemra jimp at HAWAII.EDU
Wed Jul 12 13:59:26 EDT 2006


Davide:

I've encountered similar problems generating station data with a
sequential write (see posting by Oswaldo Julca).  Can you tell me what
platform and compiler you are using?  My guess is that the IRIX/Solaris
"stnmap" binaries do not correctly support the "options sequential".  I
can, for example, generate a station data set using similar code to
your's on a linux machine and on IRIX/Solaris machines.  I get no errors
running "stnmap" on the linux side, either on the linux-generated data
or the IRIX-generated data (adding a "big_endian" option).  The IRIX
"stnmap" however gives errors similar to yours.

Jim

Davide Sotil Bertanzetti wrote:

>Hello GRADS Users. I ask you about my problem because I think I will go mad
>in other case. I want to create a station data GRADS file using FORTRAN.
>That's all. I can't use the FORTRAN "recordtype='STREAM'" option (as
>described in an example in the GRADS documentation), so I have to use the
>"options sequential" in the GRADS CTL (no examples about that in the GRADS
>documentation). Basically, this is the program I have made:
>
>open(15,file='staGRADSsta.dat',form='UNFORMATTED',access='SEQUENTIAL',
>status='UNKNOWN')
>TIM=0.0
>NFLAG=1
>do t=1,numTim
>  NLEV=1
>  do s=1,numSta
>    write(15) nameSta(s),latSta(s),lonSta(s),TIM,NLEV,NFLAG
>    do v=1,numVarASC
>      write(15) data(t,s,v)
>    enddo
>  enddo
>  NLEV=0
>  if(t.eq.numTim) then
>    s=numSta
>  else
>    s=1
>  endif
>  write(15) nameSta(s),latSta(s),lonSta(s),TIM,NLEV,NFLAG
>enddo
>
>Where:
>
>numTim: number of times.
>numSta: number of stations.
>numVarASC: number of variables.
>
>This is the CTL file:
>
>dset ^staGRADSsta.dat
>dtype station
>stnmap ^staGRADSsta.map
>undef -999.99
>options sequential
>tdef 1080 linear 01:30Z14MAY2005 1hr
>vars 2
>temp 0 99 - temp
>hr 0 99 - hr
>endvars
>
>The problem is I can't make this to work, because the "stnmap" program
>reports the following error:
>
>  Name of binary data set: staGRADSsta.dat
>  Number of times in the data set: 1080
>  Number of surface variables: 2
>  Number of level dependent variables: 0
>
>Starting scan of station data binary file.
>Binary data file open: staGRADSsta.dat
>Processing time = 1
>  Invalid station hdr found in station binary file
>  Possible causes:  Invalid level count in hdr
>                    Descriptor file mismatch
>                    File not station data
>                    Invalid relative time
>                    Invalid sequential format
>    levs = 16777216  flag = 16777216  time = 0
>
>The error appears just at the first time and is highly generic. I've been
>trying to change many things having the same error. That's really
>frustrating. I don't think my program should be a difficult work to do. I
>expect that to be easy. Maybe I'm missing something or I'm making some
>obvious error I can't see. Has somebody make programs like this? (I can't
>believe nobody has), could somebody help me?.
>
>
>Davide Sotil Bertanzetti.
>
>



More information about the gradsusr mailing list