Versions Compared

Key

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

...

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 . Unfortunately these features can cause problems with 3rd party GRIB softwarewhich 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.

...

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

CDO does not understand GRIB2 messagesCDO supports GRIB2 but needs the GRIB_API library from ECMWF in order to succeed. If you find the CDO command below do not work, you can either build CDO yourself, making sure grib_api is used, or you can use a workaround. In order to work around this, use the grib_set command (from the grib_api installation) to change the GRIB edition number for all messages. Note this will only work if you are using less than 128 model levels and it does not actually convert the message to GRIB1.

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

Then CDO can be used to interpolate from the reduced Gaussian grid to a regular Gaussian grid for plotting:

Code Block
titleConvert to regular lat-lon Gaussian grid
 cdo -R copy <input grib> <output grib>

Before converting to netCDF separate the different vertical axes:

Code Block
cdo splitzaxis <input grib> <output grib>

Then finally convert the resulting output files to netcdf:

Code Block
cdo -f nc copy <input grib1>grib> <output netcdf>

The following script shows how to loop over several output files using the steps above to convert to netCDF:

Code Block
for i in 000 024 048 072
do

grib_set -s editionNumber=1 ICMGGfpp4+000${i} ICMGGfpp4+000${i}.grb
cdo -R copy ICMGGfpp4+000${i}.grb ICMGGfpp4+000${i}_R.grb
cdo splitzaxis ICMGGfpp4+000${i}_R.grb ICMGGfpp4+000${i}
cdo -f nc copy ICMGGfpp4+000${i}01.grb ICMGGfpp4+000${i}_PLGG.nc
cdo -f nc copy ICMGGfpp4+000${i}02.grb ICMGGfpp4+000${i}_MLGG.nc


grib_set -s editionNumber=1 ICMSHfpp4+000${i} ICMSHfpp4+000${i}.grb
cdo splitzaxis ICMSHfpp4+000${i}.grb ICMSHfpp4+000${i}
cdo sp2gpl ICMSHfpp4+000${i}01.grb ICMSHfpp4+000${i}01_GP.grb
cdo sp2gpl ICMSHfpp4+000${i}03.grb ICMSHfpp4+000${i}03_GP.grb
cdo sp2gpl ICMSHfpp4+000${i}04.grb ICMSHfpp4+000${i}04_GP.grb
cdo -f nc copy ICMSHfpp4+000${i}03_GP.grb ICMSHfpp4+000${i}_ML.nc
cdo -f nc copy ICMSHfpp4+000${i}01_GP.grb ICMSHfpp4+000${i}_PL.nc
cdo -f nc copy ICMSHfpp4+000${i}04_GP.grb ICMSHfpp4+000${i}_surf.nc
done

Note the spherical harmonic files are also converted but the extra command using the sp2gpl operator is first used to convert the variables from spherical harmonics to gridpoint.