Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column

Introduction

The ECMWF grib_api software library provides a set of functions/subroutines and command line tools for encoding and decoding WMO FM-92 GRIB edition 1 and edition 2 messages. The OpenIFS model uses GRIB for its input and output files.

The grib_api software library must be build and installed before you try to build OpenIFS on your systembuilding OpenIFS. Although you there may have be a version of grib_api on your system already that would most likely work, it is recommended that you build and install grib-api yourself to ensure the same compiler and compiler version is used. Otherwise you may see error messages about conflicting module versions when compiling OpenIFS.

This page gives additional information about grib-api for OpenIFS. For more information about grib_api and , to download and install it please visit the grib_api website.

Column
width50px

 

Column
width280px
Panel
bgColorwhite
titleBGColorlightlightgrey
titleOn this page

Table of Contents
maxLevel2
stylesquare
printablefalse

...

If you haven't already obtained the grib_api package, get it from the grib-api web site.

We recommend downloading the latest version. Some of the instructions for options below may differ with the very latest versions.

...

To unpack the software:

Code Block
languagebash
titleCreate directory and unpack source
mkdir -p ecmwf/src
cd ecmwf/src
tar zxf grib_api-1.914.180-Source.tar.gz

or if your version of tar doesn't support the 'z' option, do:

Code Block
gunzip grib_api_1.914.180.tar.gz
tar xf grib_api-1.914.180.tar

Configuring grib_api for OpenIFS

Grib_api uses the CMake command for configuration and compilation. CMake is available for modern Linux systems but may have to be installed.

Alternately grib_api supports installation via a 'configure' script, though this option is deprecated. See GRIB API Installation for more details and instructions below.

CMake compilation must be done is a separate build directory to the source and the install directory.

Code Block
languagebash
titleSteps to configure grib-api with CMake
cd ecmwf
mkdir bld
mkdir grib-api
cd bld
export CC=cc
export FC=ftn
cmake ../grib_api-1.14.0-Source   \
      -DCMAKE_BUILD_TYPE=Bit          \
      -DCMAKE_INSTALL_PREFIX="../grib-api"   \
      -DENABLE_NETCDF=ON              \
      -DENABLE_JPG=OFF                \
      -DENABLE_PNG=OFF                \
      -DENABLE_PYTHON=ON              \
      -DENABLE_FORTRAN=ON             \
      -DENABLE_GRIB_THREADS=ON

Explanation of lines:

export CC=cc
export FC=ftn

These lines set the choice of compiler. CMake is often able to determine the available compilers for itself.
However, in cases where multiple compilers are available, or where compiler wrappers are used (as on HPC systems), it's preferable to set these explicitly by use of environment variables.
CMAKE_BUILD_TYPE=Bit"Bit" here means 'bit-reproducible'. It instructs CMake to use conservative compiler options that are known to ensure bit-reproducibility in separate runs of OpenIFS.
CMAKE_INSTALL_PREFIX="../grib_api"

This specifies the location where the 'make install' command will place the grib-api installation.

ENABLE_NETCDF=ONEnabling netcdf ensures the grib_to_netcdf command can be used.
ENABLE_JPG=OFF
ENABLE_PNG=OFF
As OpenIFS does not deal with any image based GRIB data these options can be disabled, unless you have other grib data containing images that you need to work with.
ENABLE_PYTHON=ONSome of the utilities that come with OpenIFS make use of the python interface to grib_api, e.g. the tools to create and manipulate the model data.
For this option to work, ensure that a python installation is available.
ENABLE_FORTRAN=ONThis enables the Fortran interface to grib_api and should always be on.
ENABLE_GRIB_THREADS=ONThis ensures grib_api is compiled to be 'thread-safe'. Although OpenIFS does not currently use multiple threaded calls to grib-api, future versions may do so this option is recommended.

 

 

 

 

Configuring grib_api with configure script

If you are familiar with compiling and installing software on linux systems, you will be used to the following steps. Grib_api uses the GNU configure tool to ease building and compilation. It is tested on different platforms and compilers and should not cause any problems. If however, you do have a problem installing grib_api, please email: openifs-support@ecmwf.int.

...