diff --git a/CHANGELOG.md b/CHANGELOG.md index 39211aca..d039bc24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,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)) - Minor code style cleanup. ([PR #133](https://github.com/ClimateImpactLab/dscim/pull/133), [@brews](https://github.com/brews)) diff --git a/requirements.txt b/requirements.txt index 273e67aa..d07911e6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # This is used to build the CI test environment and so Github can track dependencies. -xarray==2022.11.0 -pandas==2.1.0 +xarray==2023.8.0 +pandas==2.0.3 numpy==1.25.2 matplotlib==3.7.2 dask[array, distributed]==2023.8.1 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 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")