GRIB2 Meta Data and grib_api Keys for Section 3: Grid Definition Section

Last updated: January 2013

This table lists the GRIB2 meta data and associated grib_api keys for the Grid Definition Section of GRIB2 messages. The most important values of according Code Tables are also listed in the comments for a reference. Values which are fixed for the COSMO-Model are written on a light-blue background.

The first octets of the Grid Definition Section are general for all grids, but the rest of the section depends on the special grid used. There are templates for special grids and here we only list the template 3.1 for rotated latitude-longitude grids used in the COSMO-Model system.


Octets Key Name Comments
1-4 section3Length Length of section in octets (nn)
5 numberOfSection Number of section (3)
6 sourceOfGridDefinition Source of grid definition according to Code Table 3.0:
0Grid specified in Code Table 3.1 (see below). This value is used in the COSMO-Model
1Predetermined grid definition defined by originating centre
2-191Reserved
192-254Reserved for local use
255Missing
If octet 6 is not zero, octets 15-xx (15-nn if octet 11 is zero) may not be supplied. This should be documented with all bits set to 1 (missing value) in Grid Definition Template Number (octets 13-14)
7-10 numberOfDataPoints Number of data points in the grid (set implicitly by grib_api)
11 numberOfOctetsForNumberOfPoints Number of octets for optional list of numbers, which may be used to document a quasi-regular grid. If it is non-zero, it gives the number of octets used per item in the list. For all other cases, such as regular grids, octets 11 and 12 are zero and no list is appended to the Grid Definition Template.
0There is no appended list
Nothing else is used in the COSMO-Model
12 interpretationOfNumberOfPoints Interpretation of list of numbers according to Code Table 3.11:
0There is no appended list
Nothing else is used in the COSMO-Model
13-14 gridDefinitionTemplateNumber Grid definition template number according to Code Table 3.1:
0Latitude / longitude; also called equidistant cylindrical or Plate Carre
1Rotated latitude / longitude
2Stretched latitude / longitude
100Triangular grid based on an icosahedron
101General unstructured grid - under validation
65535Missing
15-xx Grid definition template: The COSMO-Model uses the template 3.1 (rotated lat/lon):
Octets 15-72 are the same as Grid definition template 3.0
Octets 73-84 are additional for rotated grids.
15 shapeOfTheEarth Shape of the earth, according to Code Table 3.2:
6 Earth assumed spherical with radius of 6371229,0 m
16 scaleFactorOfRadiusOfSphericalEarth Scale factor of radius of spherical earth;
UNDEFINED for COSMO-Model
17-20 scaledValueOfRadiusOfSphericalEarth Scaled value of radius of spherical earth;
UNDEFINED for COSMO-Model
21 scaleFactorOfEarthMajorAxis Scale factor of major axis of oblate spheroid earth;
UNDEFINED for COSMO-Model
22-25 scaledValueOfEarthMajorAxis Scaled value of major axis of oblate spheroid earth;
UNDEFINED for COSMO-Model
26 scaleFactorOfEarthMinorAxis Scale factor of minor axis of oblate spheroid earth;
UNDEFINED for COSMO-Model
27-30 scaledValueOfEarthMinorAxis Scaled value of minor axis of oblate spheroid earth;
UNDEFINED for COSMO-Model
31-34 Ni Number of points along a parallel (latitude)
35-38 Nj Number of points along a meridian (longitude)
39-42 basicAngleOfTheInitialProductionDomain Basic angle of the initial production domain. See also next item.
UNDEFINED for COSMO-Model
43-46 subdivisionsOfBasicAngle Subdivisions of basic angle used to define extreme longitudes and latitudes and direction increments.
The basic angle of the initial production domain and the subdivisions of this basic angle are provided to manage cases where the recommended unit of 10-6 degrees is not applicable to describe the extreme longitudes and latitudes, and direction increments.
UNDEFINED for COSMO-Model
47-50 latitudeOfFirstGridPoint (La1) Latitude of first grid point
51-54 longitudeOfLastGridPoint (Lo1) Longitude of first grid point
55 resolutionAndComponentFlags Resolution and component flags, according to Flag Table 3.3:
bitvalueMeaning
1-2 Reserved
3 0 i direction increments not given
3 1 i direction increments given
4 0 j direction increments not given
4 1 j direction increments given
5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions
5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates respectively
6-8 0 Reserved
COSMO-Model strategy
GRIB1 could not code higher resolutions exactly (only up to 3 digits after the dot). Therefore the corresponding bits in the resolutionAndComponentFlags were set to 0.
The u- and v-components of the horizontal wind are given relative to the defined rotated grid, therefore this bit (also bit 5 in GRIB1) is set to 1.
GRIB2 now can code a higher precision for values in degrees, therefore bits 3 and 4 are now set to 1 and the increments are given. Bit 5 remains 1 also in GRIB2. The value of octet 55 in the COSMO-Model therefore is: 56
56-59 latitudeOfLastGridPoint (La2) Latitude of last grid point
60-63 longitudeOfLastGridPoint (Lo2) Longitude of last grid point
64-67 iDirectionIncrement (Di) i direction increment
68-71 jDirectionIncrement (Dj) j direction increment
72 scanningMode(Dj) Scanning mode flags according to Flag Table 3.4
bitvalueMeaning
1 0 Points of first row or column scan in the +i direction
1 1 Points of first row or column scan in the -i direction
2 0 Points of first row or column scan in the -j direction
2 1 Points of first row or column scan in the +j direction
3 0 Adjacent points in i direction are consecutive
3 1 Adjacent points in j direction are consecutive
4 0 All rows scan in the same direction
4 1 Adjacent rows scan in the opposite direction
5-8 0 Reserved
scanningMode = 64 for the COSMO-Model:
The meaning of bits 1-3 are the same in GRIB1 and GRIB2, and bit 4 from GRIB2 will be set to 0 for the COSMO-Model grid. This means that the value of the scanningMode will be the same in GRIB1 and in GRIB2, namely 64 (which means that just bit 2 is set to 1).
73-76 latitudeOfSouthernPole Latitude of the southern pole of the rotated grid
77-80 longitudeOfSouthernPole Longitude of the southern pole of the rotated grid
81-84 angleOfRotation Angle of the rotation
85-nn pl List of number of points along each meridian or parallel (These octets are only present for quasi-regular grids)
Not present in the COSMO-Model grid


Back to full table