Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Build a basic CDS API request.

    • You can use the CDS web interface to help you build your CDS API download script.

    • In the D ownload data  tab, make some selections, then click the button Show API request at the bottom left and you will be presented with the script.

    • Copy and paste this to your preferred text editor.

      Expand
      titleBasic CDS API script example (for ERA5 1979-present) to download temperature at a given pressure level, 1000 hPa is shown HERE.


      Code Block
      languagetext
      #!/usr/bin/env python
      
      import cdsapi
      
      c = cdsapi.Client()
      
      c.retrieve(
          'reanalysis-era5-pressure-levels',
          {
              'product_type': 'reanalysis',
              'variable': 'temperature',
              'pressure_level': '1000',
              'year': '2008',
              'month': '01',
              'day': '01',
              'time': '12:00',
              'format': 'netcdf',                 # Supported format: grib and netcdf. Default: grib
          },
          'download.nc')                          # Output file. Adapt as you wish.
      



  2. Refine your CDS API script for ERA5 data listed in CDS for optional post-processing.
    • For a different grid resolution, use the key 'grid'.
    • Please note that the ERA5 native grid of online 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). ERA5-Land: 0.1°x0.1°. So this will be returned by default.

    • Expand
      titleClick here for a sample script (for ERA5 1979-present) that downloads temperature at a given pressure level at 1000 hPa for a geographical subset of the data and specified grid


      Code Block
      languagetext
      #!/usr/bin/env python
      import cdsapi
      
      c = cdsapi.Client()
      
      c.retrieve(
          'reanalysis-era5-pressure-levels',
          {
              'product_type': 'reanalysis',
              'variable': 'temperature',
              'pressure_level': '1000',
              'year': '2008',
              'month': '01',
              'day': '01',
              'time': '12:00',
              'format': 'netcdf',                 # Supported format: grib and netcdf. Default: grib
              'area'          : [60, -10, 50, 2], # North, West, South, East.          Default: global
              'grid'          : [1.0, 1.0],       # Latitude/longitude grid.           Default: 0.25 x 0.25
          },
          'era5_temperature_sub_area.nc')         # Output file. Adapt as you wish.



To retrieve data efficiently using the CDS API please have a look at the efficiency tips section on CDS documentation.

Option B: Download ERA5 family data that is NOT listed in the CDS online catalogue - SLOW ACCESS

...