Skip to content

Commit

Permalink
Merge pull request #284 from cerfacs-globc/maint/adapt_to_xclim_047
Browse files Browse the repository at this point in the history
Maint/adapt to xclim>=0.45
  • Loading branch information
bzah authored Dec 6, 2023
2 parents dc88a5a + 3b18154 commit b8ab259
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions doc/source/references/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Release history
===============

6.5.0
-----
6.5.0 (unreleased)
------------------

* [maint] Adapt generic indicators "excess" and "deficit" to xclim 0.45.
* [maint] Upgrade minimal python version to 3.9
* [fix] Avoid resampling SPI* indices.

Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ channels:
dependencies:
# Core dependencies
- python>=3.9
- xclim==0.43
- xclim>=0.45
- numpy
- xarray>=2022.6
- cf_xarray>=0.7.4
Expand Down
6 changes: 4 additions & 2 deletions icclim/generic_indices/generic_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ def excess(
res = (
(excesses).clip(min=0).resample(time=resample_freq.pandas_freq).sum(dim="time")
)
return to_agg_units(res, study, "delta_prod")
res = res.assign_attrs(units=f"delta_{res.attrs['units']}")
return to_agg_units(res, study, "integral")


def deficit(
Expand All @@ -401,7 +402,8 @@ def deficit(
study, threshold = get_single_var(climate_vars)
deficit = threshold.compute(study, override_op=lambda da, th: th - da)
res = deficit.clip(min=0).resample(time=resample_freq.pandas_freq).sum(dim="time")
return to_agg_units(res, study, "delta_prod")
res = res.assign_attrs(units=f"delta_{res.attrs['units']}")
return to_agg_units(res, study, "integral")


def fraction_of_total(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ sphinx_codeautolink
sphinx_copybutton
sphinx_lfs_content
xarray>=2022.6
xclim==0.43
xclim>=0.45
zarr
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ sphinx_copybutton
sphinx_lfs_content
twine
xarray>=2022.6
xclim==0.43
xclim>=0.45
zarr
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
MINIMAL_REQUIREMENTS = [
"numpy>=1.16",
"xarray>=2022.6",
"xclim>=0.43",
"xclim>=0.45, <=0.47",
"cf_xarray>=0.7.4",
"cftime>=1.4.1",
"dask[array]",
Expand Down

0 comments on commit b8ab259

Please sign in to comment.