Retrieving data across a year boundary as a single file?
Opened this issue · 2 comments
Is it possible to retrieve data across a year boundary as a single file?
For example, a single retrieval that results in a file containing hourly data from Dec 25, 2021 to Jan 5, 2022?
I think the closest you can get is something like this:
era5cli hourly --variables 2m_temperature --startyear 2010 --endyear 2011 --months 1 12 --days 1 2 3 4 5 25 26 27 28 29 30 31 --merge
The --merge
option can be used to specify that outputs should be combined in a single file. However, it is currently not possible to specify different days for different months.
Being able to specify a date range would be a nice feature request. Not sure if/when we'll have time for it, but code contributions are of course always welcome.
Updating the documentation is high on our list, by the way
Thanks @Peter9192! I did eventually figure out how to do this using the cdsapi. This works:
import cdsapi
c = cdsapi.Client()
def get_chunk(start_date, stop_date):
local_ncfile = f'era5land_{start_date}.nc'
c.retrieve(
'reanalysis-era5-land',
{
'variable': var_list,
'area' : f'{north}/{west}/{south}/{east}',
'date' : f'{start_date}/{stop_date}',
'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':'netcdf'
},
local_ncfile)
# CONUS
north = 49.3457868
west = -124.7844079
east = -66.9513812
south = 24.7433195
get_chunk('2020-12-28', '2021-01-03')