Skip to content

Commit

Permalink
clarfied function download_era5
Browse files Browse the repository at this point in the history
  • Loading branch information
OpheliaMiralles committed Jan 11, 2022
1 parent 64d8db4 commit b32af8b
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/data/download_ERA5.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def _download_ERA5_data(datapath: Path, file_suffix: str, start_date, end_date,
'12:00', '13:00', '14:00', '15:00', '16:00', '17:00',
'18:00', '19:00', '20:00', '21:00', '22:00', '23:00',
],
'area': area
'area': list(area)
}
request_args.update(args)
for date in pd.date_range(start_date, end_date):
Expand All @@ -30,24 +30,28 @@ def _download_ERA5_data(datapath: Path, file_suffix: str, start_date, end_date,
c.retrieve(data_name, date_request, str(dest))


def download_ERA5_surface(datapath, start_date=date(2016, 1, 10), end_date=date(2020, 12, 31), area=[48.2, 5.2, 45.4, 11.02]):
_download_ERA5_data(datapath, 'era5_surface_hourly', start_date, end_date, 'reanalysis-era5-single-levels',
def download_ERA5_surface(datapath, start_date, end_date, area):
_download_ERA5_data(datapath, 'era5_surface_hourly', start_date, end_date, area, 'reanalysis-era5-single-levels',
{'variable': [
'100m_u_component_of_wind', '100m_v_component_of_wind', '10m_u_component_of_wind',
'10m_v_component_of_wind', '2m_dewpoint_temperature', '2m_temperature',
'boundary_layer_height', 'surface_pressure', 'surface_sensible_heat_flux',
'total_precipitation', 'forecast_surface_roughness',
]}, area=area)
]})


def download_ERA5_pressure_500(datapath, start_date=date(2016, 1, 10), end_date=date(2020, 12, 31), area=[48.2, 5.2, 45.4, 11.02]):
_download_ERA5_data(datapath, 'era5_z500_hourly', start_date, end_date, 'reanalysis-era5-pressure-levels',
def download_ERA5_pressure_500(datapath, start_date, end_date, area):
_download_ERA5_data(datapath, 'era5_z500_hourly', start_date, end_date, area, 'reanalysis-era5-pressure-levels',
{'pressure_level': '500', 'variable': [
'divergence', 'geopotential',
'vertical_velocity', 'vorticity',
]}, area=area)
]})


def download_ERA5(datapath, start_date=date(2016, 1, 10), end_date=date(2020, 12, 31), area=[48.2, 5.2, 45.4, 11.02]):
download_ERA5_surface(datapath, start_date, end_date, area=area)
download_ERA5_pressure_500(datapath, start_date, end_date, area=area)
def download_ERA5(datapath, start_date=date(2016, 1, 10), end_date=date(2020, 12, 31), latitude_range=(45.4, 48.2), longitude_range=(5.2, 11.02)):
area = (latitude_range[1], longitude_range[0], latitude_range[0], longitude_range[1])
download_ERA5_surface(datapath, start_date, end_date, area)
download_ERA5_pressure_500(datapath, start_date, end_date, area)

if __name__ == '__main__':
download_ERA5('./data')

0 comments on commit b32af8b

Please sign in to comment.