v0.46.0
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 withxclim.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 fromxclim-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 forUpdating 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 ofxclim-testdata
to be present in the user's home cache directory and for certainpytest
options and markers to be set when invoked. For more information, see the contributing documentation section forRunning Tests in Offline Mode
. (GH/1468, PR/1473). - The
SKIP_NOTEBOOKS
flag to speed up docs builds is now documented. See the contributing documentation sectionGet 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 onlydaily
). (PR/1498). - Added argument
"out_units"
toselect_resample_op
to bypass limitations ofto_agg_units
in custom indicators. Also, addedvar
to supported operations into_agg_units
. (PR/1498). adapt_freq_thresh
argument was addedto
sdba`` training functions, to facilitate performing frequency adaptation appropriately in each map block. (PR/1407).- Standardized indices (
xclim.indices.standardized_precipitation_index
andxclim.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 values
xclim.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. Runningpytest
without network access is now supported (requires cached testing data). (GH/1468).
- Coincidentally, this also fixes an error that caused
- 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
andbiologically_effective_degree_days
when used withdask
andflox
. As a side effect, the indice functions (i.e. underxclim.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
andsnw_season_length
will return0
instead ofNaN
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 formean_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 thetox
testing suite. This has been added to thedev
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 thepytest
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 totox -e lint
, as this configuration already included several other linting checks. (PR/1473). xclim.indices.winter_storm
renamed toxclim.indices.snd_storm_days
. (PR/1505).- Default threshold in
xclim.indices.snw_season_{start|length|end}
changed form20 kg m-2
to4 kg m-2
. (PR/1505). xclim
development dependencies now includeruff
.pycodestyle
andpydocstyle
have been replaced byruff
and removed from thedev
installation recipe. (PR/1504).- The
mf_file
call signature found inxclim.ensembles.create_ensemble
(andxclim.ensembles._ens_align_dataset
) has been removed (deprecated sincexclim
v0.43.0). (PR/1506). xclim.indices.standardized_precipitation_index
andxclim.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
'sSocketBlockedError
inxclim.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 inOuranosinc/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 thepackaging
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 withimportlib_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 usesruff
to format the codebase withmake lint
andpre-commit
.flake8
is still used for the time being, solely to enforce docstring linting (withflake8-rst-docstrings
) and alphabetical__all__
entries (withflake8-alphabetize
). (PR/1504).