Skip to content

Releases: Ouranosinc/xclim

v0.53.2

31 Oct 17:14
e4aca67
Compare
Choose a tag to compare

Contributors to this version: Éric Dupuis (@coxipi), Pascal Bourgault (@aulemahal), Trevor James Smith (@Zeitsperre).

Breaking changes

  • Due to a regression affecting symmetry of polyfit and polyval in xarray, xclim now requires xarray>=2023.11.0,!=2024.10.0 (see: pydata/xarray PR/9691). (PR/1978).

Bug fixes

  • Fixed a bug where the units could be changed before a conversion of the magnitudes could occur. Conversion of units for multivariate DataArray is now properly handled in sdba.TrainAdjust and sdba.Adjust. (PR/1972).
  • Fixed a units formatting bug with indicators that output "delta" Celsius degrees. (PR/1973).
  • Corrected the "choices" of parameter op in the docstring of frost_free_spell_max_length. (PR/1977).
  • Reorganised how Indicator subclasses can be added arguments to the call signature. Injecting such arguments now works. For xclim's subclasses, this bug only affected the indexer argument of indicators subclassing xc.core.indicator.IndexingIndicator. (PR/1981).
  • All-nan slices are now treated correctly in method ExtremeValues. (GH/1982, PR/1983).

v0.53.1

21 Oct 17:24
df86b39
Compare
Choose a tag to compare

Contributors to this version: Trevor James Smith (@Zeitsperre).

Internal changes

  • Fixed a few missing dependencies in the documentation build recipe that were causing errors in the CI workflow on ReadTheDocs. (PR/1970).

v0.53.0

17 Oct 20:52
38acb83
Compare
Choose a tag to compare

Contributors to this version: Adrien Lamarche (@LamAdr), Trevor James Smith (@Zeitsperre), Éric Dupuis (@coxipi), Pascal Bourgault (@aulemahal), Sascha Hofmann (@saschahofmann), David Huard (@huard).

Announcements

New indicators

  • New heat_spell_frequency, heat_spell_max_length and heat_spell_total_length : spell length statistics on a bivariate condition that uses the average over a window by default. (PR/1885, PR/1778).
  • New hot_spell_max_magnitude : yields the magnitude of the most intensive heat wave. (PR/1926).
  • New chill_portion and chill_unit : chill portion based on the Dynamic Model and chill unit based on the Utah model indicators. (GH/1753, PR/1909).
  • New water_cycle_intensity : yields the sum of precipitation and actual evapotranspiration. (GH/410, PR/1947).

New features and enhancements

  • New generic xclim.indices.generic.spell_mask that returns a mask of which days are part of a spell. Supports multivariate conditions and weights. Used in new generic index xclim.indices.generic.bivariate_spell_length_statistics that extends spell_length_statistics to two variables. (PR/1885).
  • Indicator parameters can now be assigned a new name, different from the argument name in the compute function. (PR/1885).
  • Add attribute units_metadata to outputs representing a difference between temperatures. This is needed to disambiguate temperature differences from absolute temperature. Changes affect indicators daily_temperature_range, daily_temperature_range_variability, extreme_temperature_range, interday_diurnal_temperature_range, and all degree-day indicators. Implemented using a new pint2cfattrs function to convert pint units to a dictionary of CF attributes. units2pint is also modified to support units_metadata attributes in DataArrays. Some SDBA properties and measures previously returning units of delta_degC will now return the original input DataArray units accompanied with the units_metadata attribute. (GH/1822, PR/1830).
  • xclim.indices.run_length.windowed_max_run_sum accumulates positive values across runs and yields the maximum valued run. (PR/1926).
  • Helper function xclim.indices.helpers.make_hourly_temperature to estimate hourly temperatures from daily min and max temperatures. (PR/1909).
  • New global option resample_map_blocks to wrap all resample().map() code inside a xr.map_blocks to lower the number of dask tasks. Uses utility xclim.indices.helpers.resample_map and requires flox to ensure the chunking allows such block-mapping. Defaults to False. (PR/1848).
  • xclim.indices.run_length.runs_with_holes allows to input a condition that must be met for a run to start and a second condition that must be met for the run to stop. (PR/1778).
  • New generic compute function xclim.indices.generic.thresholded_events that finds events based on a threshold condition and returns basic stats for each. See also: xclim.indices.run_length.find_events. (PR/1778).
  • xclim.core.units.rate2amount and xclim.core.units.amount2rate can now also accept quantities (pint objects or strings), in which case the dim argument must be the time coordinate through which we can find the sampling rate. (PR/1778).
  • xclim.indices.stats.standardized_index now supports a weekly resampling frequency. Only "standard" calendars using numpy's datetime64 dtype are supported for this mode. (GH/1892, PR/1952)

Bug fixes

  • Fixed rate2amount and amount2rate for sub-daily frequencies. (GH/1962, PR/1963).
  • Added the liquid water equivalent thickness ("[length]") to amount ("[mass]/[area]") transformation to the hydro context (the inverse operation was already there). (PR/1963).
  • Fixed a small inefficiency in _otc_adjust, and the standardize method of OTC/dOTC is now applied on individual variable. (PR/1890, PR/1896).
  • Removed deprecated cells in the tutorial notebook sdba.ipynb. (PR/1895).

Breaking changes

  • platformdirs is no longer a direct dependency of xclim, but pooch is required to use many of the new testing functions (installable via pip install pooch or pip install 'xclim[dev]'). (PR/1889).
  • The following previously-deprecated functions have now been removed from xclim : xclim.core.calendar.convert_calendar, xclim.core.calendar.date_range, xclim.core.calendar.date_range_like, xclim.core.calendar.interp_calendar, xclim.core.calendar.days_in_year, xclim.core.calendar.datetime_to_decimal_year. For guidance on how to migrate to alternatives, see the version 0.50.0 Breaking changes. (GH/1010, PR/1845).
  • The transform argument of OTC/dOTC classes (and child functions) has been changed to normalization, and numIterMax has been changed to num_iter_max in xclim.core.utils.optimal_transport (PR/1896).
  • xclim now requires numpy >=1.23.0 and scikit-learn >=1.1.0, as well as (optionally) ipython >=8.5.0, nbsphinx >=0.9.5, and matplotlib >=3.6.0. (GH/1914, PR/1915).

Internal changes

  • The Ouranosinc/xclim-testdata repository has been restructured for better organization and to make better use of pooch and data registries for testing data fetching (see: xclim-testdata PR/29). (PR/1889).
  • The xclim.testing module has been refactored to make use of pooch with file registries. Several testing functions have been removed as a result: (PR/1889)
    • xclim.testing.utils.open_dataset now uses a pooch instance to deliver locally-stored datasets. Its call signature has also changed.
    • xclim now accepts more environment variables to control the behaviour of the testing setup functions. These include XCLIM_TESTDATA_BRANCH, XCLIM_TESTDATA_REPO_URL, and XCLIM_TESTDATA_CACHE_DIR.
    • xclim.testing.utils.get_file, xclim.testing.utils.get_local_testdata, xclim.testing.utils.list_datasets, and xclim.testing.utils.file_md5_checksum have been removed.
      • xclim.testing.utils.nimbus replaces much of this functionality. See the xclim documentation for more information.
  • Many tests focused on evaluating the normal operation of remote file access tools under xclim.testing have been removed. (PR/1889).
  • Setup and teardown functions that were found under tests/conftest.py have been optimised to reduce redundant calls when running pytest xclim. Some obsolete pytest fixtures have also been removed. (PR/1889).
  • Many DeprecationWarning and FutureWarning messages emitted from xarray and pint have been addressed. (GH/1719, PR/1881).
  • The code base has been adjusted to address many pylint-related warnings and errors. In some cases, casting was used to redefine some numpy and xarray objects. (GH/1719, PR/1881).
  • xclim.core now uses absolute imports for clarity and some objects commonly used in the module have been moved to hidden submodules. (GH/1719, PR/1881).
  • xclim.core.indicator.Parameter has a new attribute compute_name while ``xclim.core.indicator.Indicat...
Read more

v0.52.2

16 Sep 17:40
Compare
Choose a tag to compare

Contributors to this version: Pascal Bourgault (@aulemahal).

Bug fixes

  • Fixed decimal_year import, fixed functions rate2amount, amount2rate, time_bnds and stack_periods for xarray version 2024.09.0. Removed datetime_to_decimal_year as the mirrored xarray function was replaced by ds.time.dt.decimal_year. (PR/1920).

v0.52.1

11 Sep 20:59
Compare
Choose a tag to compare

Contributors to this version: Trevor James Smith (@Zeitsperre).

Bug fixes

  • Adjusted the required base version of pyarrow to be v10.0.1 to address an environment resolution error on conda-forge. (PR/1918).

v0.52.0

08 Aug 17:07
9f4d9bd
Compare
Choose a tag to compare

Contributors to this version: David Huard (@huard), Trevor James Smith (@Zeitsperre), Hui-Min Wang (@Hem-W), Éric Dupuis (@coxipi), Sarah Gammon (@SarahG-579462), Pascal Bourgault (@aulemahal), Juliette Lavoie (@juliettelavoie), Adrien Lamarche (@LamAdr).

Announcements

  • xclim now supports both numpy versions >=1.20 and >=2.0. (GH/1785, PR/1814, PR/1870).
  • xclim now needs cf_xarray>=0.9.3 but continues to support older versions of pint (<0.24) for compatibility reasons. (PR/1870).

New features and enhancements

  • xclim.sdba.nbutils.quantile and its child functions are now faster. If the fastnanquantile library is installed, it is used as the backend for the computation of quantiles and yields even faster results. This dependency is now listed in the xclim[extras] recipe. (GH/1255, PR/1513).
  • New multivariate bias adjustment class MBCn, giving a faster and more accurate implementation of the MBCn algorithm. (GH/1551, PR/1580).
  • New multivariate bias adjustment classes OTC and dOTC. Requires the POT library which can be installed via the xclim[extras] recipe. (PR/1787).
  • xclim is now compatible with pytest versions >=8.0.0. (PR/1632).

Breaking changes

  • As of cf_xarray>=0.9.3, dimensionless quantities now use the "1" units attribute as specified by the CF conventions, previously an empty string was returned. (PR/1814).
  • The definitions of the frost_free_season_start and frost_free_season_end have been slightly changed to be coherent with the frost_free_season_length and xclim's notion of season in general. Indicator and indices signature have been adapted to the new conventions. (PR/1845).
  • Season length indicators have been modified to return 0 for all cases where a proper season was not found, but the data is valid. Previously, a nan was given if neither a start nor an end were found, even if the data was valid, and a 0 was given if an end was found but without a valid start. (PR/1845).

Bug fixes

  • Fixed the indexer bug in the xclim.indices.standardized_index_fit_params when multiple or non-array indexers are specified and fitted parameters are reloaded from netCDF. (GH/1842, PR/1843).
  • Addressed a bug found in wet_spell_* indicators that was contributing to erroneous results. A new generic spell length statistic function (xclim.indices.generic.spell_length_statistics) is now used in wet and dry spells indicators. (GH/1834, PR/1838).
  • Syntax for nan and inf was adapted to support numpy>=2.0. (PR/1814, GH/1785).
  • The type in jitter now works with modern version of dask (>=2024.8.0). (PR/1864).

Internal changes

  • Changed the French translation of "wet days" from "jours mouillés" to "jours pluvieux". (GH/1825, PR/1826).
  • In order to adapt to changes in pytest, the doctest fixtures have been split from the main testing suite and doctests are now run using $ python -c 'from xclim.testing.utils import run_doctests; run_doctests()'. (PR/1632).
  • tox has been reconfigured to run doctests in a separate environment (tox -e doctests). (PR/1632).
  • Added xclim.indices.generic.season to make season start, end, and length indices. Added a stat argument to xclim.indices.run_length.season to avoid returning a dataset. (PR/1845).

CI changes

  • pip-tools (pip-compile) has been used to generate a lock file with hashes for the CI dependencies. (PR/1841).
  • The main.yml workflow has been updated to use simpler trigger logic. (PR/1841).
  • A workflow bug has been fixed that was causing multiple duplicate comments to be made on Pull Requests originating from forks. (PR/1841).
  • The upstream.yml workflow was adapted to not install upstream Python dependencies using hashes (as it is impossible to install directly from GitHub sources using --require-hashes). (PR/1859).
  • The tox-gh configuration has been set to handle the environment configurations on GitHub Workflows. The tox.ini file is also a bit more organized/consistent. (PR/1859).

v0.51.0

04 Jul 20:31
6d60d7b
Compare
Choose a tag to compare

Contributors to this version: Trevor James Smith (@Zeitsperre), Pascal Bourgault (@aulemahal).

New features and enhancements

  • Added the op keyword to the growing_season_{start|end} indices and indicators, allowing for customizable threshold operators using indices.generic.compare(). (GH/1794, PR/1796).
  • xclim now separates the optional dependencies into dev and docs recipes. Both can be installed with the all option ($ python -m pip install xclim[all]). (PR/1806).

Bug fixes

  • Units of degree-days computations with Fahrenheit input fixed to yield "°R d". Added a new xclim.core.units.ensure_absolute_temperature method to convert from delta to absolute temperatures. (GH/1789, PR/1804).
  • Clarified a typo in the docstring formula for xclim.indices.growing_season_length. (PR/1796).

Internal changes

  • netcdf4 has been pinned below v1.7 for test stability reasons. (PR/1791).
  • flake8-bandit-like checks have been enabled via ruff, with fixes for a few security-related issues. (PR/1806).
  • xclim.testing.utils now employs more secure URL auditing checks. (PR/1806).
  • CHANGES.rst has been renamed to CHANGELOG.rst, adhering to suggestions from the keepachangelog v.1.1.0 specifications. (PR/1823).

CI changes

  • GitHub repository now uses Rulesets for branch protection. (PR/1790).
  • Version bumping and project triage is now handled by the Ouranos Helper GitHub App. (PR/1790).
  • bump-my-version has been updated to v0.23.0. (PR/1790).
  • The Ouranos Helper GitHub App now provides verified commits. (GH/1811, PR/1812).
  • Added the deptry package to the dev linter tools and linting workflows for performing dependency analyses. (PR/1806).
  • Several linting tools have been updated to the latest versions and pinned. (PR/1806).

v0.50.0

17 Jun 17:40
a1a1a25
Compare
Choose a tag to compare

Contributors to this version: Trevor James Smith (@Zeitsperre), Éric Dupuis (@coxipi).

New features and enhancements

  • New properties: Bivariate Spell Length (xclim.sdba.properties.bivariate_spell_length), Generalized Spell Lengths with an argument for window, and Specific Spell Lengths with window fixed to '1' (xclim.sdba.properties.threshold_count, xclim.sdba.properties.bivariate_threshold_count). (PR/1758).
  • New option normalize in sdba.measures.taylordiagram to obtain normalized Taylor Diagrams (divide standard deviations by standard deviation of the reference). (PR/1764).

Breaking changes

  • pint has been pinned below v0.24 until xclim can be updated to support the latest version. (GH/1771, PR/1772).
  • numpy has been pinned below v2.0.0 until xclim can be updated to support the latest version. (PR/1783).
  • Calendar utilities that have an equivalent in xarray have been deprecated and will be removed in xclim v0.51.0. (GH/1010, PR/1761). This concerns the following members of xclim.core.calendar:
    • convert_calendar : Use Dataset.convert_calendar, DataArray.convert_calendar or xr.coding.calendar_ops.convert_calendar instead.
      • If your code passes target as an array, first convert the source to the target's calendar and then reindex the result to target.
      • If you were using the doy=True option, replace it with xc.core.calendar.convert_doy(source, target_cal).convert_calendar(target_cal).
      • "default" is no longer a valid calendar name for any xclim functions and will not be returned by get_calendar. Xarray has a use_cftime argument, xclim exposes it when the distinction is needed.
    • date_range : Use xarray.date_range instead.
    • date_range_like: Use xarray.date_range_like instead.
    • interp_calendar : Use Dataset.interp_calendar or xarray.coding.calendar_ops.interp_calendar instead.
    • days_in_year : Use xarray.coding.calendar_ops._days_in_year instead.
    • datetime_to_decimal_year : Use xarray.coding.calendar_ops._datetime_to_decimal_year instead.

Internal changes

  • Synchronized tooling versions across pyproject.toml and tox.ini and pinned them to the latest stable releases in GitHub Workflows. (PR/1744).
  • Fixed a few small spelling and grammar issues that were causing errors with codespell. Now ignoring SVG files. (PR/1769).
  • Temporarily skipping the test_hawkins_sutton_smoke test due to strange behaviour with xarray. (PR/1769).
  • Fixed some previously uncaught errors raised from recent versions of pylint and codespell. (PR/1772).
  • Set the doctest examples to all use h5netcdf with worker-separated caches to load datasets. (PR/1772).

Bug fixes

  • xclim.indices.{cold|hot}_spell_total_length now properly uses the argument window to only count spells with at least window time steps. (GH/1765, PR/1777).
  • Addressed an error in xclim.ensembles._filters._concat_hist where remnants of a scenario selection were not being dropped properly. (PR/1780).

v0.49.0

02 May 22:09
a47d1b3
Compare
Choose a tag to compare

Contributors to this version: Trevor James Smith (@Zeitsperre), Pascal Bourgault (@aulemahal), Juliette Lavoie (@juliettelavoie), David Huard (@huard), Gabriel Rondeau-Genesse (@RondeauG), Javier Diez-Sierra (@JavierDiezSierra), Sarah Gammon (@SarahG-579462), Éric Dupuis (@coxipi).

Announcements

  • xclim has migrated its development branch name from master to main. (GH/1667, PR/1669).

New features and enhancements

  • Indicator xclim.atmos.potential_evapotranspiration and indice xclim.indices.potential_evapotranspiration now accept a new value (DA02) for argument method implementing potential evapotranspiration based on Droogers and Allen (2002). (GH/1710, PR/1723).
  • The documentation now uses the furo theme for Sphinx. This theme supports native "light" and "dark" modes, adaptive screen resolution, as well as provides a better navigation layout for pages housing long lists of entries (e.g. indices). (GH/1693, PR/1731).
  • xclim.ensembles.ensemble_percentiles now takes a method argument, accepting one of: 'interpolated_inverted_cdf', 'hazen', 'weibull', 'linear' (default), 'median_unbiased', or 'normal_unbiased'. (GH/1694, PR/1732).
  • Distributions with negative values are directly fitted without need for an offset for distributions such as 'gamma' and 'fisk' in xclim.indices.standardized_precipitation_evapotranspiration_index. (GH/1477 PR/1720).
  • xclim.indices.stats_fit_start gives an estimate of the loc parameter for 'gamma' and 'fisk' distributions. (GH/1477 PR/1720).

New indicators

  • New snw_season_length and snd_season_length computing the duration between the start and the end of the snow season, both defined as the first day of a continuous period with snow above/under a threshold. Previous versions of these indicators were renamed snw_days_above and snd_days_above to better reflect what they computed : the number of days with snow above a given threshold (with no notion of continuity). (GH/1703, PR/1708).
  • Added xclim.atmos.duff_moisture_code, part of the Canadian Forest Fire Weather Index System. It was already an output of the xclim.atmos.cffwis_indices, but now has its own standalone indicator. (GH/1698, PR/1712).

Breaking changes

  • The previously deprecated functions xclim.sdba.processing.construct_moving_yearly_window and xclim.sdba.processing.unpack_moving_yearly_window have been removed. These functions have been replaced by xclim.core.calendar.stack_periods and xclim.core.calendar.unstack_periods. (PR/1717).
  • The previously deprecated function xclim.ensembles.change_significance has been removed. (PR/1737).
  • Indicators snw_season_length and snd_season_length have been modified. (GH/1703, PR/1708).
  • The 'hargeaves85'/'hg85' method for the potential_evapotranspiration indicator and indice has been modified for precision and consistency with recent academic literature. (GH/1710, PR/1723).
  • The __getitem__ method of xclim.core.indicator.Parameter instances has been removed. Accessing members of Parameters now uniquely uses dot notation. (PR/1721).
  • The obsolete function wrapper for generating Indicators xclim.core.utils.wrapped_partial has been removed. (PR/1721).
  • The default documentation theme has changed from sphinx-rtd-theme to furo; Several modifications to the documentation configuration and CSS overrides have been made to accommodate the changes. furo is now a docs dependency. (GH/1693, PR/1731).
  • Estimation of parameters using _fit_start for gamma and fisk has been changed and can affect the results obtained with full-fledged (e.g. "ML") methods. (GH/1477 PR/1720).
  • Method APP in xclim.indices.standardized_precipitation_index and xclim.indices.standardized_precipitation_evapotranspiration_index now requires the user to impose a loc parameter through fitkwargs['floc']. (GH/1477, PR/1720).
  • Zero inflated distributions used in xclim.stats.standardized_index now appropriately use the probability of zeroes in the calibration data and not the entire dataset. (GH/1477 PR/1720).

Bug fixes

  • Fixed a bug in sdba's map_groups that prevented passing DataArrays with cftime coordinates if the sdba_encode_cf option was 'True'. (GH/1673, PR/1674).
  • Fixed bug in sdba where a loaded training dataset could not be used for adjustment. (GH/1678, PR/1679).
  • Fixed bug with loess smoothing for an array full of NaNs. (PR/1699).
  • Fixed and adapted time_bnds to the newest xarray. (PR/1700).
  • Fixed "agreement fraction" in robustness_fractions to distinguish between negative change and no change. Added "negative" and "changed negative" fractions (GH/1690, PR/1711).
  • make_criteria now skips columns with NaNs across all realizations. (PR/1713).
  • Fixed bug where QuantileDeltaMapping adjustment was failing for seasonal grouping. (GH/1704, PR/1716).
  • The codebase has been adjusted to address several (~400) mypy-related errors attributable to inaccurate function call signatures and variable name shadowing. (GH/1719, PR/1721).
  • xclim.core.formatting.generate_indicator_docstring has been modified to ensure that the numpy-docstrings of all Indicators are consistent in their formatting. (PR/1731).
  • Fixed documentation example for frequency adaptation with sdba. (GH/1740, PR/1742).

Internal changes

  • Added "doymin" and "doymax" to the possible operations of generic.stats. Fixed a warning issue when op was "integral". (PR/1672).
  • Reorganized GitHub CI build matrices to run the doctests more consistently. (PR/1709).
  • Removed the experimental numba and llvm dependency installation steps in the tox.ini file. Added numba@main to the upstream dependencies. (PR/1709).
  • Added the tox-gh dependency to the development installation recipe. This will soon be required for running the tox test ensemble on GitHub Workflows. (PR/1709).
  • Added the vulture static code analysis tool for finding dead code to the development dependency list and linters (makefile, tox and pre-commit hooks). (PR/1717).
  • Added error message when using xclim.indices.stats.dist_method with nnlf and included note in docstring. (GH/1683, PR/1714).
  • PEP8 rule N802 is now enabled in the ruff formatter. Function names should follow Snake case, with rare exceptions. (PR/1721).
  • Linting dependencies have been updated to the latest versions and made consistent across environment.yml, pyproject.toml and tox.ini files. (PR/1717).
  • Code styling for the documentation now uses sas ("light" theme) and lightbulb ("dark" theme) in order to ensure adequate contrast for code blocks. ([PR/1731](https://github.com/Ouranosinc/x...
Read more

v0.48.2

26 Feb 17:21
bb39cb1
Compare
Choose a tag to compare

Contributors to this version: Juliette Lavoie (@juliettelavoie).

Bug fixes

  • Add measure to YAML validation schema (for building sdba properties) and allow skipping the YAML validation when building modules. (PR/1664).