From 0453ead5fd4e87a0c4fb300e6bdfd1e3aae38388 Mon Sep 17 00:00:00 2001 From: konstntokas Date: Thu, 2 Jan 2025 10:17:30 +0100 Subject: [PATCH 1/3] xarray dependency forgotton in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 158a4ae11..f5fbf326a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ dependencies = [ "tabulate>=0.9", "tornado>=6.0", "urllib3>=1.26", - "xarray>=2022.6,<=2024.6", + "xarray>=2022.6", "zarr>=2.11" ] classifiers = [ From 9e21fe73ee77f52edc3be8867b17fe3b48af50f3 Mon Sep 17 00:00:00 2001 From: konstntokas Date: Thu, 2 Jan 2025 11:27:54 +0100 Subject: [PATCH 2/3] test adjusted --- test/core/resampling/test_temporal.py | 42 +++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/test/core/resampling/test_temporal.py b/test/core/resampling/test_temporal.py index 28170b619..fbc38fa88 100644 --- a/test/core/resampling/test_temporal.py +++ b/test/core/resampling/test_temporal.py @@ -92,12 +92,44 @@ def test_resample_in_time_min_max(self): self.assertEqual((1, 90, 180), schema.chunks) def test_resample_in_time_p90_dask(self): - # "percentile_

" can currently only be used with numpy rather than chunked dask arrays: + resampled_cube = resample_in_time(self.input_cube, "2W", "percentile_90") + self.assertIsNot(resampled_cube, self.input_cube) + self.assertIn('time', resampled_cube) + self.assertIn('temperature_p90', resampled_cube) + self.assertIn('precipitation_p90', resampled_cube) + self.assertEqual(('time',), resampled_cube.time.dims) + self.assertEqual(('time', 'lat', 'lon'), resampled_cube.temperature_p90.dims) + self.assertEqual(('time', 'lat', 'lon'), resampled_cube.precipitation_p90.dims) + self.assertEqual((6,), resampled_cube.time.shape) + self.assertEqual((6, 180, 360), resampled_cube.temperature_p90.shape) + self.assertEqual((6, 180, 360), resampled_cube.precipitation_p90.shape) + np.testing.assert_equal( + resampled_cube.time.values, + np.array([ + '2017-06-25T00:00:00Z', + '2017-07-09T00:00:00Z', + '2017-07-23T00:00:00Z', + '2017-08-06T00:00:00Z', + '2017-08-20T00:00:00Z', + '2017-09-03T00:00:00Z' + ], + dtype=np.datetime64 + ) + ) + np.testing.assert_allclose( + resampled_cube.temperature_p90.values[..., 0, 0], + np.array([272.27, 272.85, 273.63, 274.25, 274.76, 274.9]) + ) + np.testing.assert_allclose( + resampled_cube.precipitation_p90.values[..., 0, 0], + np.array([119.94, 119.1, 117.86, 116.3, 115.12, 114.2]) + ) + schema = CubeSchema.new(resampled_cube) + self.assertEqual(3, schema.ndim) + self.assertEqual(('time', 'lat', 'lon'), schema.dims) + self.assertEqual((6, 180, 360), schema.shape) + self.assertEqual((1, 90, 180), schema.chunks) - # TypeError raised on Windows, ValueError on Linux - with self.assertRaises(Exception): - # noinspection PyUnusedLocal - resampled_cube = resample_in_time(self.input_cube, "2W", "percentile_90") # TODO (forman): the call to resample_in_time() takes forever, # this is not xcube, but may be an issue in dask 0.14 or dask 2.8. From 8ad5f0a32f69f9baf44f05d7140fe0e3ec5c0b5b Mon Sep 17 00:00:00 2001 From: konstntokas Date: Thu, 2 Jan 2025 15:09:08 +0100 Subject: [PATCH 3/3] Pont's revuew --- environment.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index dcaee5edd..5888361b6 100644 --- a/environment.yml +++ b/environment.yml @@ -41,7 +41,7 @@ dependencies: - tabulate >=0.9 - tornado >=6.0 - urllib3 >=1.26 - - xarray >=2022.6 + - xarray >=2024.7 - zarr >=2.11 # Chartlets - altair diff --git a/pyproject.toml b/pyproject.toml index f5fbf326a..d246fe4c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ dependencies = [ "tabulate>=0.9", "tornado>=6.0", "urllib3>=1.26", - "xarray>=2022.6", + "xarray>=2024.7", "zarr>=2.11" ] classifiers = [