...
Section | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Create a directory called $HOME/ecmwf
in which grib-api ecCodes will be downloaded and compiled.
If you haven't already obtained the grib_api package, ecCodes, get it from the grib-api web site ecCodes Releases page.. We recommend downloading the latest version. Some of the instructions for options below may differ with the very latest versions.
Unpacking
...
ecCodes
To unpack the software:
Code Block | ||||
---|---|---|---|---|
| ||||
mkdir -p ecmwf/src cd ecmwf/src tar zxf grib_apieccodes-12.149.0-Source.tar.gz |
or if your version of tar doesn't support the 'z' option, do:
Code Block |
---|
gunzip grib_api_1.14.0.tar.gz
tar xf grib_api-1.14.0.tar |
Configuring using CMake
Configure ecCodes for OpenIFS using CMake
ecCodes uses the CMake command Grib_api uses the CMake command for configuration and compilation. CMake is available for usually installed by default on modern Linux systems but may have to be installed .
Alternately grib_api supports installation via a 'configure' script, though this option is deprecated.
if not.
CMake compilation CMake compilation must be done in a separate build directory to both the source and the install directory. More information on configuring and building ecCodes is available on the ecCodes page.
Code Block | ||||
---|---|---|---|---|
| ||||
mkdir bld mkdir grib-apieccodes cd bld cmake ../grib_apieccodes-12.149.0-Source \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_Fortran_COMPILER=gfortran \ -DCMAKE_INSTALL_PREFIX="../grib-apieccodes" \ -DENABLE_NETCDF=ON \ -DENABLE_JPG=OFF \ -DENABLE_PNG=OFF \ -DENABLE_PYTHON=ON \ -DENABLE_FORTRAN=ON \ -DENABLEDBUILD_GRIBSHARED_OMP_THREADS=ON \ -DBUILD_SHARED_LIBS=OFFLIBS=BOTH |
Explanation Explanation of lines. Note that all options are prefixed by '-D':
| These lines set the choice of compiler. CMake is often able to determine the available compilers for itself. Note the CMake variables are preferred rather than set environment variables CC and FC. | ||
CMAKE_INSTALL_PREFIX="../grib_apieccodes" | This specifies the location where the 'make install' command will place the grib-api eccodes installation. | ||
ENABLE_NETCDF=ON | Enabling netcdf this option ensures the grib_to_netcdf command can be used. Note: a netCDF library must be available on the system. | ||
ENABLE_JPG=OFF ENABLE_PNG=OFF | As OpenIFS models do not deal with any image based GRIB data these options can be disabled, unless you have other gribGRIB data containing images that you need to work with. Setting this removes the need for the Jasper or OpenJPG libraries. | ||
ENABLE_PYTHON=ON | Some of the | ENABLE_PYTHON=ON | Some of the utilities that come with the OpenIFS model make use of the python interface to grib_api, ecCodes e.g. the tools to create and manipulate the model data. For this option to work, ensure that a python installation is available. This option is not needed for the single column nor offline surface models currently. |
ENABLE_FORTRAN=ON | This enables the Fortran interface to grib_api ecCodes and should always be on as OpenIFS uses this. | ||
ENABLEBUILD_GRIBSHARED_OMP_THREADSLIBS=ON | Not essential but recommended. This ensures grib_api supports OpenMP threads. Note this is not the same as the option ENABLE_GRIB_THREADS which is for Posix threading and not used by the OpenIFS model. Although OpenIFS models do not currently use multiple threaded calls to grib-api, future versions may do so this option is recommended. | ||
BUILD_SHARED_LIBS=OFF | grib_api can be built with both 'shared' and 'static' libraries for linking. Normally static libraries are sufficient. Note that some IBM users may experience problems if shared libraries are built. |
Available options
To get additional help on the available options (similar to the 'configure --help' command) run the command:
Code Block |
---|
cmake -LH grib_api-1.14.0-Source |
Info |
---|
This command will cause cmake to run its system discovery if this is the first time the command has been used. On some systems, this may take time to complete. |
Configuring using autotools
Grib_api compilation can be made using the GNU configure tool. This will be familiar to many who have previously installed software.
The configure command is probably the easiest method as it does not rely on having the CMake package installed, though note it is deprecated in favour of using cmake (see above).
The configure command is contained in the grib_api directory. A few options are needed to suit the OpenIFS models and gcc & gfortran compilers are assumed in the example below. If you use different compilers, see below.
Code Block | ||
---|---|---|
| ||
cd grib_api_1.14.0-Source
CC=gcc FC=gfortran ./configure --prefix=$HOME/ecmwf/grib_api --enable-pthread --enable-python --disable-jpeg |
A description of what these options are for:
...
Available options
--help
option to configure can be used to see what other options are possible, also see the grib_api website for more detailed documentation.
...
BOTH | The ecCodes library can be built with both 'shared' and 'static' libraries for linking, by default only shared libraries are built. Note some IBM users may experience problems if shared libraries are built. |
Available options
To get additional help on the available options run the command:
Code Block |
---|
cmake -LH eccodes-2.9.0-Source |
Info |
---|
This command will cause cmake to run its system discovery if this is the first time the command has been used. This may take time to complete. |
Configuring using autotools
...
Shared and static libraries
...