[Thread Prev][Thread Next][Index]

Re: [ferret_users] How to read grads binary



Hi Wilfran,
            Ferret deocumentation explains that /SKIP qualifier : "Specifies
the number of records to skip at the start of a data set before beginning
to read the data. By default, no records are skipped". Hence if your
binary data doesn't contain any header or flag informations at the
begining, there is no need to use the SKIP qualifier with a value > 0.
This may be the reason why Ferret complaints "Size of file ./grd.n10
doesn't match size specified by variables/grid". So remove
/SKIP=`120*36*289` from your FILE command.

             Your time axis have "294" points instead of intented "289"
(all other axes have correct number of points according to the details
given). Hence you are trying to read more data than the file contains.
Hence even if you remove the skip qualifier, the grid defenition is wrong
and in this case also you will get the same error message. See the details
below.


    define axis/x=20.5:139.5:1/unit=degrees            longitude
    define axis/y=35.5:70.5:1/unit=degrees             latitude
    define axis/z=1000:1000:1/units=mbars              zax
    define axis/t=29-DEC-1977:29-DEC-1985:10/unit=days tax

    ! define a variable on the above axes(ie grid)

    let dummy = x[gx=longitude]*0 + y[gy=latitude]*0 + z[gz=zax]*0 + t[gt=tax]*0
    show grid dummy
    GRID (G001)
 name       axis              # pts   start                end
 LONGITUDE LONGITUDE          120mr   20.5E                139.5E
 LATITUDE  LATITUDE            36 r   35.5N                70.5N
 ZAX       Z (MBARS)            1 r   1000                 1000
 TAX       TIME               294 r   29-DEC-1977 00:00    06-JAN-1986 00:00

As you can see, tax contains 294 points and the end time is not 29-DEC-1985
but 06-JAN-1986 (this is because according to the delta of 10days, the 293rd
point is on 27-DEC-1985 but the end time point requested is after that..so
it will take one more time point spaced by 10 days from the 293rd. ). There are
4 possibilities (please check all....with respect to your ctl file or grads
gs script or binary file size)

       1. starting date is not 29-DEC-1977
       2. ending   date is not 29-DEC-1985
       3. delta for time axis is not 10days and is not uniform

 Say the case is 1, tstart is 09-FEB-1978. Then define time axis as

    yes? define axis/t=09-FEB-1978:29-DEC-1985:10/unit=days tax
    yes? say `t[gt=tax],r=lend`
     !-> MESSAGE/CONTINUE 289
    289
    yes?

 Say the case is 2, tend   is 17-NOV-1985. Then define time axis as

    yes? define axis/t=29-DEC-1977:17-NOV-1985:10/unit=days tax

 Say the case is 3, then define time axis as

    yes? define axis/t=29-DEC-1977:29-DEC-1985/NPOINTS=289/units=days tax


 hope this helps......please let me know if you have any difficulties...

 With Regards

 Jaison

On Sat, 6 Aug 2005, wilfran wrote:

Dear Ferret users,

Does someone know how Ferret is reading a binary produced by Grads and
in particular how to specify the parameter /SKIP= ?

Basically, I have a grads binary which representes gridded data  of
Xsize = 120,  Ysize = 36,  Zsize = 1,  Tsize = 289

When trying to read these data with Ferret command lines  I have the
following error message:

       NOAA/PMEL TMAP
       FERRET v5.80
       Linux(g77) 2.4.18 - 01/03/05
        6-Aug-05 11:18

yes? define axis/x=20.5:139.5:1/unit=degrees     longitude ! 120
yes? define axis/y=35.5:70.5:1/unit=degrees      latitude  ! 36
yes? define axis/z=1000:1000:1/units=mbars zax
yes? define axis/t=29-DEC-1977:29-DEC-1985:10/unit=days tax  ! 289
yes? define grid/X=longitude/Y=latitude/Z=zax/T=tax ugrid2d
yes? !! describe the soil moisture  variable in the file
yes? FILE/VAR=n10/SKIP=`120*36*289`/GRID=ugrid2d/FORMAT=stream   grd.n10
!-> SET DATA/EZ/VAR=n10/SKIP=1248480/GRID=ugrid2d/FORMAT=stream
grd.n10
yes? !!more information about variable "n10"
yes? set variable/TITLE="soil moisture in the top 10 cm"/UNITS="cm" n10
yes? !!Save the data to a NetCDF file
yes? save/FILE=grd.n10.cdf/TITLE="Observed top 10 cm soil moisture  in
1978-1985" n10
**ERROR: Size of file ./grd.n10 doesn't match size specified by
variables/grid
yes?

Regards,

Wilfran Moufouma-Okia
Regional climate modeler


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement