The Copernicus Climate Change Service API (https://cds.climate.copernicus.eu/) is a platform for the distribution of observations of the earth system funded by the European Union. All downloads are for free.
We downloaded ERA5 data for a spatial subset. The description and metadata can be found here: https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels?tab=overview
Lately, the discharge datasets were published too. You can find the historical, i.e. reanalysis dataset here: https://cds.climate.copernicus.eu/cdsapp#!/dataset/efas-historical?tab=overview. The current forecast runs since 2018 are available here: https://cds.climate.copernicus.eu/cdsapp#!/dataset/efas-forecast?tab=overview.
There is a python API that allows you to download the datasets in a systematic manner. The code is hosted at https://pypi.org/project/cdsapi/.
!pip install cdsapi
Requirement already satisfied: cdsapi in /home/opt/anaconda3/lib/python3.7/site-packages (0.1.4)
Requirement already satisfied: requests>=2.5.0 in /home/opt/anaconda3/lib/python3.7/site-packages (from cdsapi) (2.21.0)
Requirement already satisfied: certifi>=2017.4.17 in /home/opt/anaconda3/lib/python3.7/site-packages (from requests>=2.5.0->cdsapi) (2019.3.9)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /home/opt/anaconda3/lib/python3.7/site-packages (from requests>=2.5.0->cdsapi) (3.0.4)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /home/opt/anaconda3/lib/python3.7/site-packages (from requests>=2.5.0->cdsapi) (1.24.2)
Requirement already satisfied: idna<2.9,>=2.5 in /home/opt/anaconda3/lib/python3.7/site-packages (from requests>=2.5.0->cdsapi) (2.8)
^C
ERROR: Operation cancelled by user
UID = 'UID'
API_key = 'API key'
~/.cdsapirc
in the home directory of your user¶import os
with open(os.path.join(os.path.expanduser('~'), '.cdsapirc2'), 'w') as f:
f.write('url: https://cds.climate.copernicus.eu/api/v2\n')
f.write(f'key: {UID}:{API_key}')
You will be asked to agree to the terms of use from the copernicus climate data store for your first download.
# Import cdsapi and create a Client instance
import cdsapi
c = cdsapi.Client()
# More complex request
c.retrieve("reanalysis-era5-pressure-levels", {
"product_type": "reanalysis",
"format": "netcdf",
"area": "52.00/2.00/40.00/20.00", # N/W/S/E
"variable": "geopotential",
"pressure_level": "500",
"year": "2017",
"month": "01",
"day": "12",
"time": "00"
}, "example_era5_geopot_700.nc")
2019-05-22 18:12:33,877 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-pressure-levels 2019-05-22 18:12:34,146 INFO Request is queued