From 5830d4acc9791d39a12a5cf69c6fecc6962963ee Mon Sep 17 00:00:00 2001 From: Raoul Linnenbank <58594297+rflinnenbank@users.noreply.github.com> Date: Tue, 31 Jan 2023 11:18:23 +0100 Subject: [PATCH] Release v2.36 (#95) FIXED: - Issues with ERA5 selection (time filtering did not work as intended) - Issues with Arome selection (location selection did not work as intended due to the floating point fix for ERA5) --- .../routers/weather/repository/repository.py | 2 +- .../routers/weather/sources/cds/models/era5sl.py | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/weather_provider_api/routers/weather/repository/repository.py b/weather_provider_api/routers/weather/repository/repository.py index 5903219..6c9a544 100644 --- a/weather_provider_api/routers/weather/repository/repository.py +++ b/weather_provider_api/routers/weather/repository/repository.py @@ -324,7 +324,7 @@ def _filter_dataset_by_coordinates( ds_single_coord.lat == coordinate.get_WGS84()[0], drop=True ) ds_single_coord = ds_single_coord.where( - ds_single_coord.lon.round(2) == coordinate.get_WGS84()[1], drop=True + ds_single_coord.lon.round(3) == coordinate.get_WGS84()[1], drop=True ) ds_single_coord = ds_single_coord.unstack("coord") # Then append this to a clean list diff --git a/weather_provider_api/routers/weather/sources/cds/models/era5sl.py b/weather_provider_api/routers/weather/sources/cds/models/era5sl.py index bc275e4..5ea869e 100644 --- a/weather_provider_api/routers/weather/sources/cds/models/era5sl.py +++ b/weather_provider_api/routers/weather/sources/cds/models/era5sl.py @@ -168,11 +168,8 @@ def _fill_dataset_with_data( """ # Gather a dataset with the proper period and coordinates ds = self.repository.gather_period(begin, end, era5sl_coordinates) - ds = ds.where( - np.datetime64(begin) < ds.time - ).where( - ds.time < np.datetime64(end) - ) + + ds = ds.sel(time=slice(np.datetime64(begin), np.datetime64(end))) # Drop excess weather factors ds = ds.drop_vars(self._get_list_of_factors_to_drop(validated_factors))