<div>Help needed with the station data problem which I met more than five years ago and, as far as I remember,&nbsp;many other grads users also faced. I have gone through the archives, I do not find the solution.</div>  <div><STRONG>The problem:</STRONG></div>  <div>I want to write station rainfall to binary to display. I used the example of rainfall in the grads documentation. When I run stnmap I get the error below. I wrote the data with acess='direct', in which case the time group terminator is padded with zeros since it has six items as opposed to 7 for the data group. I thought this was the Invalid station hdr found in station binary file.<BR>I then wrote the data with access='sequential (now no zeros padded).</div>  <div>The program re-reads and re-writes the data and it appears ok (though I do not understand the 10-digit number as flag = 1123457434&nbsp; in the error message below).</div>  <div>I have attached the fortran program, ctl file and data, below.</div>
 <div>&nbsp;</div>  <div>Will appreciate anybody with a fix for my problem</div>  <div>Zilore Mumba</div>  <div>&nbsp;</div>  <div>&nbsp;Name of binary data set: rainout.dat<BR>&nbsp; Number of times in the data set: 2<BR>&nbsp; Number of surface variables: 1<BR>&nbsp; Number of level dependent variables: 0</div>  <div>Starting scan of station data binary file.<BR>Binary data file open: rainout.dat<BR>Processing time = 1<BR>&nbsp; Invalid station hdr found in station binary file<BR>&nbsp; Possible causes:&nbsp; Invalid level count in hdr<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Descriptor file mismatch<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File not station data<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Invalid relative time<BR>&nbsp;&nbsp;&nbsp;
 levs = 1&nbsp; flag = 1123457434&nbsp; time = 1.4013e-45 <BR>Open Error:&nbsp; Can't open description file<BR>File name is:&nbsp; rain<BR>Open Error:&nbsp; Can't open description file<BR>File name is:&nbsp; rain<BR>Open Error:&nbsp; Can't open description file<BR>File name is:&nbsp; rain<BR>Open Error:&nbsp; Can't open description file<BR>File name is:&nbsp; rain<BR>Open Error:&nbsp; Can't open description file<BR>File name is:&nbsp; rain<BR></div>  <div>$debug<BR>&nbsp;program stndata</div>  <div>&nbsp;implicit none</div>  <div>&nbsp;&nbsp;&nbsp;&nbsp;integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :: i<BR>&nbsp;&nbsp;&nbsp; integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :: IYEAR,IMONTH,IYROLD,IMNOLD<BR>&nbsp;&nbsp;&nbsp; integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :: NFLAG,IFLAG,NLEV<BR>&nbsp;&nbsp;&nbsp;</div>  <div>&nbsp;&nbsp; &nbsp;real&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::
 LAT,LON,RVAL,tim</div>  <div>&nbsp;&nbsp;&nbsp;&nbsp; </div>  <div>&nbsp;&nbsp;&nbsp; CHARACTER(len=4) :: STID<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OPEN (8,NAME='rainin.dat',status='old') <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OPEN (12,file='rainout.dat',FORM='BINARY',ACCESS='SEQUENTIAL')</div>  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; !OPEN (12,file='rainout.dat',form='unformatted',access='direct',recl=8*7)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; IFLAG = 0 </div>  <div>!&nbsp; Read and Write<BR>10&nbsp;&nbsp;&nbsp;&nbsp; READ (8,9000,END=90) IYEAR,IMONTH,STID,LAT,LON,RVAL <BR>9000&nbsp;&nbsp; FORMAT (1x,I4,2X,I1,2X,A3,3(2x,F5.1))</div>  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF (IFLAG.EQ.0) THEN<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IFLAG = 1 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IYROLD = IYEAR<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMNOLD = IMONTH
 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF </div>  <div>!&nbsp; If new time group, write time group terminator. <BR>!&nbsp; Assuming no empty time groups. <BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF (IYROLD.NE.IYEAR.OR.IMNOLD.NE.IMONTH) THEN <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NLEV = 0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write(12)stid,lat,lon,tim,nlev,nflag<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IYROLD = IYEAR <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMNOLD = IMONTH </div>  <div>!&nbsp; Write this report <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tim = 0.0 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NLEV = 1 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NFLAG = 1<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write(12)stid,lat,lon,tim,nlev,nflag,rval</div>  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GOTO 10<BR>&nbsp;&nbsp;&nbsp; <BR>!&nbsp; On end
 of file write last time group terminator. </div>  <div>90&nbsp;&nbsp;&nbsp;&nbsp;CONTINUE <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NLEV = 0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; write(12)stid,lat,lon,tim,nlev,nflag</div>  <div>&nbsp;&nbsp;&nbsp; close(12)<BR>&nbsp;<BR>!****open output file to check how data was written *************</div>  <div>&nbsp;&nbsp;&nbsp; open(10,file='rainout.dat',FORM='BINARY',ACCESS='SEQUENTIAL')<BR>&nbsp;<BR>&nbsp;do i=1,4<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; read(10) stid,lat,lon,tim,nlev,nflag,rval&nbsp;&nbsp;&nbsp; !*** read and print the ***<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print*, stid,lat,lon,tim,nlev,nflag,rval&nbsp;&nbsp;&nbsp; !** four stations at t=1***<BR>&nbsp;enddo<BR>&nbsp;read(10) stid,lat,lon,tim,nlev,nflag&nbsp;&nbsp;&nbsp;&nbsp; !*** read and print the***<BR>&nbsp;print*,stid,lat,lon,tim,nlev,nflag&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; !**time group terminator*<BR>&nbsp;<BR>&nbsp;do
 i=1,4<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; read(10) stid,lat,lon,tim,nlev,nflag,rval<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print*, stid,lat,lon,tim,nlev,nflag,rval<BR>&nbsp;enddo<BR>&nbsp;read(10) stid,lat,lon,tim,nlev,nflag<BR>&nbsp;print*,stid,lat,lon,tim,nlev,nflag<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; END&nbsp;program stndata<BR></div>  <div>DSET ^rainout.dat<BR>DTYPE&nbsp; station<BR>STNMAP ^rainout.map<BR>UNDEF&nbsp; -99<BR>TITLE&nbsp; Station Data Sample<BR>TDEF&nbsp;&nbsp; 2 linear 06z01Mar2007 6hr<BR>VARS 1<BR>r&nbsp;&nbsp; 0 99 rainfall<BR>ENDVARS<BR></div>  <div>&nbsp;1980&nbsp; 1&nbsp; QQQ&nbsp;&nbsp;&nbsp; 8.3&nbsp;&nbsp; 05.5&nbsp; 123.3<BR>&nbsp;1980&nbsp; 1&nbsp; RRR&nbsp;&nbsp; 14.2&nbsp;&nbsp; 10.5&nbsp;&nbsp;&nbsp; 87.1<BR>&nbsp;1980&nbsp; 1&nbsp; SSS&nbsp;&nbsp; 10.4&nbsp; -03.5&nbsp; 412.8<BR>&nbsp;1980&nbsp; 1&nbsp; TTT&nbsp;&nbsp;&nbsp;&nbsp; 06.4&nbsp;&nbsp; 01.5&nbsp;&nbsp; 23.3<BR>&nbsp;1980&nbsp; 2&nbsp; QQQ&nbsp;&nbsp;&nbsp;
 8.3&nbsp;&nbsp; 05.5&nbsp; 145.1<BR>&nbsp;1980&nbsp; 2&nbsp; RRR&nbsp;&nbsp; 14.2&nbsp;&nbsp; 10.5&nbsp; 871.4<BR>&nbsp;1980&nbsp; 2&nbsp; SSS&nbsp;&nbsp;&nbsp;10.4&nbsp; -03.5&nbsp; 223.1<BR>&nbsp;1980&nbsp; 2&nbsp; TTT&nbsp;&nbsp; &nbsp;06.4&nbsp;&nbsp; 01.5&nbsp;&nbsp;&nbsp; 45.5</div><BR><BR><p>&#32;
      <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>