Skip to content

Download daily (hourly) ERA5-Land weather data #3

@ezwelty

Description

@ezwelty

@peter-shaw-benson et al.

In case this is helpful, here are some demo scripts for downloading ERA5-Land temperature data at higher temporal resolution.

Note: I suspect that it might actually be faster to retrieve daily data via Google Earth Engine, but I didn't experiment with this approach.

Download daily mean, min, max, or mid via the daily statistics calculator. Results in a 800 MB NetCDF file for each month (for global, full-resolution coverage).

import cdsapi
import requests

c = cdsapi.Client(timeout=300)
year = '2023'
month = '01'
response = c.service(
  'tool.toolbox.orchestrator.workflow',
  params={
    'realm': 'user-apps',
    'project': 'app-c3s-daily-era5-statistics',
    'version': 'master',
    'kwargs': {
      'dataset': 'reanalysis-era5-land',
      'product_type': 'reanalysis',
      'variable': '2m_temperature',
      'statistic': 'daily_mean',
      'year': year,
      'month': month,
      'time_zone': 'UTC+00:0',
      'frequency': '1-hourly',
      'grid': '0.1/0.1',
      'area': {'lat': [-90, 90], 'lon': [-180, 180]} 
    },
    'workflow_name': 'application'
  }
)
url = response[0]['location']
path = f'{year}_{month}.nc'
stream = requests.get(url, stream=True)
print(f'Writing data to {path}')
with open(path, 'wb') as file:
  for chunk in stream.iter_content(chunk_size=1024):
    file.write(chunk)

Download hourly via the original dataset. Results in a 3.6 GB GRIB or NetCDF file for each month (for global, full-resolution coverage).

import cdsapi

c = cdsapi.Client()
year = '2023'
month = '01'
result = c.retrieve(
  'reanalysis-era5-land',
  {
    'variable': '2m_temperature',
    'year': year,
    'month': month,
    'day': [
      '01', '02', '03',
      '04', '05', '06',
      '07', '08', '09',
      '10', '11', '12',
      '13', '14', '15',
      '16', '17', '18',
      '19', '20', '21',
      '22', '23', '24',
      '25', '26', '27',
      '28', '29', '30',
      '31',
    ],
    'time': [
      '00:00', '01:00', '02:00',
      '03:00', '04:00', '05:00',
      '06:00', '07:00', '08:00',
      '09:00', '10:00', '11:00',
      '12:00', '13:00', '14:00',
      '15:00', '16:00', '17:00',
      '18:00', '19:00', '20:00',
      '21:00', '22:00', '23:00',
  ],
    'format': 'grib',
  },
  f'{year}_{month}.grib'
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions