simplest station data and stnmap

Boyin Huang boyin.huang at NOAA.GOV
Tue Jun 28 09:59:20 EDT 2005


I used an example of grads manual and some knowledge from browsing
previous posters, but ended with an error requiring your help:

---------------------------------------------
stmap error:
stnmap -i rain.ctl
Open Error:  Unexpected ENDVARS record
Was expecting 1 records.  Found 0.
  --> The invalid description file record is:
  --> endvars

  The data file was not opened.
File name is:  rain.ctl

-----------------------------------------
rain.ctl file
DSET   rain.dat
DTYPE  station
STNMAP rain.map
UNDEF  -999.0
options sequential
TITLE  rainfall
TDEF   2 linear jan1980 1mo
VARS   1
  p 0 99 rainfall
ENDVARS

------------------------------------------------
ASCII data: rain.ch

1980     1     QQQ    34.3  -85.5    123.3
1980     1     RRR    44.2  -84.5     87.1
1980     1     SSS    22.4  -83.5    412.8
1980     1     TTT    33.4  -82.5     23.3
1980     2     QQQ    34.3  -85.5    145.1
1980     2     RRR    44.2  -84.5    871.4
1980     2     SSS    22.4  -83.5    223.1
1980     2     TTT    33.4  -82.5     45.5

--------------------------------------------
FORTRAN (sequential)

       CHARACTER*8 STID
       OPEN (8,NAME='rain.ch')
       OPEN (10,NAME='rain.dat',FORM='UNFORMATTED')
       IFLAG = 0
C  Read and Write
10     READ (8,9000,END=90) IYEAR,IMONTH,STID,RLAT,RLON,RVAL
9000   FORMAT (I4,3X,I2,2X,A8,3F8.1)
       IF (IFLAG.EQ.0) THEN
          IFLAG = 1
          IYROLD = IYEAR
          IMNOLD = IMONTH
       ENDIF
C  If new time group, write time group terminator.
C  Assuming no empty time groups.
       IF (IYROLD.NE.IYEAR.OR.IMNOLD.NE.IMONTH) THEN
          NLEV = 0
          WRITE (10) STID,RLAT,RLON,TIM,NLEV,NFLAG
          ENDIF
          IYROLD = IYEAR
          IMNOLD = IMONTH
C  Write this report
       TIM = 0.0
       NLEV = 1
       NFLAG = 1
       WRITE (10) STID,RLAT,RLON,TIM,NLEV,NFLAG
       WRITE (10) RVAL
       GO TO 10
C  On end of file write last time group terminator.
90     CONTINUE
       NLEV = 0
       WRITE (10) STID,RLAT,RLON,TIM,NLEV,NFLAG
       STOP
       END

FORTAN file reading rain.ch and writing rain.dat (sequestial)



More information about the gradsusr mailing list