Skip to content

Commit a36ac15

Browse files
authored
2025-05-08: Temporary Fix for changes in how ECMWF handles ERA5 and r… (#150)
Upcoming version 2.75 should fix this properly and restore sea based values.
1 parent 6f9162c commit a36ac15

File tree

6 files changed

+756
-593
lines changed

6 files changed

+756
-593
lines changed

poetry.lock

Lines changed: 748 additions & 585 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "weather_provider_api"
3-
version = "2.71.0"
3+
version = "2.72.0"
44
description = "Weather Provider Libraries and API"
55
authors = ["Verbindingsteam", "Raoul Linnenbank <[email protected]>"]
66
license = "MPL-2.0"

tests/test_knmi_daggegevens.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
@pytest.fixture()
2222
def start():
23-
return datetime(year=2018, month=1, day=1)
23+
return datetime(year=2019, month=1, day=1)
2424

2525

2626
@pytest.fixture()
2727
def end():
28-
return datetime(year=2018, month=1, day=31)
28+
return datetime(year=2019, month=1, day=31)
2929

3030

3131
@pytest.mark.parametrize("inseason", inseason_options)
@@ -38,7 +38,7 @@ def test_retrieve_weather(mock_coordinates, start, end, inseason):
3838
print(ds["time"])
3939
assert ds is not None
4040
assert "TN" in ds
41-
assert len(ds["TN"]) == 31
41+
assert len(ds["TN"]) == 31 # TODO: Evaluate changes in Daggegevens to handle end date differently
4242
assert isinstance(ds, xr.Dataset)
4343

4444

weather_provider_api/routers/weather/sources/cds/factors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
with open(file_to_use_era5sl, "r") as _f:
1919
era5sl_factors: dict = json.load(_f)
20-
for factor in ["mwd", "mwp", "swh"]:
21-
era5sl_factors.pop(factor)
20+
# for factor in ["mwd", "mwp", "swh"]:
21+
# era5sl_factors.pop(factor)
2222

2323

2424
with open(file_to_use_era5land, "r") as _f:

weather_provider_api/routers/weather/sources/cds/models/era5sl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self):
6060

6161
# Human output conversion:
6262
self.to_human = copy.deepcopy(self.to_si)
63-
self.to_human["sea_surface_temperature"]["convert"] = self.kelvin_to_celsius
63+
# self.to_human["sea_surface_temperature"]["convert"] = self.kelvin_to_celsius
6464
self.to_human["soil_temperature_level_1"]["convert"] = self.kelvin_to_celsius
6565
self.to_human["soil_temperature_level_2"]["convert"] = self.kelvin_to_celsius
6666
self.to_human["soil_temperature_level_3"]["convert"] = self.kelvin_to_celsius

weather_provider_api/routers/weather/sources/knmi/models/daggegevens.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def get_weather(
200200
An Xarray Dataset containing the weather data for the requested period, locations and factors.
201201
"""
202202
# Test and account for invalid datetime timeframes or input
203-
begin, end = validate_begin_and_end(begin, end, None, datetime.utcnow() - relativedelta(days=1))
203+
begin, end = validate_begin_and_end(begin, end, None, datetime.now(UTC) - relativedelta(days=1))
204204
# Get a list of the relevant STNs and choose the closest STN for each coordinate
205205
station_id, stns, _ = find_closest_stn_list(stations_history, coords)
206206

0 commit comments

Comments
 (0)