From 4be7173a49f629cbd841a1f2803b94dca61d1c01 Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Thu, 10 Aug 2023 17:39:08 -0700 Subject: [PATCH 1/5] Fix input climate attrs collision --- src/dscim/menu/simple_storage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dscim/menu/simple_storage.py b/src/dscim/menu/simple_storage.py index adfe4ef7..414bdc9f 100644 --- a/src/dscim/menu/simple_storage.py +++ b/src/dscim/menu/simple_storage.py @@ -184,7 +184,9 @@ def anomalies(self): masks the data according to the mask passed to self.ecs_mask_path. """ if self.gmsl_fair_path is not None: - anomaly = xr.combine_by_coords([self.gmst_anomalies, self.gmsl_anomalies]) + anomaly = xr.combine_by_coords( + [self.gmst_anomalies, self.gmsl_anomalies], combine_attrs="drop" + ) else: anomaly = self.gmst_anomalies From c2aa577335107eb50101ad6c40a6c8cce40e16e5 Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Thu, 10 Aug 2023 17:39:39 -0700 Subject: [PATCH 2/5] Fix indexing with dask-backed boolean array --- src/dscim/utils/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dscim/utils/utils.py b/src/dscim/utils/utils.py index fce23a58..816d4173 100644 --- a/src/dscim/utils/utils.py +++ b/src/dscim/utils/utils.py @@ -281,10 +281,12 @@ def c_equivalence(array, dims, eta, weights=None, func_args=None, func=None): """ if isinstance(array, xr.DataArray): - negative_values = array.where(lambda x: x < 0, drop=True).size + negative_values = array.where(lambda x: (x < 0).compute(), drop=True).size elif isinstance(array, xr.Dataset): negative_values = ( - array[list(array.variables)[0]].where(lambda x: x < 0, drop=True).size + array[list(array.variables)[0]] + .where(lambda x: (x < 0).compute(), drop=True) + .size ) else: raise TypeError("array should be either an xarray.DataArray or xarray.Dataset") From 6d0661d8872278543c3c460dfdd1503590f8bc7b Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Thu, 10 Aug 2023 17:41:55 -0700 Subject: [PATCH 3/5] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e954012..019ee7dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix DeprecationWarning on import. ([PR #128](https://github.com/ClimateImpactLab/dscim/pull/128), [@brews](https://github.com/brews)) - Fix write-to-copy warning in `process_rff_sample()`. ([PR #116](https://github.com/ClimateImpactLab/dscim/pull/116), [@brews](https://github.com/brews)) +- Fix exception from indexing with dask-backed boolean array and input climate Dataset attrs collision with xarray >= v2023.3.0. ([PR #129](https://github.com/ClimateImpactLab/dscim/pull/129), [@brews](https://github.com/brews)) - Fix bad release header links in CHANGELOG.md. ([PR #105](https://github.com/ClimateImpactLab/dscim/pull/105), [@brews](https://github.com/brews)) - Fixed broken code quality checks in CI. Now using `ruff` instead of `flake8`. ([PR #107](https://github.com/ClimateImpactLab/dscim/pull/107), [@brews](https://github.com/brews)) From c0f0e3be92dba3693d24a7bb351d4980d4b67f41 Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Thu, 10 Aug 2023 17:43:41 -0700 Subject: [PATCH 4/5] Manually bump xarray in CI --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f63e561b..5bb0e9b2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # This is used to build the CI test environment and so Github can track dependencies. -xarray==2022.11.0 +xarray==2023.7.0 pandas==2.0.3 numpy==1.25.2 matplotlib==3.7.2 From c3f41dfc90d6347dc271b9c50c00faebaa7b0462 Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Tue, 22 Aug 2023 10:33:40 -0700 Subject: [PATCH 5/5] Bump xarray to 2023.8.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5bb0e9b2..632cba8f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # This is used to build the CI test environment and so Github can track dependencies. -xarray==2023.7.0 +xarray==2023.8.0 pandas==2.0.3 numpy==1.25.2 matplotlib==3.7.2