File size: 593 Bytes
536c6a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import cdsapi

def download_era5(date: str, outfile: str):
    c = cdsapi.Client()
    c.retrieve(
        'reanalysis-era5-single-levels',
        {
            'product_type': 'reanalysis',
            'variable': ['2m_temperature', 'mean_sea_level_pressure', '10m_u_component_of_wind', '10m_v_component_of_wind'],
            'year': date[:4],
            'month': date[5:7],
            'day': date[8:10],
            'time': ['00:00', '06:00', '12:00', '18:00'],
            'area': [35, 65, 5, 95],  # North, West, South, East
            'format': 'netcdf',
        },
        outfile)