Downloading ERA5 data

Install Climate Data Store API on linux:

I’ve installed mine on the mccdata server in UCD.

The great thing about using a script, instead of downloading directly from the CDS, is that it gives you more control. The ERA5 CDS page for ERA5 monthly averaged data on single levels from 1979 to present doesn’t let you change the grid or domain. I wanted data at a lower resolution, and only for 20-90N. I was able to specify this in my retrieval script:

import cdsapi

c = cdsapi.Client()

c.retrieve(
    'reanalysis-era5-single-levels-monthly-means',
    {
        'product_type':'monthly_averaged_reanalysis',
        'variable':'mean_sea_level_pressure',
        'year':[
            '1979','1980','1981',
            '1982','1983','1984',
            '1985','1986','1987',
            '1988','1989','1990',
            '1991','1992','1993',
            '1994','1995','1996',
            '1997','1998','1999',
            '2000','2001','2002',
            '2003','2004','2005',
            '2006','2007','2008',
            '2009','2010','2011',
            '2012','2013','2014',
            '2015','2016','2017',
            '2018','2019'
        ],
        'month':[
            '01','02','03',
            '04','05','06',
            '07','08','09',
            '10','11','12'
        ],
        'time':'00:00',
        'area':[90, -180, 20, 180], # 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
        'format':'netcdf'
    },
    'ERA5_mslp.nc')

Then I ran this from the command line:

python ERA5.mslp.CDS

And this quickly retrieved the required data!


Posted

in

by

Tags: