Page tree

GRIB-API support is being discontinued at the end of 2018. Please consider upgrading to ecCodes


Skip to end of metadata
Go to start of metadata

The main features of the GRIB API are explained here through some simple examples that can be taken as a starting point to write more complex programs.

Python

  • clone.py How to create a new GRIB message by cloning an existing message.
  • count_messages.py How to count the messages in a file and loop through them.
  • get.py How to get values through the key names.
  • index.py How access a GRIB file through and index.
  • iterator_bitmap.py How to use an iterator on lat/lon/values and query the bitmap for missing values (rather than compare each value with the missingValue key)
  • iterator.py How to use an iterator on lat/lon/values.
  • keys_iterator.py How to get the names of all the keys.
  • multi_write.py How to encode a multi-field GRIB2 message.
  • nearest.py How to find the nearest grid points.
  • print_data.py How to print all the data contained in a GRIB file.
  • samples.py How to create a new message from a sample.
  • set_bitmap.py How to set a bitmap in a GRIB message.
  • set_missing.py How to set a missing value in the header.
  • set_pv.py How to encode the pv coefficients.
  • set.py How to set values through the key names.

Fortran 90

  • clone.f90 how to clone a message.
  • copy_message.f90 how to copy a message in memory and create a new message.
  • count_messages.f90 count the messages in a file and loop through them.
  • get_pl.f90 how to get the list of number of points for each parallel in reduced grids.
  • get_pv.f90 how to get the list of levels.
  • get_data.f90 how to get latitude/longitude/values.
  • get.f90 how to get values through the key names.
  • index.f90 how to access a grib file through an index.
  • keys_iterator.f90 how to get the names of all the keys defined in a message and how to iterate through them.
  • multi_write.f90 how to encode a grib message containing many fields.
  • multi.f90 how to decode a grib message containing many fields.
  • nearest.f90 how to find the nearest grid points.
  • print_data.f90 how to print all the data contained in a grib file.
  • precision.f90 how to control precision when coding a grib field.
  • samples.f90 how to create a new message from a template.
  • set.f90 how to set values through the key names.
  • set_bitmap.f90 how to set and use a bitmap.
  • set_missing.f90 how to set a missing value in the header.
  • set_pv.f90 how to set the list of levels.

C

  • clone.c shows how to create a new GRIB message by cloning an existing message.
  • get.c is an example showing how to get values through the key names.
  • index.c shows how to create and use an index to access messages from a file.
  • iterator_bitmap.c How to use an iterator on lat/lon/values and query the bitmap for missing values (rather than compare each value with the missingValue key).
  • iterator.c How to use an iterator on lat/lon/values.
  • keys_iterator.c Explains how to get the names of all the keys defined in a message and how to iterate through them.
  • multi.c An example describing how to decode a GRIB message containing many fields.
  • multi_write.c How to encode a GRIB message containing many fields.
  • nearest.c How to find the nearest grid points.
  • precision.c How to control precision when coding a grib field.
  • print_data.c How to print all the data contained in a grib file.
  • set_bitmap.c How to set a bitmap in a GRIB message.
  • set_data.c How to set the data contained in a GRIB file.
  • set.c How to set values through the key names.

Fortran 77

  • get_fortran.F is an example showing how to get values through the key names.
  • set_fortran.F is an example illustrating how to set values through the key names.
  • keys_iterator_fortran.F explains how to get the names of all the keys defined in a message and how to iterate through them.
  • iterator_fortran.F shows how to use an iterator on latitude, longitude, values.
  • precision_fortran.F illustrates how to control precision when coding a grib field.
  • multi_fortran.F is an example describing how to decode a grib message containing many fields.
  • print_data_fortran.F is an example on how to print all the data contained in a grib file.
  • No labels