ecCodes provides high-level access to the information in a GRIB message through a set of edition-independent keys. The advantage in writing code using only those keys is that the resulting application is edition-independent and can therefore process GRIB edition 1 or 2 transparently.

Some of the edition-independent keys are grouped in namespaces for convenience (think of a namespace as a fancy word for a grouping of related keys).

The values of the keys in a namespace can be obtained from the GRIB just using the "codes_get" instruction with the key name or with the key name prefixed by the namespace name. For example the following are equivalent:

The same is valid for the "codes_set" instruction.

All the values of the keys belonging to a namespace can be printed with the -n option of grib_ls or with the keys iterator provided by the library.

The corresponding namespaces of two GRIB messages can be compared with grib_compare which is able to detect the keys of the namespace having different values in the two messages.

The following namespaces are available:


This is the namespace used by the grib_ls and bufr_ls tools and has the most commonly used keys e.g. centre, shortName, level, etc

parameterContains keys like paramId, shortName, units which relate to the meteorological parameter
statisticsContains keys that relate to the statistics of the data values e.g. maximum, minimum, average, standard deviation, etc
timeContains keys that describe the forecast runs e.g. forecast date, validity date, steps, etc
geographyContains keys that describe the grid geometry e.g. bounding box of the grid, number of points along a parallel, etc
verticalContains keys that describe the levels and layers e.g. type of the level, list of coefficients of the vertical coordinate, etc
marsContains the list of MARS (ECMWF's Meteorological Archive and Retrieval System) keywords like class, stream, type, etc

The contents of a namespace can vary depending on the type of GRIB message, for example the geography namespace will contain the pl key for reduced grids but not for regular grids.

The keys in some of these namespaces are shown here:


For example you can do this to get a quick glimpse of the range of the field values:

% grib_ls -n statistics my.grib
max         min         avg         sd          skew        kurt        const
18.3252     -16.1601    0.151664    5.22904     0.21726     0.0127901   0
16.9913     -18.6307    -0.224182   4.94629     -0.124849   1.17177     0
2576.62     0           70.0314     212.188     6.8669      62.8954     0

and the parameter information:

% grib_ls -n parameter my.grib
centre      paramId     shortName   units       name
ecmf        165         10u         m s**-1     10 metre U wind component
ecmf        166         10v         m s**-1     10 metre V wind component
ecmf        59          cape        J kg**-1    Convective available potential energy
ecmf        260207      smref       Proportion  Transpiration stress-onset (soil moisture)
ecmf        156         gh          gpm         Geopotential Height