X
3077

GRIB Helper Library Routines

A set of four higher-level (higher than the GRIB API in IDL 8.1) library routines for reading information from a GRIB file. They require IDL 8.1 on Linux or Mac OS X. 


IDL's GRIB routines are a thin layer on top of the the C version of the ECMWF GRIB API
(http://www.ecmwf.int/products/data/software/grib_api.html). The ECMWF routines exposed in IDL are fairly low-level, so they require a bit of programming to extract even simple information from a GRIB file.

There are four routines, built on IDL's GRIB API, to help make it easier to get information from a GRIB1/2 file:


  • GRIB_INVENTORY: Creates an inventory of a GRIB1/2 file, returned as a string array.
  • GRIB_GET_RECORD: Gets a single record, selected by index, from a GRIB1/2 file.
  • GRIB_GET_PARAMETERNAMES: Gets the value of the 'parameterName', 'name', 'shortName' or 'cfName' key from each record in a GRIB1/2 file. 
  • GRIB_GET_PARAMETER: Uses GRIB_GET_PARAMETERNAMES and GRIB_GET_RECORD to extract all the records in a GRIB1/2 file with a given parameter name.
These routines can be called from the IDL command line or used as library routines in programs. See the IDLdoc documentation for these routines for examples of how to call them.

I've tested these routines on a variety of GRIB1 and GRIB2 files from ECMWF, NCEP, NCAR, NOAA and AFWA. Please let me know if they don't work with a particular GRIB file.
---------------------------------------------------------------------------------------------------------------
Update: 2012-08, fixed bug in GRIB_GET_RECORD and GRIB_INVENTORY affecting 64-bit OSes.
Update: 2012-03, updated three original routines, added GRIB_INVENTORY. 
Update: 2011-11, modified GRIB_GET_RECORD.
Update: 2012-12, modified GRIB_GET_RECORD.