1139 Rate this article:
No rating

GRIB helper routines

Mark Alonzo
IDL's GRIB routines are a thin layer on top of the the C version of the ECMWF GRIB API.  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. I have three routines, built on IDL's GRIB API, to help make it easier to get information from a GRIB edition 1 or 2 file:
  • GRIB_GET_RECORD: Gets a single record, selected by a one-based index, from a GRIB file.
  • GRIB_GET_PARAMETERNAMES: Gets the value of the parameterName key from each record in a GRIB file.
  • GRIB_GET_PARAMETER: Uses the two routines above to extract all the records in a GRIB file with a given parameterName.
You can download all three routines from the VIS Code Library. The 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. Hopefully, they'll work with any GRIB file, but if they don't, please let me know.

Please login or register to post comments.