wrfpost, GrADS andTemplating 'idx' grib files

Alfredo Rocha arocha at FIS.UA.PT
Wed Jan 27 07:49:31 EST 2010


Hi,

I got around it!

For example, having 3 grib files, each for a time instant, and each having a 
index (idx) and ctl file associated, like

wrfprs_d02_000.grb
wrfprs_d02_000.idx
wrfprs_d02_000.ctl

wrfprs_d02_001.grb
wrfprs_d02_001.idx
wrfprs_d02_001.ctl

wrfprs_d02_002.grb
wrfprs_d02_002.idx
wrfprs_d02_002.ctl

For example, the contents of file wrfprs_d02_000.ctl is:

dset ^wrfprs_d02.000.grb
index ^wrfprs_d02.000.idx
undef 9.999E+20
title wrfprs_d02.000
*  produced by grib2ctl v0.9.12.5p45
dtype grib 255
pdef 95 140 lcc 35.866000 -12.249000 1 1 40.000000 40.000000 -
12.000000 5000 5000
xdef 95 linear -12.249000 0.0560897541291416
ydef 140 linear 35.866000 0.0454545454545455
tdef 1 linear 00Z22dec2009 1mo
zdef 1 linear 1 1
vars 5
PRES2m  0 1,105,2 ** 2 m above ground Pressure [Pa]
PRMSLmsl  0 2,102,0 ** mean-sea level Pressure reduced to MSL [Pa]
UGRD10m  0 33,105,10 ** 10 m above ground u wind [m/s]
VGRD10m  0 34,105,10 ** 10 m above ground v wind [m/s]
var180sfc  0 180,1,0  ** surface undefined
ENDVARS

Do the following:

1. Copy wrfprs_d02_000.ctl to wrfprs_d02_all.ctl.

2. Edit this file to become:

dset ^wrfprs_d02.%ch.grb
chsub    1   1  000
chsub    2   2  001
chsub    3   3  002
index ^wrfprs_d02_all.idx
options template
undef 9.999E+20
*  produced by grib2ctl v0.9.12.5p45
dtype grib 255
pdef 95 140 lcc 35.866000 -12.249000 1 1 40.000000 40.000000 -
12.000000 5000 5000
xdef 95 linear -12.249000 0.0560897541291416
ydef 140 linear 35.866000 0.0454545454545455
tdef 3 linear 00Z22dec2009 1hr
zdef 1 linear 1 1
vars 5
PRES2m  0 1,105,2 ** 2 m above ground Pressure [Pa]
PRMSLmsl  0 2,102,0 ** mean-sea level Pressure reduced to MSL [Pa]
UGRD10m  0 33,105,10 ** 10 m above ground u wind [m/s]
VGRD10m  0 34,105,10 ** 10 m above ground v wind [m/s]
var180sfc  0 180,1,0  ** surface undefined
ENDVARS

3. Generate a single idx file by doing:

gribmap -v -i wrfprs_d02_all.ctl -O

which creates the file wrfprs_d02_all.idx

3. Then, run GrADS and open file wrfprs_d02_all.ctl

From here on you can access all 3 time instants from a single ctl and idx file, 
whitout having to deal with templating idx files.


Alfredo



More information about the gradsusr mailing list