GRIB2 USERS GUIDE (C)
Contents:
- Introduction
- GRIB2 Tables/Templates
- GRIB2 Encoding Routines
- GRIB2 Decoding Routines
- Decoding all GRIB2 Fields in a File
- Extracting Selected GRIB2 Fields from a GRIB2 file
- GRIB2 Routine Documentation
===============================================================================
Introduction
This document briefly describes the routines available for encoding/decoding
GRIB Edition 2 (GRIB2) messages. A basic familiarity with GRIB is assumed.
A GRIB Edition 2 message is a machine independent format for storing
one or more gridded data fields. Each GRIB2 message consists of the
following sections:
SECTION 0 - Indicator Section
SECTION 1 - Identification Section
SECTION 2 - (Local Use Section) - optional }
SECTION 3 - Grid Definition Section } }
SECTION 4 - Product Definition Section } } }(repeated)
SECTION 5 - Data Representation Section } }(repeated) }
SECTION 6 - Bit-map Section }(repeated) } }
SECTION 7 - Data Section } } }
SECTION 8 - End Section } } }
Sequences of GRIB sections 2 to 7, 3 to 7, or sections 4 to 7 may be repeated
within a single GRIB message. All sections within such repeated sequences
must be present and shall appear in the numerical order noted above.
Unrepeated sections remain in effect until redefined.
The above overview was taken from WMO's FM 92-XII GRIB description
of the GRIB Edition 2 form.
===============================================================================
GRIB2 Tables/Templates
WMO's GRIB2 specification "FM 92-XII GRIB - General Regularly-distributed
Information in Binary Form" contains descriptions of each template
and code table information. This document can be found at
http://www.wmo.ch/web/www/WMOCodes.html
(PDF and MSWord formats are available)
===============================================================================
GRIB2 Encoding Routines
Since a GRIB2 message can contain gridded fields for many parameters on
a number of different grids, several routines are used to encode a message.
This should give users more flexibility in how to organize data
within one or more GRIB2 messages.
To start a new GRIB2 message, call function g2_create. G2_create
encodes Sections 0 and 1 at the beginning of the message. This routine
must be used to create each message.