GRIB Decoding Software


Introduction

This page details a number of software options for decoding GRIB (GRIdded Binary) data that are available from the BADC:

ECMWF GRIBEX Fortran code software (now replaced by GRIB_API)

The ECMWF provides Fortran routines and example programs to decode GRIB data. This software is now publicly and freely available from the ECMWF software pages. Documentation is also provided for users.

Local software for GRIB decoding

The BADC have adapted the GRIBEX sample routines to provide some quick-look facilities for GRIB files. These routines are available on login.badc.rl.ac.uk, the BADC server. The routines can be used to list the record header information, giving information on the parameters, levels, dates within the file, and/or decode and list the data itself in ASCII format. Files stored on the BADC contain many GRIB records and decoding them using any of the following routines often results in large amounts of output. It is a good idea to pipe the output into the more command or redirect the output to a different file. The utilities are provided mainly for a quick-look facility. The decoded data output from the utilities takes up more disk space than the GRIB files and it is suggested that to use the GRIB data it is more efficient to download the GRIB files to your local machine rather than decoded text versions.

Decoding the record headers

The record headers contain information on the parameters, levels, dates, data grid etc. within the file. A list of the headers can be obtained using the program grib2brief.
grib2brief file | more
To get very brief output pipe the output of grib2brief through grep.
grib2brief file | grep "Section 0" | wc -l
gives the number of GRIB records in the file.
grib2brief file | grep "Parameter" | sort | uniq
lists the parameters present in the file.

Decoding the data

The BADC provide two utilities that can be used to decode the data as well as the record header information. The first, grib2fulltxt, gives full record header information as well as the data. The second, grib2txt gives an abbreviated form of the record headers as well as the data. The abbreviated header is a simple column of data. The rows in the column are: parameter, leveltype, level, year, month, day, hour, minute.
grib2fulltxt file
grib2txt file

GRIB record filters

A couple of utilities are provided to help reduce the size of GRIB files that are downloaded from the BADC. These utilities extract GRIB records, either by level or parameter, from a GRIB file. To filter a particular level out of a GRIB file use griblevel. To filter a particular parameter out of a GRIB file use gribparameter.
griblevel -l level file_in > file_out
to extract level level or
gribparameter -p parameter file_in > file_out
to extract parameter parameter. At present griblevel and gribparameter will only extract one level or parameter at a time.

gribdecode

In the current implementation all of the above GRIB utilities sit on top of a single program gribdecode. To get more information use
gribdecode -h

Other software for decoding, converting and subsetting GRIB files

The BADC provides an X windows utility called XCONV which allows the user to interactively manipulate GRIB data. The package includes format conversion, interpolation, sub-setting and plotting options. XCONV is presented via a user-friendly Graphical User Interface.

The BADC also provides a the CONVSH utility which is a command-line equivalent of XCONV. Scripts can be written for CONVSH to batch process data files. Both packages can are available via download for a number of different platforms. The BADC has developed the subset.tcl command line utility to allow subsetting, batch processing and conversion of GRIB files.

If you have any problems with the GRIB decoding utilities please contact BADC Support.