Versions Compared

Key

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

Model output

Excerpt

The instructions in this article show how to convert OpenIFS GRIB output to netCDF for use in other analysis and visualisation software.

The OpenIFS model outputs files in GRIB format. These files are a mix of GRIB 1 & GRIB 2 format messages. They also contain multiple vertical coordinates: pressure levels, sub-surface levels etc as well as fields on reduced Gaussian grids which causes a problem with some 3rd party tools as the same GRIB variable code is used for each axis. The instructions below show how to work around this.

The ICMGG files contain all the gridpoint fields. The ICMSH files are the spherical harmonics of the wind fields, pressure and temperature.

Column
width320px
Info
The MetView application is available for analysis and visualisation of OpenIFS output.
Please see 'Using MetView with OpenIFS' for more details.
Panel
bgColorwhite
titleBGColorlightlightgrey
titleOn this page

Table of Contents
indent2px
stylesquare

Grib-api tools

...

grib_to_netcdf

This command

...

will convert one or more grib files to netCDF is available with the ECMWF grib_api software (versions above 1.11.0 are recommended. It is not available in versions less than 1.10.0).

...

For more details please see: grib_to_netcdf description.

...

width320px

 

 

Info
The MetView application is available for analysis and visualisation of OpenIFS output.
Please see 'Using MetView with OpenIFS' for more details.

grib_to_netcdf only works correctly when a single level coordinate is present in the grib file. Often the model grib output files have fields on multiple level types (ie. hybrid model levels and pressure levels).

Code Block
titleSplit grib file into separate level types
grib_copy ICMGGftkm+001440 ICMGG_[typeOfLevel].grb

In this example, the file ICMGGftkm+001440 contains a number of different model level types. The special square brack "[ ]" syntax is recognised by grib_copy and can contain any valid grib key.

This command will copy the original file separating the level types into their own file: ICMGG_hybrid.grb, ICMGG_isobaricInhPA.grb, ICMGG_surface ...etc. The same square bracket syntax is also understood by the grib_filter command.

grib_to_netcdf can then be used on the individual files:

Code Block
titleConvert grib file to netCDF
grib_to_netcdf ICMGG_hybrid.grb -o ICMGG_hybrid.nc

To convert from vorticity and divergence to winds, please see CDO instructions below.

...

bgColorwhite
titleBGColorlightlightgrey
titleOn this page

...

CDO commands

These instructions assume the use of a recent version of Climate Data Operators (CDO) (available from Max-Planck-Institut, Germany).

CDO supports GRIB2 but needs the GRIB_API library from ECMWF in order to work correctly.

If you find the CDO commands below do not work, you can either build CDO yourself, making sure a recent version of grib_api is used, or you can use a workaround below. Use the grib_set command (from the grib_api installation) to change the GRIB edition number for all messages. 

Code Block
titleWorkaround if CDO does not understand GRIB2
grib_set -s editionNumber=1 <input grib2 file> <output grib1 file>

...