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

# Grib API examples

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.

## Fortran 90

- index.f90 how to access a grib file through an index.
- get.f90 how to get values through the key names.
- 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.
- 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.
- samples.f90 how to create a new message from a template.
- clone.f90 how to clone a message.
- copy_message.f90 how to copy a message in memory and create a new message.
- keys_iterator.f90 how to get the names of all the keys defined in a message and how to iterate through them.
- precision.f90 how to control precision when coding a grib field.
- multi_write.f90 how to encode a grib message containing many fields.
- multi.f90 how to decode a grib message containing many fields.
- print_data.f90 how to print all the data contained in a grib file.
- nearest.f90 how to find the nearest grid points.

## C

- get.c is an example showing how to get values through the key names.
- set.c is an example illustrating how to set values through the key names.
- keys_iterator.c explains how to get the names of all the keys defined in a message and how to iterate through them.
- iterator.c shows how to use an iterator on latitude, longitude, values.
- precision.c illustrates how to control precision when coding a grib field.
- multi.c is an example describing how to decode a grib message containing many fields.
- print_data.c is an example on how to print all the data contained in a grib file.
- nearest.c is an example on how to find the nearest grid points.
- multi_write.c how to encode a grib message containing many fields.
- multi.c how to decode a grib message containing many fields.

## 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.