You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in UTC+8, so this morning at 9:00 when I use the following code to get the latest ecmwf forecast run,
from ecmwf.opendata import Client
latest_time =Client().latest(type='fc'))
I get a wrong message:
Cannot establish latest date for {'date': ['2024-08-01 18:00:00'], 'model': ['ifs'], 'resol': ['0p25'], 'stream': ['oper'], 'type': ['fc'], 'step': ['0'], '_url': ['https://data.ecmwf.int/forecasts']}
I take a look at the client.py and full_date function in date.py, I think the reason comes from the search only end at the last UTC 18z instead of the last UTC 12z. Why not search to the yeasterday UTC 12z, it always pops out when the url get a positive response, so add another time for search won't do harm? the ECMWF forecast comes out at UTC 7:55,13:12,19:55,1:12 for 00/16/12/18.
Maybe change the client.py line to stop = date - datetime.timedelta(days=1, hours=12) or date>=stop ?
def latest(self, request=None, **kwargs):
if request is None:
params = dict(**kwargs)
else:
params = dict(**request)
if "time" not in params:
delta = datetime.timedelta(hours=6)
else:
delta = datetime.timedelta(days=1)
date = full_date(0, params.get("time", 18))
stop = date - datetime.timedelta(days=1, hours=6)
while date > stop:
result = self._get_urls(
request=None,
use_index=False,
date=date,
**params,
)
codes = [
robust(self.session.head)(url, verify=self.verify).status_code
for url in result.urls
]
if len(codes) > 0 and all(c == 200 for c in codes):
return date
date -= delta
The text was updated successfully, but these errors were encountered:
I'm in UTC+8, so this morning at 9:00 when I use the following code to get the latest ecmwf forecast run,
I get a wrong message:
I take a look at the client.py and full_date function in date.py, I think the reason comes from the search only end at the last UTC 18z instead of the last UTC 12z. Why not search to the yeasterday UTC 12z, it always pops out when the url get a positive response, so add another time for search won't do harm? the ECMWF forecast comes out at UTC 7:55,13:12,19:55,1:12 for 00/16/12/18.
Maybe change the client.py line to
stop = date - datetime.timedelta(days=1, hours=12)
ordate>=stop
?The text was updated successfully, but these errors were encountered: