Skip to content

Releases: Ouranosinc/xclim

v0.55.1

26 Feb 18:37
Compare
Choose a tag to compare

Contributors to this version: Éric Dupuis (@coxipi).

Bug fixes

  • Re-allow the use of interp="linear" in adjustments that use day-of-year grouping, group=Grouper("time.dayofyear", window). (PR/2087).

v0.55.0

17 Feb 21:51
7093afc
Compare
Choose a tag to compare

Contributors to this version: Juliette Lavoie (@juliettelavoie), Trevor James Smith (@Zeitsperre), Sascha Hofmann (@saschahofmann), Pascal Bourgault (@aulemahal), Éric Dupuis (@coxipi), Baptiste Hamon (@baptistehamon), Sarah Gammon (@SarahG-579462).

Breaking changes

  • Missing value method "WMO" was modified to remove the criterion that the timeseries needs to be continuous (without holes). (PR/2058).

Announcements

  • xclim now officially supports Python 3.13 (using numba v0.61.0). (GH/2022, PR/2054).
  • xclim version 0.55.0 will be the last version to support Python 3.10. The next version will require Python 3.11 or higher. (PR/2054).

New indicators

  • Added xclim.land.holiday_snow_days to compute the number of days with snow on the ground during holidays ("Christmas Days"). (GH/2029, PR/2030).
  • Added xclim.land.holiday_snow_and_snowfall_days to compute the number of days with snow on the ground and measurable snowfall during holidays ("Perfect Christmas Days"). (GH/2029, PR/2030).
  • Added xclim.atmos.vapor_pressure_deficit to compute the vapor pressure deficit from temperature and relative humidity. (GH/1917, PR/2072).

New features and enhancements

  • New function ensemble.partition.general_partition. (PR/2035).
  • Added a new xclim.indices.generic.bivariate_count_occurrences function to count instances where operations and performed and validated for two variables. (PR/2030).
  • xclim.testing.helpers.test_timeseries now accepts a calendar argument that is forwarded to xr.cftime_range. (PR/2019).
  • New xclim.indices.fao_allen98, exporting the FAO-56 Penman-Monteith equation for potential evapotranspiration (GH/2004, PR/2067).
  • Missing values method "pct" and "at_least_n" now accept a new "subfreq" option that allows to compute the missing mask in two steps. When given, the algorithm is applied at this "subfreq" resampling frequency first and then the result is resampled at the target indicator frequency. In the output, a period is invalid if any of its subgroup where flagged as invalid by the chosen method. (PR/2058, GH/1820).
  • scipy.stats.rv_continuous instances can now be given directly as the dist argument in standardized_precipitation_index and standardized_precipitation_evapotranspiration_index indicators. This includes lmoments3 distributions when specifying method="PWM". (GH/2043, PR/2045).
  • Time selection in xclim.core.calendar.select_time and the **indexer argument of indicators now supports day-of-year bounds given as DataArrays with spatial and/or temporal dimensions. (GH/1987, PR/2055).
  • Maximum Spacing Estimation method for distribution fitting has been added to xclim.indices.stats.fit (GH/2078, PR/2077)

Bug fixes

  • Fixed a bug in xclim.sdba.Grouper.get_index that didn't correctly interpolate seasonal values (GH/2014, PR/2019).
  • Fixed a bug where xclim.indicators.atmos.potential_evapotranspiration would return wrong results when hurs was provided in % (PR/2067).
  • Fixed the default "op" argument of xclim.atmos.growing_season_end (GH/2056, PR/2080).
  • Removed the useless "thresh" argument from xclim.atmos.precip_accumulation (GH/1763, PR/2080).

Internal changes

  • Adjusted the TestOfficialYaml test to use a dynamic method for finding the installed location of xclim. (PR/2028).
  • Adjusted two tests for better handling when running in Windows environments. (PR/2057).
  • Refactor of the xclim.core.missing module, usage of the Missing objects has been broken. (PR/2058, PR/2055, PR/2076, GH/1820, GH/2000).
    • Objects are initialized with their options and then called with the data, input frequency, target frequency and indexer.
    • Subclasses receive non-resampled DataArray in their is_missing methods.
    • Subclasses receive the array of valid timesteps valid instead of null, the invalid ones.
    • MissingWMO now uses xclim.indices.helpers.resample_map which should greatly improve performance in a dask context.
  • There is now a warning stating that fitkwargs are not employed when using the lmoments3 distribution. One exception is the use of 'floc' which is allowed with the gamma distribution. 'floc' is used to shift the distribution before computing fitting parameters with the lmoments3 distribution since loc=0 is always assumed in the library. (GH/2043, PR/2045).
  • xclim now tracks energy usage and carbon emissions ("last run", "average", and "total") during CI workflows using the eco-ci-energy-estimation GitHub Action. (PR/2046).

v0.54.0

16 Dec 22:18
7af92dd
Compare
Choose a tag to compare

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

New features and enhancements

  • Python 3.9 coding conventions have been dropped in favour of Python 3.10+ conventions. (PR/1988).
  • xclim.indices.chill_unit now accepts a new argument positive_only to compute the daily positive chill units. (PR/2003).

Breaking changes

  • The minimum required version of dask has been increased to 2024.8.1. (GH/1992, PR/1991).
  • The docstrings of many xclim modules, classes, methods, and functions have been slightly adjusted to ensure stricter compliance with established numpy docstring conventions. (PR/1988).
  • Using different time for ref and hist is now explicitly forbidden in many bias adjustment methods (e.g. EmpiricalQuantileMapping). Methods that combine ref, hist, and sim in the same map_groups also require that time arrays be equal in size. (GH/1903, PR/1995, PR/2013).
  • xclim now uses a src layout for the codebase. Structure-dependent functions, documentation, and build commands have been adapted to reflect these changes. Developers will need to reinstall xclim using pip install -e .. (PR/1971).
  • The call signature of xclim.indices.hot_spell_magnitude originally asked for an op argument that was not used. This argument has been removed. (PR/2018).

Bug fixes

  • Fixed pickling issue with xclim.sdba.Grouper and other classes for usage with dask>=2024.11. (GH/1992, PR/1993).
  • Fixed an issue with nimbus that was causing URL path components to be improperly joined. (PR/1997).
  • base_kws_vars in MBCn is now copied inside the adjust function so that in-place changes do not change the dict globally. (PR/1999).
  • Fixed a bug in the logic of xclim.testing.utils.load_registry that impacted the ability to load a registry.txt from a non-default repository. (PR/2001).

Internal changes

  • Changed French translations with word "pluvieux" to "avec précipitations". (GH/1960, PR/1994).
  • Nan values in OTC and dOTC are only dropped and replaced at the lowest level so that the size of time arrays never changes on xarray levels. (PR/1995, PR/2013)
  • streamflow entry replaced with "q" in variables.yml. (GH/1912, PR/1996).
  • In order to address Error 403 (forbidden) requests when retrieving data from GitHub via ReadTheDocs, the nimbus class has been modified to use an overloaded fetch method that appends a modified User-Agent header to the request. (PR/2001).
  • Addressed a very rare race condition that can happen if pytest is tearing down the test environment when running across multiple workers. (PR/1863).
  • The numpydoc linting tool has been added to the development dependencies, linting checks, and the pre-commit configuration. (PR/1988).
  • Added a more robust yamllint configuration to ensure that all YAML files are linted consistently. (PR/1971).
  • Addressed a very rare singular matrix error that can happen in test_loess_smoothing_nan. (PR/2015).
  • Addressed a handful of typing and call signature issues in the xclim codebase. (PR/2018).

CI changes

  • Added the green-coding-solutions/eco-ci-energy-estimation GitHub Action to the workflows to establish energy and carbon usage of CI activity. (PR/1863).
  • Various workflow security fixes: (PR/2023)
    • Simplified the bump-version.yml version string parsing to harden against template injection.
    • Further de-escalated privileges for most workflows.

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).