-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client.latest can not establish latest date #11
Comments
I get the same error but only when the latest data is from the 18:00 run on the previous day. |
I think I understand what's going wrong and have a fix, although there may be better fixes available. Client.latest() works by setting a search start time to 18z on the current date, e.g. at 02:00 on 05/09 the start time would be 05/090 18z, a stop date which is 1 day 6 hours before the start time, e.g. 04/09 12z and a delta time of 6 hours (this is for the case when a specific run time isn't requested using the time parameter). It then loops back from start time whilst the loop time is greater than the stop time looking for a file that meets the search requirements. If you're looking for a file which only exists in the 00z and 12z runs, e.g. 144, then this will always fail when using latest() to identify whether the 18z run is available. The loop runs as follows at, say, 02:00 (the time you'd start checking for the 18z run data to become available): 05/09 18z - Run time is in the future so no files exist yet There is another error condition when the time parameter is specified. If you want to find the latest 18z run, the same loop setup for start and stop date, but the delta is set to one day. In this case the loop does this (for start date= 05/09 18z and stop date of 04/09 12z and delta=1day) 05/09 18z - Run time is in the future so no files exist yet A fix which resolves both of these issues is to change the line in the definition of latest() in client.py from
to
I believe that for any valid combination of execution date/time, run times, time parameter, etc, setting a delta of 2 days will always find a file that matches the search requirements rather than raising an error in some circumstances. |
Resolves ecmwf#11
Hello,
I've recently started to use ecmwf opendata and have a problem when I want to automate the download.
It says; "Cannot establish latest date for {'date': ['2022-07-07 18:00:00'], 'resol': ['0p4-beta'], 'stream': ['oper'], 'type': ['fc'], 'step': ['0'], 'url': ['https://data.ecmwf.int/forecasts']}"
---> 26 if client.latest().strftime("%Y-%m-%d%H") == date:
The text was updated successfully, but these errors were encountered: