How to set my python script to download data from Dec.2021 to Feb.2022

Hello everyone

I’m trying to use API to download era5 hourly data on pressure level. I need 10 variables on all pressure levels every 6 hours from Dec.2021 to Feb.2022. How can I set my ‘time’ part of the python script?

1 Like

If it’s the same times all the time, something like this:

import datetime as dt

times = [dt.time(x).strftime(‘%H:00’) for x in range(0, 24, 6)]

or

times = [f’{str(x).zfill(2)}:00’ for x in range(0, 24, 6)]

Since it’s so few times, you could just write it manually…

times = [‘00:00’, ‘06:00’, ‘12:00’, ‘18:00’]

This would be written in your request dictionary as:

request={
     ‘time’: times,
}

or

request={
     ‘time’: [‘00:00’, ‘06:00’, ‘12:00’, ‘18:00’],
}