Handling GRIB records with two or more variables of the same type

Lee Byerle labyerle at MET.UTAH.EDU
Tue Oct 25 12:18:22 EDT 2005


Chuck-

The easiest I've found is to extract each record into it's own binary and
then concatenate them (using Wesley Ebisuzaki's grib tricks-egrep record
number).  Then, for ctl file have one variable with 2 arbitrary "levels"
for zdef.

For example:

wgrib gribfile | egrep "(^14:)" | wgrib -i gribfile -o apcp_1.dat
wgrib gribfile | egrep "(^15:)" | wgrib -i gribfile -o apcp_2.dat

cat apcp_1.dat apcp_2.dat > apcp_tot.dat

The ctl file would look something like:

dset ^apcp_tot.dat
undef 9.999E+20
options sequential
title accum precip
xdef 360 linear 0 1
ydef 181 linear -90 1
tdef 1 linear 06Z27jul2005 1mo
zdef 2 levels 1000 975
vars 1
REFRACT  2 99 ** Accum precip
ENDVARS

"set z 1" for first x-y array of precip.  "Set z 2" for second x-y array..

Lee






> Grads Gurus,
>
>    I am currently working with grib files
> that contain multiple records of the same
> type.  Does any one know of a way to create
> a control file to differentiate between
> the two of them in grads using the grib
> "Process ID".
>
> Example of "wgrib filename" output:
>
> 14:1587804:d=05102623:APCP:kpds5=61:kpds6=1:kpds7=0:TR=4:P1=0:P2=1:TimeU=1:sfc:0-1hr
> acc:NAve=4
> 15:1741654:d=05102623:APCP:kpds5=61:kpds6=1:kpds7=0:TR=4:P1=0:P2=1:TimeU=1:sfc:0-1hr
> acc:NAve=4
>
> Example of "wgrib -V filename" output:
>
> rec 14:1587804:date 2005102623 APCP kpds5=61 kpds6=1 kpds7=0
> levels=(0,0) grid=0 sfc 0-1hr acc: bitmap: 23497 undef
>   APCP=Total precipitation [kg/m^2]
>   timerange 4 P1 0 P2 1 TimeU 1  nx 464 ny 224 GDS grid 0 num_in_ave 4
> missing 0
>   center 222 subcenter 222 process 155 Table 1
>   latlon: lat  25.063000 to 52.938000 by 0.125000  nxny 103936
>           long -124.938000 to -67.063000 by 0.125000, (464 x 224) scan
> 64 mode 128 bdsgrid 1
>   min/max data 0 0.8475  num bits 14  BDS_Ref 0  DecScale 4 BinScale 0
>
> rec 15:1741654:date 2005102623 APCP kpds5=61 kpds6=1 kpds7=0
> levels=(0,0) grid=0 sfc 0-1hr acc: bitmap: 23497 undef
>   APCP=Total precipitation [kg/m^2]
>   timerange 4 P1 0 P2 1 TimeU 1  nx 464 ny 224 GDS grid 0 num_in_ave 4
> missing 0
>   center 222 subcenter 222 process 156 Table 1
>   latlon: lat  25.063000 to 52.938000 by 0.125000  nxny 103936
>           long -124.938000 to -67.063000 by 0.125000, (464 x 224) scan
> 64 mode 128 bdsgrid 1
>   min/max data -9999 -9999  num bits 0  BDS_Ref -9.999e+07  DecScale 4
> BinScale 0
>
>
> The only difference between fields is the
> process id (process 155 vs. 156).
> I have been currently stripping out the
> multiple records to do my analysis,
> however this is not only time consuming
> but can occupy a great deal of disk space
> at times. Is there any way to differentiate
> between these two fields in a GrADS control file?
> Or has anyone been able to successfully modify the
> GrADS source to do something along these
> lines?  Any help/suggestions you can throw
> my way will be greatly appreciated.
>
> Thanks,
> Chuck
>
> Charles J. Alonge
> NASA Goddard Space Flight Center - SAIC
> Hydrological Sciences Branch
> NASA-GSFC Mail Code 614.3
> Greenbelt, MD 20771
>
> Office: Building 22, Room 008
> Phone:  (301) 286-8272
> Fax:    (301) 286-8624
> Email:  Charles.Alonge at gsfc.nasa.gov
>



More information about the gradsusr mailing list