...
Build the basic CDS API request.
As described in on How to migrate from ECMWF Web API to CDS API, you can use the CDS web interface to help you build your CDS API download script. In the download form, make some selections, then click the button Show API request and you will be presented with the script.Expand title Basic CDS API script example to download temperature at a given pressure level, 1000 hPa is shown HERE. Code Block language text #!/usr/bin/env python import cdsapi c = cdsapi.Client() c.retrieve('reanalysis-era5-pressure-levels', { 'variable' : 'temperature', 'pressure_level': '1000', 'product_type' : 'reanalysis', 'year' : '2008', 'month' : '01', 'day' : '01', 'time' : '12:00', 'format' : 'netcdf' # Supported format: grib and netcdf. Default: grib }, 'test.nc')
- Refining your CDS API script for ERA5 data listed in CDS.
Currently the interactive CDS forms don't allow users to perform a regional sub-selection or an interpolation of the selected data. However, both actions can be performed using the following CDS API keywords:- For a geographical area subset, use key area.
For a different grid resolution, use key grid.
Please note that the ERA5 native grid in CDS is 0.25°x0.25° (atmosphere), 0.5°x0.5° (ocean waves), Mean, spread and members: 0.5°x0.5° (atmosphere), 1°x1° (ocean waves).
Below is a sample script for downloading temperature at a given pressure level, 1000 hPa. It also shows how to request for a geographical subset of the data.Expand title Show basic CDS API script including geographical subset Code Block language text #!/usr/bin/env python import cdsapi c = cdsapi.Client() c.retrieve('reanalysis-era5-pressure-levels', { 'variable' : 'temperature', 'pressure_level': '1000', 'product_type' : 'reanalysis', 'dateyear' : '2008-01-', 'month' : '01', 'day' : '01', 'area' : [60, -10, 50, 2], # North, West, South, East. Default: global 'grid' : [1.0, 1.0], # Latitude/longitude grid: east-west (longitude) and north-south resolution (latitude). Default: 0.25 x 0.25 'time' : '12:00', 'format' : 'netcdf' # Supported format: grib and netcdf. Default: grib }, 'test.nc')
...