<div>Chuck,</div> <div>I tried that, nothing changes. Thanks for your time</div> <div>Zilore<BR><BR><B><I>Charles Seman <Charles.Seman@NOAA.GOV></I></B> wrote:</div> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Zilore,<BR><BR>Have you tried using CHARACTER(len=8) for STID? Not sure, but<BR>http://grads.iges.org/grads/gadoc/aboutstationdata.html#station C and<BR>DEC Fortran example programs show use of 8 for length of variable "STID"...<BR><BR>I hope this helps,<BR>Chuck<BR><BR>zilore mumba wrote:<BR>> Help needed with the station data problem which I met more than five<BR>> years ago and, as far as I remember, many other grads users also<BR>> faced. I have gone through the archives, I do not find the solution.<BR>> *The problem:*<BR>> I want to write station rainfall to binary to display. I used the<BR>> example of rainfall in the grads documentation. When I run stnmap I<BR>> get the error
below. I wrote the data with acess='direct', in which<BR>> case the time group terminator is padded with zeros since it has six<BR>> items as opposed to 7 for the data group. I thought this was the<BR>> Invalid station hdr found in station binary file.<BR>> I then wrote the data with access='sequential (now no zeros padded).<BR>> The program re-reads and re-writes the data and it appears ok (though<BR>> I do not understand the 10-digit number as flag = 1123457434 in the<BR>> error message below).<BR>> I have attached the fortran program, ctl file and data, below.<BR>><BR>> Will appreciate anybody with a fix for my problem<BR>> Zilore Mumba<BR>><BR>> Name of binary data set: rainout.dat<BR>> Number of times in the data set: 2<BR>> Number of surface variables: 1<BR>> Number of level dependent variables: 0<BR>> Starting scan of station data binary file.<BR>> Binary data file open: rainout.dat<BR>> Processing time =
1<BR>> Invalid station hdr found in station binary file<BR>> Possible causes: Invalid level count in hdr<BR>> Descriptor file mismatch<BR>> File not station data<BR>> Invalid relative time<BR>> levs = 1 flag = 1123457434 time = 1.4013e-45<BR>> Open Error: Can't open description file<BR>> File name is: rain<BR>> Open Error: Can't open description file<BR>> File name is: rain<BR>> Open Error: Can't open description file<BR>> File name is: rain<BR>> Open Error: Can't open description file<BR>> File name is: rain<BR>> Open Error: Can't open description file<BR>> File name is: rain<BR>> $debug<BR>> program stndata<BR>> implicit none<BR>> integer :: i<BR>> integer :: IYEAR,IMONTH,IYROLD,IMNOLD<BR>> integer :: NFLAG,IFLAG,NLEV<BR>><BR>> real :: LAT,LON,RVAL,tim<BR>><BR>> CHARACTER(len=4) :: STID<BR>><BR>> OPEN (8,NAME='rainin.dat',status='old')<BR>> OPEN
(12,file='rainout.dat',FORM='BINARY',ACCESS='SEQUENTIAL')<BR>> !OPEN<BR>> (12,file='rainout.dat',form='unformatted',access='direct',recl=8*7)<BR>><BR>> IFLAG = 0<BR>> ! Read and Write<BR>> 10 READ (8,9000,END=90) IYEAR,IMONTH,STID,LAT,LON,RVAL<BR>> 9000 FORMAT (1x,I4,2X,I1,2X,A3,3(2x,F5.1))<BR>> IF (IFLAG.EQ.0) THEN<BR>> IFLAG = 1<BR>> IYROLD = IYEAR<BR>> IMNOLD = IMONTH<BR>> ENDIF<BR>> ! If new time group, write time group terminator.<BR>> ! Assuming no empty time groups.<BR>><BR>> IF (IYROLD.NE.IYEAR.OR.IMNOLD.NE.IMONTH) THEN<BR>> NLEV = 0<BR>> write(12)stid,lat,lon,tim,nlev,nflag<BR>> ENDIF<BR>><BR>> IYROLD = IYEAR<BR>> IMNOLD = IMONTH<BR>> ! Write this report<BR>> tim = 0.0<BR>> NLEV = 1<BR>> NFLAG = 1<BR>><BR>> write(12)stid,lat,lon,tim,nlev,nflag,rval<BR>> GOTO 10<BR>><BR>> ! On end of file write last time group terminator.<BR>> 90 CONTINUE<BR>> NLEV = 0<BR>><BR>>
write(12)stid,lat,lon,tim,nlev,nflag<BR>> close(12)<BR>><BR>> !****open output file to check how data was written *************<BR>> open(10,file='rainout.dat',FORM='BINARY',ACCESS='SEQUENTIAL')<BR>><BR>> do i=1,4<BR>> read(10) stid,lat,lon,tim,nlev,nflag,rval !*** read and print<BR>> the ***<BR>> print*, stid,lat,lon,tim,nlev,nflag,rval !** four stations at<BR>> t=1***<BR>> enddo<BR>> read(10) stid,lat,lon,tim,nlev,nflag !*** read and print the***<BR>> print*,stid,lat,lon,tim,nlev,nflag !**time group terminator*<BR>><BR>> do i=1,4<BR>> read(10) stid,lat,lon,tim,nlev,nflag,rval<BR>> print*, stid,lat,lon,tim,nlev,nflag,rval<BR>> enddo<BR>> read(10) stid,lat,lon,tim,nlev,nflag<BR>> print*,stid,lat,lon,tim,nlev,nflag<BR>><BR>> END program stndata<BR>> DSET ^rainout.dat<BR>> DTYPE station<BR>> STNMAP ^rainout.map<BR>> UNDEF -99<BR>> TITLE Station Data Sample<BR>> TDEF 2 linear 06z01Mar2007
6hr<BR>> VARS 1<BR>> r 0 99 rainfall<BR>> ENDVARS<BR>> 1980 1 QQQ 8.3 05.5 123.3<BR>> 1980 1 RRR 14.2 10.5 87.1<BR>> 1980 1 SSS 10.4 -03.5 412.8<BR>> 1980 1 TTT 06.4 01.5 23.3<BR>> 1980 2 QQQ 8.3 05.5 145.1<BR>> 1980 2 RRR 14.2 10.5 871.4<BR>> 1980 2 SSS 10.4 -03.5 223.1<BR>> 1980 2 TTT 06.4 01.5 45.5<BR>><BR>><BR>> ------------------------------------------------------------------------<BR>> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try<BR>> it now.<BR>> <HTTP: evt="51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ%20" us.rd.yahoo.com><BR><BR><BR>--<BR><BR>Please note that Charles.Seman@noaa.gov should be considered my NOAA<BR>email address, not cjs@gfdl.noaa.gov.<BR><BR>********************************************************************<BR>Charles Seman Charles.Seman@noaa.gov<BR>U.S. Department of Commerce / NOAA / OAR<BR>Geophysical Fluid Dynamics Laboratory voice: (609)
452-6547<BR>201 Forrestal Road fax: (609) 987-5063<BR>Princeton, NJ 08540-6649 http://www.gfdl.noaa.gov/~cjs/<BR>********************************************************************<BR><BR>"The contents of this message are mine personally and do not reflect<BR>any position of the Government or NOAA."<BR></BLOCKQUOTE><BR><BR><BR><p> 
<hr size=1>Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. <a href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ "> Try it now.</a>