diff --git a/CHANGES.rst b/CHANGES.rst index e12dba698..d4665929c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,8 +2,8 @@ Changelog ========= -0.42.0 (unreleased) -------------------- +v0.42.0 (unreleased) +-------------------- Contributors to this version: Trevor James Smith (:user:`Zeitsperre`). New features and enhancements @@ -13,6 +13,10 @@ New features and enhancements * ``xclim.core.calendar.yearly_random_doy`` * `scipy` is no longer pinned below v1.9 and `lmoments3>=1.0.5` is now a core dependency and installed by default with `pip`. (:issue:`1142`, :pull:`1171`). +Bug fixes +^^^^^^^^^ +* Warnings emitted from regular usage of some indices (``snowfall_approximation`` with ``method="brown"``, ``effective_growing_degree_days``) due to successive ``convert_units_to`` calls within their logic have been silenced. (:pull:`1319`). + Breaking changes ^^^^^^^^^^^^^^^^ * The call signatures for ``xclim.ensembles.create_ensemble`` and ``xclim.ensembles._base._ens_align_dataset`` have been deprecated. Calls to these functions made with the original signature will emit warnings. Changes will become breaking in `xclim>=0.43.0`.(:issue:`1305`, :pull:`1317`). Affected variable: @@ -39,9 +43,10 @@ Internal changes * Addressed a formatting bug that caused `Indicators` with multiple variables returned to not be properly formatted in the documentation. (:issue:`1305`, :pull:`1317`). * `tox` now include `sbck` and `eofs` flags for easier testing of dependencies. CI builds now test against `sbck-python` @ master. (:pull:`1328`). * `upstream` CI tests are now run on push to master, at midnight, and can also be triggered via `workflow_dispatch`. Failures from upstream build will open issues using `xarray-contrib/issue-from-pytest-log`. (:pull:`1327`). +* Warnings from set ``_version_deprecated`` within Indicators now emit ``FutureWarning`` instead of ``DeprecationWarning`` for greater visibility. (:pull:`1319`). -0.41.0 (2023-02-28) -------------------- +v0.41.0 (2023-02-28) +-------------------- Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Pascal Bourgault (:user:`aulemahal`), Ludwig Lierhammer (:user:`ludwiglierhammer`), Éric Dupuis (:user:`coxipi`). New features and enhancements @@ -94,8 +99,8 @@ Internal changes * Added `sphinxcontrib-svg2pdfconverter` for converting SVG graphics within documentation to PDF-compatible images. (:pull:`1296`). * README badges for supported Python versions and repository health have been added. (:issue:`1304`, :pull:`1307`). -0.40.0 (2023-01-13) -------------------- +v0.40.0 (2023-01-13) +-------------------- Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Pascal Bourgault (:user:`aulemahal`), David Huard (:user:`huard`), Juliette Lavoie (:user:`juliettelavoie`). New features and enhancements @@ -150,8 +155,8 @@ Internal changes * A notebook (``extendingxclim.ipynb``) has been updated to remove mentions of obsolete `xclim.subset` module. (:pull:`1258`). * Merge of sdba documentation from the module and the rst files, some cleanup and addition of a section referring to GitHub issues. (:pull:`1230`). -0.39.0 (2022-11-02) -------------------- +v0.39.0 (2022-11-02) +-------------------- Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Abel Aoun (:user:`bzah`), Éric Dupuis (:user:`coxipi`), Travis Logan (:user:`tlogan2000`), Pascal Bourgault (:user:`aulemahal`). New features and enhancements @@ -213,8 +218,8 @@ Internal changes * ``show_versions`` can now accept a list of dependencies so that other libraries can make use of this utility. (:pull:`1215`). * Pull Requests now are automatically tagged (``CI``, ``docs``, ``indicators``, and/or ``sdba``) according to files modified using the `GitHub Labeler Action `_. (:pull:`1214`). -0.38.0 (2022-09-06) -------------------- +v0.38.0 (2022-09-06) +-------------------- Contributors to this version: Pascal Bourgault (:user:`aulemahal`), Éric Dupuis (:user:`coxipi`), Trevor James Smith (:user:`Zeitsperre`), Abel Aoun (:user:`bzah`), Gabriel Rondeau-Genesse (:user:`RondeauG`), Dougie Squire (:user:`dougiesquire`). New features and enhancements @@ -287,8 +292,8 @@ Internal changes * Adjusted the ANUCLIM indices by removing "ANUCLIM" from their titles, modifying their docstrings, and handling `"op"` input in a more user-friendly way. (:issue:`1055`, :pull:`1169`). * Documentation for fire-based indices/indicators has been reorganized to reflect the new submodule structure. (:pull:`1159`). -0.37.0 (2022-06-20) -------------------- +v0.37.0 (2022-06-20) +-------------------- Contributors to this version: Abel Aoun (:user:`bzah`), Pascal Bourgault (:user:`aulemahal`), Trevor James Smith (:user:`Zeitsperre`), Gabriel Rondeau-Genesse (:user:`RondeauG`), Juliette Lavoie (:user:`juliettelavoie`), Ludwig Lierhammer (:user:`ludwiglierhammer`). Announcements diff --git a/xclim/core/indicator.py b/xclim/core/indicator.py index 2ab51b592..8a18e2c63 100644 --- a/xclim/core/indicator.py +++ b/xclim/core/indicator.py @@ -1350,9 +1350,10 @@ def injected_parameters(self): def _show_deprecation_warning(self): warnings.warn( - f"`{self.title}` is deprecated as of xclim v{self._version_deprecated}. " - f"See the xclim release notes for more information.", - DeprecationWarning, + f"`{self.title}` is deprecated as of `xclim` v{self._version_deprecated} and will be removed " + "in a future release. See the `xclim` release notes for more information: " + f"https://xclim.readthedocs.io/en/stable/history.html", + FutureWarning, stacklevel=3, ) diff --git a/xclim/indices/_agro.py b/xclim/indices/_agro.py index 48b8e71a5..e30d55c86 100644 --- a/xclim/indices/_agro.py +++ b/xclim/indices/_agro.py @@ -1332,17 +1332,20 @@ def effective_growing_degree_days( tasmax = convert_units_to(tasmax, "degC") tasmin = convert_units_to(tasmin, "degC") thresh = convert_units_to(thresh, "degC") + thresh_with_units = f"{thresh} degC" tas = (tasmin + tasmax) / 2 tas.attrs["units"] = "degC" if method.lower() == "bootsma": - fda = first_day_temperature_above(tas=tas, thresh=thresh, window=1, freq=freq) + fda = first_day_temperature_above( + tas=tas, thresh=thresh_with_units, window=1, freq=freq + ) start = fda + 10 elif method.lower() == "qian": tas_weighted = qian_weighted_mean_average(tas=tas, dim=dim) start = first_day_temperature_above( - tas_weighted, thresh=thresh, window=5, freq=freq + tas_weighted, thresh=thresh_with_units, window=5, freq=freq ) else: raise NotImplementedError(f"Method: {method}.") diff --git a/xclim/indices/_conversion.py b/xclim/indices/_conversion.py index 0434993da..92a86e945 100644 --- a/xclim/indices/_conversion.py +++ b/xclim/indices/_conversion.py @@ -819,7 +819,8 @@ def snowfall_approximation( raise ValueError("Non-scalar `thresh` are not allowed with method `brown`.") # Freezing point + 2C in the native units - upper = convert_units_to(convert_units_to(thresh, "degC") + 2, tas) + thresh_plus_2 = convert_units_to(thresh, "degC") + 2 + upper = convert_units_to(f"{thresh_plus_2} degC", tas) thresh = convert_units_to(thresh, tas) # Interpolate fraction over temperature (in units of tas)