BADC GRIB Documentation

Some of the links on this page lead to password protected documents. You will need to register as a BADC user with access to ECMWF data before you can read them.


Introduction

This page gives a brief introduction to GRIB (GRIdded Binary) data with particular emphasis on the GRIB files held at the BADC. The aim is to give an indication of what to expect when faced with a GRIB file. More detailed documentation is available, for example at NCAR and the IMK.

GRIB is a WMO (World Meteorological Organisation) standard format for archiving and exchanging gridded data. GRIB is a binary format, and the data is packed to increase storage efficiency. GRIB data is also self-describing, meaning that the information needed to read the file is present within the file. This page outlines how the data and information needed to interpret the data is stored in a GRIB file.

Each GRIB file is composed of a series of GRIB records. One GRIB record holds the gridded data for one parameter at one time and at one level. Each GRIB record is composed of 6 sections. Section 4 contains the data itself. The other sections give the information required to read the GRIB record, and information on the meteorological parameter contained in the record, the level the record refers to and the type of grid the parameter is on. Section 1, known as the product definition section, and section 2, known as the grid definition section, are the information sections most frequently referred to by users of GRIB data. The product definition section (section 1) contains information about the parameter, level type, level and date of the record. The grid definition section (section 2) contains information on the grid, for instance whether the grid is regular, and the resolution of the grid.

Some of the information in the GRIB record information sections are represented by integer codes. For instance, the name of the parameter in the GRIB record is indicated using an integer known as the GRIB parameter code, or parameter identifier. For ECMWF data the GRIB parameter codes are greater than 126. Code tables, which are not part of the GRIB file but are held separately on disk at the BADC, indicate the meaning of each of the codes. For instance Code Table 2 indicates the GRIB parameter codes for various meteorological parameters.

Example

Being coded binary files, GRIB files are not readable without the use of suitable software. There are utilities held at the BADC which can be used to decode GRIB files.

To get a listing of the information sections of the GRIB records in the file use grib2brief on login.badc.rl.ac.uk. This utility prints out the Product Definition Section, Grid Definition Section, and first 20 data values of each GRIB record in the GRIB file. (grib2brief also outputs a third information section, the Bit Map Section, which is usually absent on files held at the BADC ). Using grib2brief on one of the 2.5° gridded data files held at the BADC will produce an output similar to that displayed below. The [emphasised] text at the line ends has been added here to highlight the most useful pieces of information in the GRIB information sections. It is worth noting that in the Grid definition section latitudes and longitudes are given in milli degrees. Further decoding utilities are described on the GRIB Decoding Software page.

Section 0 - Indicator Section. 
-------------------------------------
Length of GRIB message (octets). 21132
GRIB Edition Number. 1

Section 1 - Product Definition Section.
---------------------------------------
Code Table 2 Version Number. 128
Originating centre identifier. 98 [98=ECMWF]
Model identification. 190
Grid definition. 255
Flag (Code Table 1) 10000000
Parameter identifier (Code Table 2). 129 [129=geopotential]
Type of level (Code Table 3). 100 [100=pressure levels]
Value 1 of level (Code Table 3). 1000 [Data on 1000 hPa]
Value 2 of level (Code Table 3). 0 [used for layer mean data]
Year of reference time of data. 1999 [Date information]
Month of reference time of data. 1 [Date information]
Day of reference time of data. 1 [Date information]
Hour of reference time of data. 0 [Date information]
Minute of reference time of data. 0 [Date information]
Time unit (Code Table 4). 1 [Time unit used for Time ranges]
Time range one. 0 [Data is at hour specified above]
Time range two. 0 [used for time average or accumulated fields]
Time range indicator (Code Table 5) 0
Number averaged. 0
Number missing from average. 0
Century of reference time of data. 20
Sub-centre identifier. 0
Units decimal scaling factor. 0
ECMWF local usage identifier. 1
(Mars labelling or ensemble forecast)
Class. 1
Type. 2
Stream. 1025
Version number or Experiment identifier. 1000
Forecast number. 0
Total number of forecasts. 0

Section 2 - Grid Description Section.
-------------------------------------
(Southern latitudes and Western longitudes are negative.)
Data represent type = lat/long (Table 6) 0 [0=lat/lon grid]
Number of points along a parallel. 144
Number of points along a meridian. 73
Latitude of first grid point. 90000 [in milli degrees]
Longitude of first grid point. 0 [in milli degrees]
Resolution and components flag. 10000000 [see code table 7]
Latitude of last grid point. -90000 [in milli degrees]
Longitude of last grid point. 357500 [in milli degrees]
i direction (East-West) increment. 2500 [in milli degrees]
j direction (North-South) increment. 2500 [in milli degrees]
Scanning mode flags (Code Table 8) 00000000
Number of vertical coordinate parameters. 0

Section 4 - Binary Data Section.
-------------------------------------
Number of data values coded/decoded. 10512
Number of bits per data value. 16
Type of data (0=grid pt, 128=spectral). 0
Type of packing (0=simple, 64=complex). 0
Type of data (0=float, 32=integer). 0
Additional flags (0=none, 16=present). 0
Reserved. 0
Number of values (0=single, 64=matrix). 0
Secondary bit-maps (0=none, 32=present). 0
Values width (0=constant, 16=variable). 0

First 20 data values. [for scanning mode 00000000 longitudes 
924.8220               vary most rapidly and scan from West to East
924.8220               latitudes vary least rapidly and scan from 
924.8220               North to South.  So the data opposite is
924.8220               the first 20 longitudes for the north pole]
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220 
924.8220


Decoding Software

The BADC has several GRIB decoding utilities based on code from the ECMWF. Other decoding utilities are also available. One which is particularly popular as it will run on a wide range of platforms, including PCs, is wgrib. A copy of wgrib and related documentation can be found in the software directory at the BADC.