icenet-ai / icenet

The icenet library is a pip installable python package containing the commands and code you need to produce forecasts
MIT License
23 stars 7 forks source link

ERA5Downloader random issue. #299

Closed bnubald closed 1 day ago

bnubald commented 1 day ago

Description

Using the ERA5 downloader randomly does not update downloaded dataset with latest data.

Relates to latest changes for CDS API migration in Issue: #296, corresponding PR: #298 .

What I Did

Issue crops up when running the daily forecasting with the icenet-pipeline scripts for daily forecast generation.

./run_era5_forecast.sh atmos23 >logs/daily.`date +\%F`.log 2>&1

Solution

Pinned down issue to a typo in expver variable being omitted.

https://github.com/icenet-ai/icenet/blob/6f51b305205f9e4c1d697f32a00ea2dac9789bf7/icenet/data/interfaces/cds.py#L142

It was omitting expvar instead of expver.

The reason it worked during some tests was due to the unordered nature of Python set(), which caused following line to sometimes return the variable name we're trying to obtain instead of expver.

https://github.com/icenet-ai/icenet/blob/6f51b305205f9e4c1d697f32a00ea2dac9789bf7/icenet/data/interfaces/cds.py#L144

Should, also add a check to make sure that the set difference only returns one element. If there are multiple elements, its a clear sign of an unexpected result.

bnubald commented 1 day ago

Fixed by #300