Skip to content

v0.46.0

Compare
Choose a tag to compare
@Zeitsperre Zeitsperre released this 24 Oct 17:26
8664d50

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

Announcements

  • The default mechanism for computing the Mean Radiant Temperature, a part of the Universal Thermal Climate Index (UTCI) was broken in xclim v0.44.0 and v0.45.0. This has now been fixed by changing the default settings.

New indicators

  • xclim.indices.snw_storm_days computes the number of days with snowfall amount accumulation above a given threshold (default: 10 Kg m-2). (PR/1505).
  • Added xclim.indices.wind_power_potential to estimate the potential for wind power production given wind speed at the turbine hub height and turbine specifications, along with xclim.indices.wind_profile to estimate the wind speed at different heights based on wind speed at a reference height. (GH/1458, PR/1471).

New features and enhancements

  • xclim now has a dedicated console command for prefetching testing data from xclim-testdata with branch options (e.g.: $ xclim prefetch_testing_data --branch some_development_branch). This command can be used to download the testing data to a local cache, which can then be used to run the testing suite without internet access or in "offline" mode. For more information, see the contributing documentation section for Updating Testing Data. (GH/1468, PR/1473).
  • The testing suite now offers a means of running tests in "offline" mode (using pytest-socket <https://github.com/miketheman/pytest-socket>_ to block external connections). This requires a local copy of xclim-testdata to be present in the user's home cache directory and for certain pytest options and markers to be set when invoked. For more information, see the contributing documentation section for Running Tests in Offline Mode. (GH/1468, PR/1473).
  • The SKIP_NOTEBOOKS flag to speed up docs builds is now documented. See the contributing documentation section Get Started! for details. (GH/1470, PR/1476).
  • Refactored the indicators page with the addition of a search bar (GH/1433, PR/1454).
  • Indicator xclim.indices.generic.stats now accepts any frequency (previously only daily). (PR/1498).
  • Added argument "out_units" to select_resample_op to bypass limitations of to_agg_units in custom indicators. Also, added var to supported operations in to_agg_units. (PR/1498).
  • adapt_freq_thresh argument was added to sdba`` training functions, to facilitate performing frequency adaptation appropriately in each map block. (PR/1407).
  • Standardized indices (xclim.indices.standardized_precipitation_index and xclim.indices.standardized_precipitation_evapotranspiration_index) (GH/1270, GH/1416, GH/1474, PR/1311) were changed:
    • Optimized and noticeably faster calculation.
    • Can be computed in two steps: first compute fit parameters with xclim.indices.stats.standardized_index_fit_params, then use the output in the standardized indices functions.
    • The standardized index values are now clipped to ±8.21. This reflects the float64 precision of the computation when cumulative distributed function values are inverted to a normal distribution and avoids returning infinite values.
    • An offset parameter is now available to account for negative water balance valuesxclim.indices.standardized_precipitation_evapotranspiration_index.

Bug fixes

  • Fixed an error in the pytest configuration that prevented copying of testing data to thread-safe caches of workers under certain conditions (this should always occur). (PR/1473).
    • Coincidentally, this also fixes an error that caused pytest to error-out when invoked without an active internet connection. Running pytest without network access is now supported (requires cached testing data). (GH/1468).
  • Calling a sdba.map_blocks-wrapped function with data chunked along the reduced dimensions will raise an error. This forbids chunking the trained dataset along the distribution dimensions, for example. (GH/1481, PR/1482).
  • Optimization of indicators huglin_index and biologically_effective_degree_days when used with dask and flox. As a side effect, the indice functions (i.e. under xclim.indices) no longer mask incomplete periods. The indicators' output is unchanged under the default "check_missing" setting (GH/1494, PR/1495).
  • Fixed xclim.indices.run_length.lazy_indexing which would sometimes trigger the loading of auxiliary coordinates. (GH/1483, PR/1484).
  • Indicators snd_season_length and snw_season_length will return 0 instead of NaN if all inputs have a (non-NaN) zero snow depth (or water-equivalent thickness). (PR/1492, GH/1491)
  • Fixed a bug in the pytest configuration that could prevent testing data caching from occurring in systems where the platform-dependent cache directory is not found in the user's home. (GH/1468, PR/1473).
  • Fix xclim.core.dataflags.data_flags variable name generation (PR/1507).
  • Remove nonsensical stat='average' option for mean_radiant_temperature. (GH/1496, PR/1501).

Breaking changes

  • pytest-socket is now a required development dependency for running "offline" tests or the "offline" configuration of the tox testing suite. This has been added to the dev installation recipe. (GH/1468, PR/1473).
  • For better transparency and control in development, the tox configuration has been adapted to allow passing of markers directly to the pytest call. Positional arguments must be passed to tox after the -- separator to select/deselect tests (e.g. 'tox -e py38 -- -m "not slow"'). (PR/1473).
  • For better accuracy, the tox -e black recipe has been renamed to tox -e lint, as this configuration already included several other linting checks. (PR/1473).
  • xclim.indices.winter_storm renamed to xclim.indices.snd_storm_days. (PR/1505).
  • Default threshold in xclim.indices.snw_season_{start|length|end} changed form 20 kg m-2 to 4 kg m-2. (PR/1505).
  • xclim development dependencies now include ruff. pycodestyle and pydocstyle have been replaced by ruff and removed from the dev installation recipe. (PR/1504).
  • The mf_file call signature found in xclim.ensembles.create_ensemble (and xclim.ensembles._ens_align_dataset) has been removed (deprecated since xclim v0.43.0). (PR/1506).
  • xclim.indices.standardized_precipitation_index and xclim.indices.standardized_precipitation_evapotranspiration_index will no longer accept two datasets (data and calibration data). Instead, a single dataset covering both the calibration and evaluation periods is expected. (GH/1270, PR/1311).

Internal changes

  • Changed "degK" to "K" (used to designate Kelvin units). (PR/1475).
  • Added a pytest marker (pytest.mark.requires_internet) to allow for skipping of tests that depend on remote network calls to function properly. (PR/1473).
  • Added handling for pytest-socket's SocketBlockedError in xclim.testing.open_dataset when attempting to fetch md5 validation files for cached testing data while explicitly disabling internet sockets. (GH/1468, PR/1473).
  • Updated the testing data used in the analogs.ipynb notebook to use the testing data now found in Ouranosinc/xclim-testdata's main branch. (xclim-testdata PR/26 <https://github.com/Ouranosinc/xclim-testdata/pull/26>_, PR/1473).
  • Fixed an issue with automatic labelling that occurs when a Pull Request is made from a forked repository. (PR/1479).
  • Changes to the .zenodo.json file no longer are marked as CI-related changes. (PR/1479).
  • GitHub deployment workflows now employs use of deployment environments for workflow security and uses the Trusted Publisher feature to sign and publish the xclim wheel and source distributions. (PR/1469).
  • Mastodon publishing now uses chuhlomin/render-template <https://github.com/chuhlomin/render-template>_ and a standard formatting markdown document to format Mastodon toots. (PR/1469).
  • GitHub testing workflows now use Concurrency instead of the styfle/cancel-workflow-action to cancel redundant workflows. (PR/1487).
  • The pkg_resources library has been replaced for the packaging library when version comparisons have been performed, and a few warning messages have been silenced in the testing suite. (GH/1489, PR/1490).
  • New xclim.testing.helpers.assert_lazy context manager to assert the laziness of code blocks. (PR/1484).
  • Added a fix for the deprecation warnings that importlib.resources throws, made backwards-compatible for Python3.8 with importlib_resources backport. (PR/1485).
  • Added basic keywords on most indicators for easier searching in the docs. Extracted climate indicators API to its own page for faster loading. (PR/1502, GH/1433).
  • nbstripout now removes 'metadata.kernelspec' in notebook cells. (PR/1407).
  • Deprecation wrapper xclim.core.utils.deprecated are added to help with deprecation warnings. (PR/1505).
  • xclim now uses ruff to format the codebase with make lint and pre-commit. flake8 is still used for the time being, solely to enforce docstring linting (with flake8-rst-docstrings) and alphabetical __all__ entries (with flake8-alphabetize). (PR/1504).