Table of Contents |
---|
Info |
---|
Before downloading data check if your processing software supports the GRIB and/or NetCDF formats. If your software supports both, use GRIB as first choice. If your software supports only NetCDF or if you run into problems with GRIB, use the NetCDF format. |
Introduction
The GRIB file format is designed for storing and distributing weather data. GRIB files are widely used in meteorological applications (Wikipedia article, including a list of software to read GRIB files).
...
The ECMWF model (the Integrated Forecasting System, IFS) currently outputs model-level fields in GRIB2 while pressure and surface level outputs are produced in GRIB1. For example,ERA-Interim (a climate reanalysis dataset provided by ECMWF) is produced in the GRIB edition 1 format. The ERA-Interim data is then made available for download in its native GRIB format.
GRIB conversion to netCDF
In some cases, data is also available in NetCDF format as the result of the conversion of the GRIB file to NetCDF. Note that due to this conversion, not all the information in the GRIB file will be included in the NetCDF version, and his is particularly true for the GRIB file metadata. As a result, care should be taken when using these files. At this time, the NetCDF format is not formally supported by ECMWF.
How to read GRIB files
ECMWF provides and supports ecCodes. This software package has an Application Program Interface which makes ECMWF GRIB1 and GRIB2 files accessible from C, FORTRAN and Python programmes. ecCodes also provides a useful set of command line tools to give quick access to GRIB messages within the files.
...
More tools are listed in this Wikipedia article.
How to extract data from GRIB to text
This example shows how to extract data from a GRIB file to generic text using ecCodes.
...
- Get a computer running Linux
- On your Linux computer install ECMWF's ecCodes software
- Get some data in GRIB format (for example from the CAMS or C3S Service). For this use case, we assume the file contains forecast data, and surface data (ie. a single layer, no atmospheric layers above the surface)
Example 1: List data from GRIB
|
... giving this output:
|
dataDate and dataTime indicate the date/time we forecast from. validityDate and validityTime indicate the date/time we forecast for.
...
For further options please see the documentation of the ecCodes command line GRIB tools
Example 2: List data for closest point(s)
For a given coordinate, for example (lat=46.87 / lon=8.73), list data of the closest model point:
|
... giving this output:
|
For further options please see the documentation of the ecCodes command line GRIB tools
Tips
-F option to format values as decimals instead of scientific:
|
Redirect the output to a text file:
|
List only the first or last 10 lines of an output (aka pipe):
|
Related articles
Content by Label | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...