| Re: IDL Grib Routines [message #85633 is a reply to message #85511] |
Thu, 22 August 2013 13:37  |
Mark Piper
Messages: 198 Registered: December 2009
|
Senior Member |
|
|
On Wednesday, August 14, 2013 10:57:03 AM UTC-6, Chip Helms wrote:
>
> I'm trying to read GFS model winds out of grib2 files using Mark Piper's helper routines and I've run into an issue. The record indices for the wind components are designated as floats with '.1' for UGRD and '.2' for VGRD. Since Mark Piper's grib helper routines assume that the index is an integer, they return UGRD data for both '.1' and '.2' indices. I'm curious if anyone else has run into this issue and if anyone knows a work around for it?
>
Hi Chip,
Setting the MULTI_SUPPORT keyword on GRIB_INVENTORY or GRIB_GET_RECORD should fix this. Here's wgrib2 output for a GFS file with multi-field records:
1:0:d=2012051012:HGT:10 mb:anl:
2:15679:d=2012051012:TMP:10 mb:anl:
3:22323:d=2012051012:RH:10 mb:anl:
4.1:23802:d=2012051012:UGRD:10 mb:anl:
4.2:23802:d=2012051012:VGRD:10 mb:anl:
5:48782:d=2012051012:ABSV:10 mb:anl:
...
To get the 10 mb V wind component, record 4.2, use 5 as the index:
IDL> f = 'gfs.t12z.pgrbf00.2p5deg.grib2'
IDL> r5 = grib_get_record(f, 5, /structure, /multi_support)
IDL> print, r5.parametername, r5.level
v-component of wind 10
Index 6 would then give the 10 mb absolute vorticity, etc.
I know this is a clumsy interface. I'll have to think about a better way to handle multi-field records. Do you (or anyone) have any suggestions?
mp
|
|
|
|