CEMS-Flood data comes primarily in GRIB2 format. (Check Data Structure and Formats for more information)
To read GRIB files we encourage using Python 'xarray' and 'cfgrib' packages.
This guideline provides instructions about how to install required libraries (assuming you are working on a Linux OS) and documents the datasets' specific configurations that must be set when reading GRIBs.
Set up Python environment, tools and libraries installation
First of all install Conda, a Python package and environments manager.
Then open a terminal and type:
# create a local virtual environment, you can call it as you wish, here 'myenv' is used. conda create -n myenv python=3.8 # add repository channel conda config --add channels conda-forge # activate the local environment. conda activate myenv # install the required packages conda install -c conda-forge/label/main xarray cfgrib eccodes netcdf4 # make sure you have installed eccodes version >= 2.23.0 python -c "import eccodes; print(eccodes.__version__)"
Provided that you have downloaded an EFAS or GloFAS GRIB file from CDS, start a python console (it is important that you have activated the local environment) and type:
Dataset's specific cfgrib configurations
The different GRIB data structures of the EFAS and GloFAS datasets may require some additional configurations to be set in the backend_kwargs argument of the xarray.open_dataset function.
Read GRIB historical datasets:
CEMS-Floods offers two historical datasets: GloFAS and EFAS historical.
Read GRIB file that has multiple product types:
There are 5 datasets that can have more than one product type in a GRIB file, depending whether you decide to request more than one product type in a single request. These datasets and corresponding product types are:
- EFAS forecast: "control reforecast", "ensemble perturbed forecasts", "high resolution forecast"
- EFAS reforecast: "control reforecast", "ensemble perturbed reforecasts"
- GloFAS historical: "consolidated", "intermediate"
- GloFAS forecast: "control reforecast", "ensemble perturbed forecasts"
- GloFAS reforecast: "control reforecast", "ensemble perturbed reforecasts"
In order to read them you need to specify which product type you are reading using the backend_kwargs: