options sequential && doc

Eric Altshuler ela at COLA.IGES.ORG
Mon Feb 4 16:23:38 EST 2008


Dear Dot Deb,

To create a grads-readable binary data file, you need to have a WRITE statement for each (lon,lat) array. In other words, for a particular field, level and time, the 2-D lon-lat grid is written to the file. If you have multiple levels, fields and times, you should have the following structure for your file. Each lon-lat grid needs its own WRITE statement.

Time 1
  Field 1
    Level 1 (lon-lat grid)
    Level 2 (lon-lat grid)
    ...
    Level NLEVS (lon-lat grid)
  Field 2
    Level 1 (lon-lat grid)
    Level 2 (lon-lat grid)
    ...
    Level NLEVS (lon-lat grid)
  ...
  Field NVARS
    Level 1 (lon-lat grid)
    Level 2 (lon-lat grid)
    ...
    Level NLEVS (lon-lat grid)
Time 2
...
Time NTIMES

If the file is written sequentially, there will be a control word (typically 4 bytes) at the beginning and end of each written record, so there will be 8 extra bytes for each record. GrADS expects to find control words at the beginning and end of each 2-D (lon-lat) slice of data. You are trying to write 4-D data slices, so the control words only exist at the beginning and end of these 4-D slices. This is not the file structure expected by GrADS.

Best regards,




Eric L. Altshuler
Assistant Research Scientist
Center for Ocean-Land-Atmosphere Studies
4041 Powder Mill Road, Suite 302
Calverton, MD 20705-3106
USA

E-mail: ela at cola.iges.org
Phone: (301) 902-1257
Fax: (301) 595-9793


----- Original Message -----
From: "Dot Deb" <dotdeb at GMAIL.COM>
To: GRADSUSR at LIST.CINECA.IT
Sent: Monday, February 4, 2008 6:50:34 AM (GMT-0500) America/New_York
Subject: options sequential && doc

        I have problems reading a file in grads.

        The file is a (time) sequence of blocks of
        (nlon,nlat,nlev,nvar) real. Each block is written with a unique
        write command. So I have an end-of-record for each block.

        The specifications I found in the doc page
        http://iges.org/grads/gadoc/aboutgriddeddata.html do not clarify
        how "OPTIONS sequential" works.

        In particular, it is not clear whether it assumes an
        end-of-record for each (nlon,nlat,nlev) or
        (nlon,nlat,nlev,nvar) block.

        In any case, I' could not read my file properly.

        By the way, in the ctl example reported in the same doc page for
        an unformatted/sequential file there isn't any "sequential"
        option. Why?

        Here is my ctl:
DSET  ^xxx
TITLE xxx

OPTIONS sequential

XDEF    110 LINEAR -22.0  0.4
YDEF    95 LINEAR -19.0  0.4
ZDEF    16 LINEAR 1 1
TDEF    73 LINEAR 00Z04FEB2008 1hr

UNDEF -9.99E33

VARS 35
  HNO3  16      99 HNO3
  HONO  16      99 HONO
  HNO4  16      99 HNO4
[...]



More information about the gradsusr mailing list