About GRIB

GRIB edition 1 and GRIB edition 2  (GRIdded Binary or rather General Regularly-distributed Information in Binary form) - referred to as GRIB1 and GRIB2 from now on - are WMO (World Meteorological Organization) binary standard formats defined by the WMO Commission for Basic Systems under GRIB FM 92 for the international exchange of meteorological gridded data. Since the implementation of IFS cycle 37r2 on the 18 May 2011, ECMWF has produced its operational data, as well as a variety of reanalysis data, in a mixture of GRIB1 and GRIB2. Both formats are table based binary data, machine independent, and they need specific software for the data processing.
The meta-data are encoded in the form of integer values whose corresponding meaning is defined in code tables published by the WMO.
For GRIB2, these code tables, as well as templates which describe the layouts of GRIB2 messages, are extended, or new proposed parameters / templates are added on a biennial basis in a fast-track procedure by the WMO Task Team on Table Driven Code Forms (TT-TDCF).
GRIB edition 0 was introduced by WMO in 1985, GRIB1 in 1990 and GRIB2 in 2001.
Edition 1 was removed from the WMO Manual on Codes, Volume I.2 (WMO-No. 306) in 2016. Since then, GRIB2 is the official WMO format, and there is an initiative for GRIB edition 3 (GRIB3).

Structure of GRIB1 and GRIB2 messages

A GRIB1 message consists of 6 and a GRIB2 message of 9 sections. The following figure illustrates the layout of a GRIB1 and GRIB2 message.

GRIB_1-2.png

GRIB messages are record based.
This means that each message contains a single parameter on a single level, for a single time instance (point in time or processed over a time interval), a single ensemble member, etc, and includes its own complete set of meta-data. GRIB2 offers the possibility to code multi-field messages as well, but this feature is not used at ECMWF, as the infrastructure is designed for the usage of single field records, and the saving by using multi-field messages is only small. Multi-field messages are not further discussed. The single messages are concatenated into a sequence of messages.
Each message is sub-divided into sections with the structure shown in the figure depending whether it is edition 1 or 2.

Templates are used in GRIB2 to further adapt the layout of the messages for specific products.
A template defines the keys and order of bytes. Some of these keys refer to entries in the WMO code tables represented as integer values in the binary file. 
Section 3 (Grid Definition), section 4 (Product Definition) and section 5 (Data representation) are all template based. This makes GRIB2 much more flexible than GRIB1.

Templates are also published by WMO in the same way as the parameter code tables. New parameters and templates can be proposed to WMO on a biennial basis. Meta-data, which are centre specific can be added to the section 2, which is designated for a local use and the only section which does not have to be included in the message.

To see how templates change and extend the content of a GRIB2 message, see GRIB edition 2 template example for Product Definition Section.

Advantages of GRIB2 over GRIB1

  • GRIB2 is much more meta-data rich than GRIB1 – this allows for a better description of the data content
  • Higher precision of some meta-data in GRIB2 – e.g., the accuracy for latitude-longitude coordinates increased from milli- to micro degrees which is essential to be able to encode higher resolved model data
  • Higher accuracy of coded values in GRIB2
  • More sophisticated and effective compression methods of data values, e.g., CCSDS, are available in GRIB2. This helps to reduce the size of archived data, which will increase significantly with higher model resolutions.  It is also important for the adaptation of the ECMWF ENS forecast resolution to the that of the high-resolution deterministic forecast.
  • GRIB2 includes a separate section (Section 2) for encoding centre-specific information. This is used at ECMWF for example to encode keys for the archiving and retrieval in the ECMWF Meteorological Archival and Retrieval System ( MARS ), e.g., the keys mars.class and mars.stream.
  • GRIB2 is more template based than GRIB1 making the format more flexible and easier to extend. Extensions can be requested on a biennial basis at the WMO. Various kinds of products are represented by different templates. In GRIB1, information which was not foreseen in the official data format can be encoded by local centre specific unofficial extensions of the file format. In GRIB2, the encoding of local “non-standard keys” can be reduced and, in the case where they are still required, these local keys are added to the dedicated local section 2, whereas in GRIB1 they impact the official data layout. This makes the data exchange more robust with GRIB2 as all sections in the GRIB2 messages (except for the local section 2) are consistent with the official WMO layout and the section 2 can be simply ignored when decoding the message as each section length is encoded at the beginning of the section.
  • GRIB2 allows for both the coding of multi-field as well as single-field messages. The design of the MARS archive is optimised for the usage of single field GRIB messages.
    This has the advantage that a single field can be extracted from a tape without reading large files, messages can be concatenated, in the case where a single message is corrupted, the other messages can still be used, or if the file transfer is interrupted, only the missing part must be sent again.
Stay in the loop!

Mailing List

Users who wish to receive regular updates about the progress in the migration to GRIB2 can subscribe to the mailing list mtg2@lists.ecmwf.int .

To subscribe, send an email to sympa@lists.ecmwf.int   with the subject "SUBSCRIBE  mtg2@lists.ecmwf.int "

Contents of this page

  • No labels