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 |
---|
| Info |
---|
The MetView application is available for analysis and visualisation of OpenIFS output. Please see 'Using MetView with OpenIFS' for more details. |
Panel |
---|
bgColor | white |
---|
titleBGColor | lightlightgrey |
---|
title | On this page |
---|
| |
|
grib_to_netcdfThis 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. grib_to_netcdf only works correctly when a single level coordinate is present in the GRIB file. Often the model output files have fields on multiple level types (ie. hybrid model levels and pressure levels). Code Block |
---|
title | Split GRIB file into separate level types |
---|
| grib_copy ICMGGftkm+001440 ICMGG_[typeOfLevel].grb |
In this example, the GRIB model output 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 |
---|
title | Convert 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. |
Column |
---|
| Panel |
---|
bgColor | white |
---|
titleBGColor | lightlightgrey |
---|
title | On this page |
---|
| |
Info |
---|
The MetView application is available for analysis and visualisation of OpenIFS output. Please see 'Using MetView with OpenIFS' for more details. |
|
|
NCAR command language (NCL)
...
The following script shows how to loop over several output files using the steps above to convert to netCDF:. 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.
Code Block |
---|
title | Sample script to convert OpenIFS GRIB output to netCDF |
---|
|
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 -t ecmwf -f nc copy ICMGGfpp4+000${i}01.grb ICMGGfpp4+000${i}_PLGG.nc
cdo -t ecmwf -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 -t ecmwf -f nc copy ICMSHfpp4+000${i}03_GP.grb ICMSHfpp4+000${i}_ML.nc
cdo -t ecmwf -f nc copy ICMSHfpp4+000${i}01_GP.grb ICMSHfpp4+000${i}_PL.nc
cdo -t ecmwf -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.
...
HTML |
---|
<script type="text/javascript" src="https://software.ecmwf.int/issues/s/en_UKet2vtj/787/12/1.2.5/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=5fd84ec6"></script>
|
...