Contributors to this version: Trevor James Smith (@Zeitsperre), Pascal Bourgault (@aulemahal), Éric Dupuis (@coxipi), Sarah Gammon (@SarahG-579462), Baptiste Hamon (@baptistehamon), Juliette Lavoie (@juliettelavoie), Charles Lu (@Lu-Charles), Kobe Vandelanotte (@kobebryant432), Ludwig Lierhammer (@ludwiglierhammer).
Announcements
This release constitutes a major breaking change from the previous stable release (v0.x) and introduces several new features, enhancements, and API changes.
Users are strongly encouraged to review the breaking changes section below to ensure compatibility with their existing codebases.
Documentation has been updated to reflect these changes as well as to help existing users migrate to the new version.
See Differences between v0 and v1 for a summary of the breaking changes and guidance on how to transition to xclim v1.
The xclim library is now considered to be production-level stable.
xclim functions and objects have been fully overhauled for mypy/ty typing-compliance (GH/1719, PR/2425).
Major changes
- Module
xclim.indiceshas been renamed toxclim.compute. The functions made to build indicators are now called "[index-like] compute functions" and the word "indices" is now avoided as much as possible. (GH/2320, PR/2330). - Major refactor of
xclim.indices.genericto reduce duplication and harmonize signatures. (PR/2258):- Generic functions from
clix-metaare now in their own submodulexclim.indices.clixand some indicators inxclim.cfhave changed to reflect changes in standards. - A summary of the changes can be found in this comment.
- Generic functions from
- Refactor of the
xclim.core.indicator.Indicatorclass itself (PR/2397). Most breaking changes are:- Indicators return
Datasetby default, optionas_datasetis now True by default (GH/2410, PR/2414). - Output metadata are stored in
Indicator.outputs(renamed fromcf_attrs), which is a list ofxclim.core.indicator.Outputobjects (not dictionaries), which have a.attrsproperty holding the attributes (PR/2426). - Renamed
Indicator.translate_attrstoIndicator.translate. - The
xclim.core.indicator.registrynow holdsIndicatorinstances (not classes) and is case-insensitive. - "Virtual submodules" were transformed into
xclim.core.collection.IndicatorCollectioninstances (and not actual python modules). Indicators created this way automatically have the collection's name prepended to their identifier. Indicators created in the context of a collection are not registered by default. (PR/2415). - Copying/Subclassing an existing indicator is now done through
Indicator.copy, methodIndicator.from_dictis deprecated. (PR/2424). - Indicators will now add an
xclim_descriptionattribute to all their outputs. This is similar to thehistorythat is now only appended to output datasets, but excludes datetime andxclim's version. It does not append any input metadata. (PR/2431).
- Indicators return
New indicators and features
- The
xclimcommand-line tool now accepts both-hand--helpto show the help summary. (PR/2316). - The
select_timefunction has been improved. (GH/2365, GH/2393, PR/2374):- Open
date_boundsanddoy_boundsare now supported (i.e.,Noneas start or end). - The
include_doy_bounds_nansargument has been added to control whether NaN values in the bounds should be filled or not. When set toTrue, missing values in the start or end bounds are replaced by the start and end of the period, respectively. - The
bounds_freqargument has been added to allow users to specify the frequency to use when using opendate_bounds.
- Open
- Added multimember support through new argument 'dim' and new test 'signal-to-noise' for
xclim.ensembles.robustness_fractions(PR/2411). IndicatorCollectionyaml specifications updates:- New
basessection for defining indicator classes to reuse in defining the ones in theindicatorssection (PR/2415). - Fields
baseandcomputecan now be a "qualified name" of an object to be imported dynamically, or the qualified name of an indicator with its submodule/realm. Ex:atmos.precip_accumulation, which was previously referred by its identifierprcptot(PR/2415).
- New
- New arguments
validity_rangesandhurs_cap_minin indicatoruniversal_thermal_climate_index(UTCI).
In accordance with recommendations from Bröde et al. (2012), default validity upper bounds were increased fortas - mrt(from 30°C to 70°C) andsfcWind(from 17 to 30.3 m/s) and capping is now enabled by default (sfcWindto a minimum of 0.5 m/s and ofhursto a minimum of 5 %). (GH/2400, PR/2432). xclimsupports passing of allQuantified-like objects to all functions (GH/1726, PR/2425).
Bug fixes
- Handling of
units_metadatahas been updated. (PR/2431).- In
convert_units_to, if the source is known to be "on-scale" or "difference" but the target is ambiguous, the source's metadata is preserved. - When "difference" units are formatted to string, CF symbols are more consistently used.
- In
potential_evapotranspirationwithmethod="DA02"now returns NaN instead of 0 where inputs are missing. (GH/2448).
Breaking changes
xclimhas fully dropped Python 3.10 andnumpybelow v2.0. Python 3.11+ coding conventions are now accepted. (PR/2355).- Legacy imports, links, and documentation for
xsdbahave been removed. (PR/2342). - Installation recipes have been significantly modified to mimic conventions employed by
xarray. (PR/2316). Most development-related recipes are now installed viadependency-groups(PEP-735) andoptional-dependenciesare as follows:dependency-groups:lint(linting tools),notebooks(minimum for interactive notebooks),test(minimum for running tests),docs(minimum for building docs),test-notebooks(minimum for running notebook tests),dev(full suite for local development).optional-dependencies:bias-adjustment(xsdbaand others),performance(speedups),plot(plotting),types(static typing support).
- The
completerecipe has been removed due to design issues. (PR/2355). - For PEP-735 support,
xclimnow requires modernpip(>=25.2) andtox(>=4.34). (PR/2316). mypyhas been replaced withtyas the type checking/inferencing tool and is now run on GitHub Workflows alongsidepylint.
While most checks are currently disabled, these will be progressively enforced in subsequent updates. (PR/2355).- Previously deprecated indicators have been removed:
xclim.indicators.land.snd_to_snow->xclim.indicators.convert.snd_to_snowxclim.indicators.land.snow_to_snd->xclim.indicators.convert.snow_to_sndxclim.indicators.convert.tg->xclim.indicators.convert.mean_temperature_from_max_and_min
- The required versions for many core dependencies have been updated:
numba(>=0.60.0),numpy(>=2.0),pip(>=26.1),scikit-learn(>=1.5.0),xarray(>=2024.6.0,!=2024.10.0). (PR/2355). pre-commithas been replaced byprek.prekis apre-commit-config.ymlcompatible reimplementation built in Rust. (PR/2355).- The approximate method
APPis no longer allowed when using thegenextremedistribution for standardized indices (e.g.xclim.indicators.atmos.standardized_precipitation_indexand similar indicators). - The output of
xclim.compute.stats.parametric_cdfhas a dimensionvinsteadcdf(cdfmore appropriately describes the output variable). mask_between_doyshas been renamed toselect_between_doys. (PR/2374):- The function now returns the selected values instead of a boolean mask.
- For array-like
doy_boundswithouttimedimension, the start and end bounds must now be consecutive according to the frequency (default:freq="YS"). Otherwise, the indexing is invalid and no data are selected.
- Variable
qhas been renamed torivoin hydrological indicators (xclim.indicators.land) to follow modern naming conventions.xclim.land.doy_q{min|max}are renamed toxclim.land.rivo_{min|max}_doy. (GH/2407, PR/2408). - Translation:
xclim.core.locales.get_local_attrshas been rewritten and only accepts a single "locale" now. Locale dictionaries are now case-insensitive. (PR/2397). - Replace hard-coded length of period to actually use the length of the input in test
ipcc-ar6-cofxclim.ensembles.robustness_fractions. (PR/2411, GH/2406). xclim.compute.fitnow avoids adding an extra white space when there are more than one shape parameter, which changes the coordinate to be expected. (PR/2428).- Documentation targets for functions, classes, and variables no longer link to the
sphinx-autodocmodule mappings. All historical hyperlinks toapidocwill no longer function as expected. The user api pages have been refactored to help navigation. (PR/2424). xclim.core.indicatorhas been refactored into its own submodule. All publicly-documented members remain accessible viaxclim.core.indicatorimports. (PR/2424).
Internal changes
xclim.compute.run_length.keep_longest_runuses run boundaries to select the longest run for boolean and numeric 0/1 inputs, avoiding intermediate floating-point arrays while preserving existing results. (GH/2131, PR/2433).- The
Makefilehas been adjusted to install libraries in advance (viapython -m pip install --silent --group ...) when attempting to run commands reliant on specific Python tools. (PR/2316). tox.tomlhas been updated to usedependency-groupsto determine necessary libraries needed for environments, and relies entirely on theMakefilefor running checks. (PR/2316).- Documentation has been adjusted to reflect changes to environment setup required by developers/contributors. (PR/2316).
- The
Makefilenow defines typing-relevant checks (make typing; dependent onmake install-typing) that are enforced in GitHub Workflows. (PR/2355). - Call signature typing for many indices have been better identified. The
castfunction (used to force expected variable types of internal objects) is now less prevalent within the code base. (PR/2355). tox.tomlnow uses the build-composition API, requiringtox >=4.52.0. (PR/2355).- The LaTeX formulas and tables of many indices docstrings were failing to render in ReadTheDocs due to small syntax typos. These have been addressed. (PR/2355).
- A page has been added to the documentation (
governance.rst) that describes the method through which decisions concerningxclimare made as well as the responsibilities of maintainers. (PR/2391). - The security policy now details a brief security assurance that discusses the measures taken to ensure source code and package integrity. (PR/2391).
- Updated
pylintto use v4.0+ standards and addressed several small linting issues. (PR/2409). - Project metadata now compatible with
flit >=4.0standards. (PR/2412). - On
bump release, theCHANGELOG.rstfile is now automatically updated to set the version title and release date. (PR/2413). AUTHORS.rstis now bundled in thelicense-filesof packaged wheels. (PR/2413).make autodoc-custom-indexhas been removed in favour ofmake autodoc-noindex.make docsand othersphinxtargets now use the new 'noindex' variant. (PR/2424).- Testing of
standardized_precipitation_index(SPI) was adjusted to re-enable bottleneck, which was disabled by xarray 2026.09. (PR/2446). - The mypy type checking has been added to the pre-commit configurations (GH/1719, PR/2425).
- Many docstring, call signatures, and returns have been revised to ensure that internal typing is consistent across the entire library (PR/2425).
xclimis now fully compliant with Semantic Versioning v2.0. Thedevtag has been retired while-betaand-rcversion tags will be used moving forward. (PR/2434):bump-my-versionhas been updated to>=1.6.0to make use of thebump version --toflag.
- Publishing workflows now use a two-step process and generate SLSA build provenance attestations (using
actions/attest) when publishing distributions to TestPyPI and PyPI. (PR/2455) - The minimum support version of
pytestis now>=9.2.0. Running doctests now uses the new--confcutdirflag for selectively loadingxclim/testing/conftest.pyconfigurations. (PR/2455).