From f2c28a104b1c114894240d8cda182e17716fd637 Mon Sep 17 00:00:00 2001 From: Raoul Linnenbank <58594297+rflinnenbank@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:33:10 +0100 Subject: [PATCH] Release 2.48 (#121) This update fixes an issue where AROME updates would improperly be cut off due to issues with indexation, resulting in only one prediction moment per daily file to prevail over all others. This update also includes the following: A small update to the Sigrid file and a small patch to utils, where in one file we still used logger.exception, rather than logger.error as we'd want to. --- pyproject.toml | 2 +- sigrid.yaml | 2 +- weather_provider_api/config/config.toml | 10 +++++----- .../weather/sources/knmi/client/arome_repository.py | 6 ++++-- .../routers/weather/sources/knmi/utils.py | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bbd69fc..aa46446 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "weather_provider_api" -version = "2.47.0" +version = "2.48.0" description = "Weather Provider Libraries and API" authors = ["Verbindingsteam", "Raoul Linnenbank <58594297+rflinnenbank@users.noreply.github.com>"] license = "MPL-2.0" diff --git a/sigrid.yaml b/sigrid.yaml index a470ee6..972dc14 100644 --- a/sigrid.yaml +++ b/sigrid.yaml @@ -4,7 +4,7 @@ exclude: - "/doc/.*" - "/LICENSES/.*" - "/img/.*" - - "/scripts/.*" + - "weather_provider_api/scripts/.*" - ".*/__init__.py" languages: - name: python diff --git a/weather_provider_api/config/config.toml b/weather_provider_api/config/config.toml index a1c033b..14c1299 100644 --- a/weather_provider_api/config/config.toml +++ b/weather_provider_api/config/config.toml @@ -7,7 +7,7 @@ description = """ styles. """ expiration_checking = true -expiration_date = "2024-04-01" +expiration_date = "2024-08-01" [maintainer] show_info = true @@ -31,9 +31,9 @@ cors_allowed_origins = ['*'] cors_allowed_origins_regex = [] [api_v1] -implementation = "2.1.0" -expiration_date = "2024-04-01" +implementation = "2.2.0" +expiration_date = "2024-08-01" [api_v2] -implementation = "2.1.0" -expiration_date = "2024-04-01" +implementation = "2.2.0" +expiration_date = "2024-08-01" diff --git a/weather_provider_api/routers/weather/sources/knmi/client/arome_repository.py b/weather_provider_api/routers/weather/sources/knmi/client/arome_repository.py index a60057c..a2a6773 100644 --- a/weather_provider_api/routers/weather/sources/knmi/client/arome_repository.py +++ b/weather_provider_api/routers/weather/sources/knmi/client/arome_repository.py @@ -304,7 +304,9 @@ def _process_grib_message_to_message_dataset( field_values = np.reshape(grib_message["values"], len(lats) * len(lons)) data_dict = {field_name: (["time", "coord"], [field_values])} - predicted_moment = prediction_moment + relativedelta(hours=predicted_hour) + predicted_moment = np.datetime64((prediction_moment + relativedelta(hours=predicted_hour))).astype( + "datetime64[ns]" + ) dataset_coords = { "time_of_prediction": [prediction_moment], @@ -359,7 +361,7 @@ def _fuse_hourly_netcdf4_files(self, download_folder: Path, prediction_moment: d if not fused_dataset: fused_dataset = prediction_file_dataset else: - fused_dataset = xr.merge([fused_dataset, prediction_file_dataset], compat="override") + fused_dataset = xr.merge([fused_dataset, prediction_file_dataset], compat="no_conflicts") filename_to_save_to = self.repository_folder.joinpath( f"{self.file_prefix}_{prediction_moment.year}{str(prediction_moment.month).zfill(2)}" diff --git a/weather_provider_api/routers/weather/sources/knmi/utils.py b/weather_provider_api/routers/weather/sources/knmi/utils.py index 8fdebe3..2423858 100644 --- a/weather_provider_api/routers/weather/sources/knmi/utils.py +++ b/weather_provider_api/routers/weather/sources/knmi/utils.py @@ -156,7 +156,7 @@ def _retrieve_observation_moment(html_body: str) -> datetime: ) return datetime.now() except Exception as e: - logger.exception( + logger.error( "An unknown exception occurred while retrieving the KNMI Waarnemingen datetime for use in the response." f" Using local datetime instead. Error: {e}" )