Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The conversion from GRIB edition 1 (grib1GRIB1) to edition 2 (grib2GRIB2) is a format translation without any loss of information. Conversely the conversion from grib2 GRIB2 to grib1 GRIB1 is not always lossless because the edition 2 format has been extended to allow a wider set of scientific fields to be coded.

Since the new grib2 GRIB2 format is going to replace grib1 GRIB1 we will focus more on the grib1 GRIB1 to grib2 GRIB2 conversion rather than the opposite, which sometimes is not possible.

The conversion algorithm should be easy to implement, but there are some factors making it challenging. First of all the new designed grib2 GRIB2 is in some points semantically different from grib1GRIB1. Therefore it doesn't allow an easy mapping of the meaning across the two versions. Moreover some of the numeric code tables semantically identical are numerically different, which again doesn't allow an easy mapping between them, because the numeric codes for the same information element are different. We refer in particular to the type of level which is numerically different in the two editions.

Another element to be considered in a conversion algorithm is that many meteorological operational centres have been developing local patches to the GRIB specification to overcome the limitations of grib1GRIB1. This local extensions or local tables are not coherent and sometimes are not properly organised. It is widespread, for example, the use of local parameter tables.

...

For each parameter we can have one or more grib1 GRIB1 and/or grib2 GRIB2 representations. A GRIB representation is a set of keys describing the parameter in the coding format (grib1 GRIB1 or grib2GRIB2). If for a parameter the grib1 GRIB1 and grib2 GRIB2 representations are both present in the list then the conversion from grib1 GRIB1 to grib2 GRIB2 is defined and can be automatically performed by ecCodes just setting edition=2.

...

A definition file containing the rules for a given centre and edition has to be placed in the directory grib[edition]/localConcepts/[centre:s]. Where [edition] is 1 or 2 and [centre:s] is the string describing the centre in the official table 0 of grib1 GRIB1 (e.g. centre code 98 is "ecmf")

The files describing the local parameters for ECMWF grib1 GRIB1 are located in grib1/localConcepts/ecmf. If for example we need to define "2 metre temperature" for ECMWF we have to add the following lines to the corresponding files:

...

The same syntax can be used to describe the same parameter in grib2 GRIB2 to be able to convert the information from grib1 GRIB1 to grib2 GRIB2 and to be able to have the same paramId, name, shortName, units for both editions.

...

Code Block
% codes_info
ecCodes Version 2.1626.0

Default definition files path is used: /usr/local/apps/eccodes/2.1626.0/share/eccodes/definitions
Definition files path can be changed by setting ECCODES_DEFINITION_PATH environment variable

Default SAMPLES path is used: /usr/local/apps/eccodes/2.1626.0/share/eccodes/samples
SAMPLES path can be changed by setting ECCODES_SAMPLES_PATH environment variable

...

Code Block
export ECCODES_DEFINITION_PATH=/home/u/definitions:/usr/local/apps/eccodes/2.1626.0/share/eccodes/definitions

...