diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 6c0ceedc..7a2c785d 100755 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -28,6 +28,7 @@ Upcoming Release * Fix `atlite.Cutout()` to be able to handle the `bounds` argument to be a `DataFrame` in accordance to the docstring (https://github.com/PyPSA/atlite/pull/445). * Raise a `FileNotFoundError` if the `temp_dir` explicitly specified for cutout preparation does not exist instead of failing with an obfuscated error message (https://github.com/PyPSA/atlite/pull/445). * Addressed `rasterio` DeprecationWarning on `crs.is_valid`. +* Fix calls to `cdsapi` for ERA5 to be compliant with current API syntax (https://github.com/PyPSA/atlite/pull/414 and https://github.com/PyPSA/atlite/pull/454). `v0.4.1 `__ (12th May 2025) ======================================================================================= diff --git a/atlite/datasets/era5.py b/atlite/datasets/era5.py index c143ff32..f2f957a7 100644 --- a/atlite/datasets/era5.py +++ b/atlite/datasets/era5.py @@ -290,9 +290,9 @@ def retrieval_times(coords, static=False, monthly_requests=False): time = coords["time"].to_index() if static: return { - "year": str(time[0].year), - "month": str(time[0].month), - "day": str(time[0].day), + "year": [time[0].strftime("%Y")], + "month": [time[0].strftime("%m")], + "day": [time[0].strftime("%d")], "time": time[0].strftime("%H:00"), } @@ -303,18 +303,18 @@ def retrieval_times(coords, static=False, monthly_requests=False): if monthly_requests: for month in t.month.unique(): query = { - "year": str(year), - "month": str(month), - "day": list(t[t.month == month].day.unique()), - "time": [f"{h:02d}:00" for h in t[t.month == month].hour.unique()], + "year": [str(year)], + "month": [t[t.month == month][0].strftime("%m")], + "day": list(t[t.month == month].strftime("%d").unique()), + "time": list(t[t.month == month].strftime("%H:00").unique()), } times.append(query) else: query = { - "year": str(year), - "month": list(t.month.unique()), - "day": list(t.day.unique()), - "time": [f"{h:02d}:00" for h in t.hour.unique()], + "year": [str(year)], + "month": list(t.strftime("%m").unique()), + "day": list(t.strftime("%d").unique()), + "time": list(t.strftime("%H:00").unique()), } times.append(query) return times