grib_api: GRIB API

- Main Page
- Modules
- Files
- Related Pages
- Examples

# GRIB API

## New

- GRIB edition 1 to 2 conversion
- Parameters in GRIB API
- GRIB API keys
  - GRIB edition 1
  - GRIB edition 2
  - Edition independent

## Overview

The grib_api is the application program interface developed at ECMWF to provide an easy and realiable way for encoding and decoding WMO FM-92 GRIB edition 1 and edition 2 messages.

With the grib_api library, that is written entirely in C, some command line tools are provided to give a quick way to manipulate grib data. Moreover a Fortran interface 90 is available giving access to the main features of the C library.

The library is designed to access and modify messages in both editions with the same function calls using a set of Grib API keys to access the coded information ( examples: get.f90 set.f90, get.c, set.c, grib_get, grib_set ).

The keys available for a message are different depending not only on the edition but also and mainly on the type of each message and the information it contains. A list of all the available keys in a message can be obtained dynamically using the library as shown in keys_iterator.c or using the Grib tools as shown in grib_dump or grib_keys.

GRIB API will replace the GRIBEX function and a table of conversion between the numeric encoding of GRIBEX and the alphanumeric keys of GRIB API is provided to help the migration.

To learn how to use the grib_api we recommend the user works through the Grib API examples.

Reference manuals are also provided for the C library (organized in C interface) and for the Fortran 90 interface.

Installation instructions are also provided.

## Compiling and linking on ECMWF platforms

The grib API is installed on all systems at ECMWF with both its components: the library and the tools.
The latest version of the tools is always available in the system PATH so that users can begin using the tools immediately by typing directly the tool name (see tools reference).
The latest version of the library is also installed on any platform and it is available for linking through the following two environment variables: $GRIB_API_INCLUDE $GRIB_API_LIB.
Here is a short summary on how to compile and link on ECMWF systems:

- ecgate, hpce, hpcf

      > xlc -o foo foo.c $GRIB_API_INCLUDE $GRIB_API_LIB -lm

      > xlf90 -o foo foo.f90 $GRIB_API_INCLUDE $GRIB_API_LIB

- linux cluster (C programs)

      > gcc -m32 -o foo foo.c $GRIB_API_INCLUDE $GRIB_API_LIB

- workstation (C programs)

      > gcc -o foo foo.c $GRIB_API_INCLUDE $GRIB_API_LIB

- linux cluster,workstation (Fortran programs)

      > use pgf90
      > pgf90 -o foo foo.f90 $GRIB_API_INCLUDE $GRIB_API_LIB