...
Section | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
NCAR command language (NCL)
...
CDO supports GRIB-2 but needs either the grib_api or ecCodes library from ECMWF to be included. This is necessary in order to work correctly with OpenIFS model output.
Code Block | ||||
---|---|---|---|---|
| ||||
cdo --version Climate Data Operators version 1.79.26 (http://mpimet.mpg.de/cdo) ........... CDI library version Libraries: HDF5/1.710.4 proj/5.2 of Aug 10 2016 09:22:26 CGRIBEXxml2/2.9.4 Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5 CDI library version : 1.79.56 ofcgribex Junlibrary version 3 2016 14:44:00 GRIB_API: 1.9.2 ecCodes library version : 12.1512.05 NetCDF library version : 4.46.12 of AugFeb 14 3 2016 11:10:49 $2019 10:13:27 $ hdf5 library version : 1.10.4 threadsafe exse library version : 1.4.1 FILE library version : 1.8.3 ......... |
If you find the CDO commands below do not work, you can either build CDO yourself, making sure a recent version of grib_api or ecCodes is used, or you can use the workaround below.
...
Info |
---|
If you have files with a mix of GRIB-1 and GRIB-2, then either split the file first or compile cdo with "--disable-cgribex --with-grib_apieccodes=yes" If variable names are lost, add the "-t ecmwf" option. |
...
Another way to split the file would be using the grib_copy command from the ecCodes (or grib_api) software as shown above:
Code Block |
---|
grib_copy ICMSHg4a4+000000.grb ICMSHg4a4+000000_[typeOfLevel].grb |
...
There are various commands for inspecting the contents of a GRIB file. The GRIB_API installation as part of ecCodes software installation required for OpenIFS has useful commands like grib_ls
and grib_dump
.
...
Note |
---|
cdo commands can be combined into a single command for greater efficiency. |
Using EMOSLIB to interpolate to regular grid
...
EMOSLIB also provides two command-line tools for using interpolation. Assuming a recent version of the EMOS library, there are two tools that can be used.
In the 'bin'
directory there is a command 'emos_tool'
which can be used as:
Code Block | ||
---|---|---|
| ||
emos_tool --regular=256 [--area="40/-10/31/20"] |
...
in.grib out.grib |
The grid specified for the --regular
option follows the grid naming convention for EMOSLIB here: Reduced Gaussian Grids.
Another command can be found in the 'tools'
directory. This allows the interpolation function to be specified and is more flexible:tools/int example
Code Block |
---|
tools/int --INTOUT:gridname=F256 --INTOUT:area="40/-10/31/20" --input=1.grib --output=2.grib --intf2 |
...
Here 'F256' means 'full-grid' not reduced, and --intf2
is the EMOSLIB interpolation function to be used.
Possible problems and solutions
...
cdo -R option does not work with GRIB-2 fields to convert to regular grid
...
However, if this does not work for any reason, a workaround is to temporarily change the edition number to 1 of the GRIB file. Use the grib_set
command (from ecCodes or grib_api) to change the GRIB edition number for all messages:
...
Code Block |
---|
cdo vct in.grb > pv.txt |
Parameter names are lost for GRIB-1 fields
...
A workaround is to use the -t ecmwf
option. The -t option
tells CDO to use the predefined ECMWF parameter tables (see CDO documentation for more details).
Code Block |
---|
cdo -t ecmwf -f nc copy mygrib1.grb mygrib1.nc |
Warning |
---|
Do not use this option for GRIB-2 fields. It sets the GRIB table default to be specific to the GRIB-1 ECMWF tables. If problems persist, we recommend using grib_to_netcdf to convert to netCDF. |
Acknowledgements
Thanks to Paul Dando of User Support for help with the contents of this page.
...
This will make CDO use ECMWF parameter table 128 for the definitions of variables but 128 is only for GRIB 1. This will work for the surface fields which are encoded by IFS as GRIB 1, but not for the multi-level fields which are encoded in GRIB 2. Variable names become 'unknown' if -t ecmwf is used with the multi-level fields. It is best to omit it completely, even for surface fields, and only use it for GRIB 1 data if you get missing variable names after CDO has converted the data (see CDO documentation for more details).
Code Block |
---|
cdo -t ecmwf -f nc copy mygrib1.grb mygrib1.nc |
Warning |
---|
Do not use this option for GRIB-2 fields. It sets the GRIB table default to be specific to the GRIB-1 ECMWF tables. If problems persist, we recommend using grib_to_netcdf to convert to netCDF. |
Acknowledgements
Thanks to Paul Dando of User Support for help with the contents of this page.
HTML Comment | ||
---|---|---|
| ||
The excerpt below includes a Google analytics tracker, do not remove! |
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
...