Skip to content

Releases: Ouranosinc/xclim

v0.48.1

20 Feb 18:21
2a71714
Compare
Choose a tag to compare

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

Bug fixes

  • Fixed an issue with missing conda dependencies in the xclim documentation. (PR/1657).
  • Adjusted the Mastodon publishing workflow. (PR/1657).
  • Pinned nbconvert to address regressions when building the documentation. (PR/1658).

v0.48.0

19 Feb 20:26
7ca399b
Compare
Choose a tag to compare

Contributors to this version: Juliette Lavoie (@juliettelavoie), Pascal Bourgault (@aulemahal), Trevor James Smith (@Zeitsperre), David Huard (@huard), Éric Dupuis (@coxipi), Dante Castro (@profesorpaiche), Gabriel Rondeau-Genesse (@RondeauG).

Announcements

  • xclim no longer supports Python3.8. (GH/1268, PR/1565).
  • xclim now officially supports Python3.12 (requires numba>=0.59.0). (PR/1613).
  • xclim now adheres to the Semantic Versioning 2.0.0 <https://semver.org/>_ specification. (GH/1556, PR/1569).
  • The xclim repository now uses GitHub Discussions to offer help for users, coordinate translation efforts, and support general Q&A for the xclim community. The xclim Gitter room has been deprecated in favour of GitHub Discussions. (GH/1571, PR/1572).
  • For secure correspondence, xclim now offers a PGP key for users to encrypt sensitive communications. For more information, see the SECURITY.md. (GH/1181, PR/1604).

New features and enhancements

  • Added uncertainty partitioning method lafferty_sriver from Lafferty and Sriver (2023), which can partition uncertainty related to the downscaling method. (GH/1497, PR/1529).
  • Validate YAML indicators description before trying to build module. (GH/1523, GH/1595, PR/1560, PR/1596, PR/1600).
  • Support indexer keyword in YAML indicator description. (GH/1522, PR/1561).
  • New xclim.core.calendar.stack_periods and unstack_periods for performing rolling(time=...).construct(..., stride=...) but with non-uniform temporal periods like years or months. They replace xclim.sdba.processing.construct_moving_yearly_window and unpack_moving_yearly_window which are deprecated and will be removed in a future release.
  • New as_dataset options for xclim.set_options. When True, indicators will output Datasets instead of DataArrays. (GH/1257, PR/1625).
  • Added new option for universal_thermal_climate_index calculation (wind_cap_min: bool) to cap low wind velocities to a minimum of 0.5 m/s following Bröde (2012) guidelines. (GH/1634, PR/1635).
  • Added option never_reached to degree_days_exceedance_date to assign a custom value when the sum threshold is never reached. (GH/1459, PR/1647).
  • Added option min_members to ensemble statistics to mask elements when the number of valid members is under a threshold. (GH/1459, PR/1647).
  • Distribution instances can now be passed to the dist argument of most statistical indices. (PR/1644).
  • Added a new xclim.indices.generic.select_rolling_resample_op function to allow for computing rolling statistics. (GH/1480, PR/1643).
  • Add the possibility to use a group with a window in xc.sdba.processing.reordering. (PR/1566).

Breaking changes

  • xclim base Python version has been raised to Python3.9. Python3.9+ coding conventions are now supported. (GH/1268, PR/1565).
  • xclim base dependencies have been raised to pandas>=2.2.0 and xarray>=2023.11.0 to reflect changes to time frequency codes introduced in pandas==2.2.0. (GH/1534, PR/1565; see also: pydata/xarray GH/8394 <https://github.com/pydata/xarray/issues/8394>_ and ). Many default frequency string outputs have been modified (:
    • 'Y' (year) -> 'YE' (year end). (see: pandas PR/55792 <https://github.com/pandas-dev/pandas/pull/55792>_).
    • 'M' (month) -> 'ME' (month end). (see: pandas PR/52064 <https://github.com/pandas-dev/pandas/pull/52064>_).
    • 'Q' (quarter) -> 'QE' (quarter end). (see: pandas PR/55553 <https://github.com/pandas-dev/pandas/pull/55553>_)
    • 'A' and 'AS' have been removed (use 'YE' and 'YS' instead). (see: pandas PR/55252 <https://github.com/pandas-dev/pandas/pull/55252>_). ('YE' is only supported for cftime data in xarray >= 2024.1.1).
    • 'T' (minute), 'L' (millisecond), 'U' (microsecond), and 'N' (nanosecond) -> 'min', 'ms', 'us', and 'ns'. (see: pandas PR/54061 <https://github.com/pandas-dev/pandas/pull/54061>_).
  • bump2version has been replaced with bump-my-version to bump the version number using configurations set in the pyproject.toml file. (GH/1557, PR/1569).
  • xclim's units registry and units formatting are now extended from cf-xarray. The exponent sign "^" is now never added in the units attribute. For example, square meters are given as "m2" instead of "m^2" by xclim. Both signs are still accepted as inputs. (GH/1010, PR/1590).
  • yamale is now listed as a core dependency (was previously listed in the dev installation recipe). (GH/1595, PR/1596).
  • Due to a licensing limitation, the calculation of empirical orthogonal function based on eofs (xclim.sdba.properties.first_eof) has been removed from xclim. (GH/1620, PR/1621).
  • black formatting style has been updated to the 2024 stable conventions. isort has been added to the dev installation recipe. (PR/1626).
  • The indice and indicator for winter_storm has been removed (deprecated since xclim>=0.46.0 in favour of snd_storm_days). (PR/1565).
  • xclim has dropped support for scipy versions below v1.9.0 and numpy versions below v1.20.0. (PR/1565).
  • For generic function select_resample_op and core.units.to_agg_units, operation "sum" will now return the same units as the input, and not implicitly be translated to an "integral". (GH/1645, PR/1649).
  • lmoments3 was removed as a dependency of xclim due to incompatible licensing (GPLv3 vs xclim's Apache 2.0). Depending on the outcome of efforts to modify the licensing of lmoments3, this change may eventually be reverted. See Ouranosinc/lmoments3#12 <https://github.com/Ouranosinc/lmoments3/issues/12>_. See also the "frequency analysis" notebook for an example on how to continue using the probability weighted moments method for fitting distributions. (GH/1620, PR/1644).

Bug fixes

  • Fixed passing missing=0 to xclim.core.calendar.convert_calendar. (GH/1562, PR/1563).
  • Fixed wrong window attributes in xclim.indices.standardized_precipitation_index, xclim.indices.standardized_precipitation_evapotranspiration_index. (GH/1552 PR/1554).
  • Fixed the daily case freq='D' for xclim.stats.preprocess_standardized_index (GH/1602 PR/1607).
  • Several spelling mistakes have been corrected within the documentation and codebase. (PR/1576).
  • Added missing xclim.ensembles.robustness_fractions and xclim.ensembles.robustness_categories in API doc section. (PR/1630).
  • Fixed an issue that can occur when fetching the testing data and running tests on Windows systems. Adapted a few existing tests for Windows support. (PR/1648).

Internal changes

  • The flake8 configuration has been migrated from setup.cfg to .flake8; setup.cfg has been removed. ([PR/1569](#15...
Read more

v0.47.0

01 Dec 18:38
7c1ab16
Compare
Choose a tag to compare

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

Announcements

  • To circumvent issues stemming from changes to the frequency code convention in pandas v2.2, we have pinned xarray (< 2023.11.0) and pandas (< 2.2) for this release. This change will be reverted in xclim v0.48.0 to support the newer versions. (xarray>= 2023.11.0 and pandas>= 2.2).
  • xclim v0.47.0 will be the last release supporting Python3.8.

New features and enhancements

  • New functions xclim.ensembles.robustness_fractions and xclim.ensembles.robustness_categories. The former will replace xclim.ensembles.change_significance which is now deprecated and will be removed in xclim v0.49.0. (PR/1514).
  • Added indicator ID to searched terms in the indicator search documentation page. (GH/1525, PR/1528).

Bug fixes

  • Fixed a bug with n_escore=-1 in xclim.sdba.adjustment.NpdfTransform. (GH/1515, PR/1516).
  • In the documentation, fixed the tooltips in the indicator search results. (GH/1524, PR/1527).
  • If chunked inputs are passed to indicators mean_radiant_temperature and potential_evapotranspiration, sub-calculations of the solar angle will also use the same chunks, instead of a single one of the same size as the data. (GH/1536, PR/1542).
  • Fix wrong attributes in xclim.indices.standardized_precipitation_index, xclim.indices.standardized_precipitation_evapotranspiration_index. (GH/1537, PR/1538).

Internal changes

  • Pinned cf-xarray below v0.8.5 in Python3.8 installation to further extend legacy support. (PR/1519).
  • pip check in conda builds in GitHub workflows have been temporarily set to always pass. (PR/1531).
  • Configure RtD search rankings to emphasize notebooks and indicators over indices and raw source code. (PR/1526).
  • Addressed around 100 very basic mypy typing errors and call signature errors. (PR/1532).
  • Use the intermediate step _cumsum_reset_on_zero instead of rle which is sufficient in _boundary_run. (GH/1405, PR/1530).

v0.46.0

24 Oct 17:26
8664d50
Compare
Choose a tag to compare

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...
Read more

v0.45.0

05 Sep 19:35
f8c3abe
Compare
Choose a tag to compare

Contributors to this version: David Huard (@huard), Trevor James Smith (@Zeitsperre), Pascal Bourgault (@aulemahal), Juliette Lavoie (@juliettelavoie), Gabriel Rondeau-Genesse (@RondeauG), Marco Braun (@vindelico), Éric Dupuis (@coxipi).

Announcements

  • xclim now uses platformdirs to write xclim-testdata to the user's cache directory. Dynamic paths are now used to cache data dependent on the user's operating system. Developers can now safely delete the .xclim-testdata folder in their home directory without affecting the functionality of xclim. (PR/1460).

New indicators

  • Variations of already existing indices: xclim.indices.snd_max and xclim.indices.frost_free_spell_max_length. (PR/1443, GH/1386).

New features and enhancements

  • Added ensembles.hawkins_sutton method to partition the uncertainty sources in a climate projection ensemble. (GH/771, PR/1262), along with a notebook example. (PR/1466).
  • New function xclim.core.calendar.convert_doy to transform day-of-year data between calendars. Also accessible from convert_calendar with doy=True. (GH/1283, PR/1406).
  • New xclim.units.declare_relative_units to enable relative unit checks. This was applied to most "generic" indices. (PR/1414).
  • Added new function xclim.sdba.properties.std to calculate the standard deviation of a variable over all years at a given time resolution. (PR/1445).
  • Amended the documentation of xclim.sdba.properties.trend to document already existing functionality of calculating the return values of scipy.stats.linregress. (PR/1445).
  • Add support for setting optional variables through the ds argument. (GH/1432, PR/1435).
  • New xclim.core.calendar.is_offset_divisor to test if a given freq divides another one evenly (PR/1446).
  • Missing value objects now support input timeseries of quarterly and yearly frequencies (PR/1446).
  • Missing value checks enabled for all "generic" indicators (return_level, fit and stats) (PR/1446).

Bug fixes

  • Fix kldiv docstring so the math formula renders to HTML. (GH/1408, PR/1409).
  • Fix the registry entries of "generic" indicators. (GH/1423, PR/1424).
  • Fix jetstream_metric_woollings so it uses the vertical coordinate identified by cf-xarray, instead of pressure (GH/1421, PR/1422).
    • Add logic to handle coordinates in decreasing order, or for longitudes defined from 0-360 instead of -180 to 180. (GH/1429, PR/1430).
  • Fix virtual indicator attribute assignment, causing individual indicator's realm to be ignored. (GH/1425, PR/1426).
  • Fixes the raise_flags argument of xclim.core.dataflags.data_flags so that an Exception is only raised when some checkups fail. (GH/1456, PR/1457).
  • Fix xclim.indices.generic.get_zones so that bins can be given as input without error. (PR/1455).

Internal changes

  • Tolerance thresholds for error in test_stats::test_fit have been relaxed to allow for more variation in the results. Previously untested *_moving_yearly_window functions are now tested. (GH/1400, PR/1402).
  • Increased the guess of number of quantiles needed in ExtremeValues. (PR/1413).
  • Tolerance thresholds for error in test_processing::test_adapt_freq have been relaxed to allow for more variation in the results. (GH/1417, PR/1418).
  • Added "streamflow" to the list of known variables. (PR/1431).
  • Refactoring of index backend calculations. (PR/1443, GH/1386):
    • Use xclim.indices.generic.select_resample_op for {tg|tn|tx}_{max|mean|min}, max_1day_precipitation_amount, {snw|snd}_max
    • Directly use {cold|hot}_spell_max_length in maximum_consecutive_{frost|tx}_days
    • xclim.indices.generic.select_resample_op now gives an output with the correct units (xclim.core.units.to_agg_units is used internally).
  • Shuffle autogenerated documentation files into distinct folders that can be easily cleaned using Makefile. (PR/1449).
  • Some docstring adjustments to existing classes. (PR/1449).
  • The pre-commit dependency identify now associates Jupyter Notebooks as JSON files. pre-commit is now set to ignore JSON-formatting of notebooks. (PR/1449).
  • Added a helper module _finder in the notebooks folder so that the working directory can always be found, with redundancies in place to prevent scripts from failing if the helper file is not found. (PR/1449).
  • Added a manual cache-cleaning workflow (based on GitHub cache-cleaning example), triggered when a branch has been merged. (PR/1462).
  • Added a workflow for posting updates to the xclim Mastodon account (using cbrgm/mastodon-github-action), triggered when a new version is published. (PR/1462).
  • Refactor base indicator classes and fix misleading inheritance of return_level. (GH/1263, PR/1446).

Breaking changes

  • Fix and adapt percentile_doy for an error raised by xarray > 2023.7.0. (GH/1417, PR/1450).
  • integral replaces prod and delta_prod as possible input in xclim.core.units.to_agg_units (PR/1443, GH/1386).

v0.44.0

23 Jun 15:11
23c1aa7
Compare
Choose a tag to compare

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

Announcements

  • xclim: xarray-based climate data analytics has been published in the Journal of Open Source Software (DOI:10.21105/joss.05415). Users can now make use of the Cite this repository button in the sidebar for academic purposes. Many thanks to our core developers and user base for their fine contributions over the years! (GH/95, PR/250).
  • xclim now officially supports Python3.11. (PR/1388).

New indicators

  • Several new indices and indicators:
    • snowfall_{frequency | intensity} for calculating the {percentage of | mean snowfall intensity on} days with snowfall above a threshold. (GH/1352, PR/1358)
    • {sfcWind | sfcWindmax}_{max | mean | min} for calculating the {max | mean | min} daily {mean | max} wind speed. (GH/1352, PR/1358)
    • {precip | liquid_precip | solid_precip}_average} for calculating the mean daily {total precipitation | liquid precipitation | solid precipitation } amount. (GH/1352, PR/1358)
    • {cold | dry}_spell_max_length for calculating maximum length of {cold | dry} spell events. (GH/1352, PR/1359).
    • dry_spell_frequency for calculating total number of dry spells. (GH/1352, PR/1359).
    • hardiness_zones with supported methods "usda" (USA) and "anbg" (Australia) for calculating hardiness classifications from climatologies. (GH/1290, PR/1396).
  • New indicator late_frost_days for calculating the number of days where the daily minimum temperature is below a threshold over a given time period. (GH/1352, PR/1361).

New features and enhancements

  • xclim.sdba.processing.escore performance was improved with a faster runtime (PR/1360).
  • New generic function (flux_and_rate_converter) converting flux to a rate (and vice-versa) using a density. snw_to_snd and snd_to_snw were refactored using this function. (GH/1352, PR/1358)
  • New function (prsn_to_prsnd) to convert snowfall flux ([mass] / [area] / [time]) to snowfall rate ([length] / [time]) using snow density ([mass] / [volume]). (GH/1352, PR/1358)
  • New variables: Snowfall rate prsnd and surface maximum wind speed sfcWindmax. (GH/1352, PR/1358).
  • Docstring for freq links to pandas offset aliases documentation. (GH/1310, PR/1392).
  • New function xclim.indces.run_length.extract_events for determining runs whose starting and stopping points are defined through run length conditions. (PR/1256).
  • Stats functions frequency_analysis now takes method parameter to select other fitting methods such as PWM or MOM. (GH/1168, PR/1398).
  • xclim.indices.frost_days now accepts an **indexer parameter for calculating frost days over a temporal subset of the given dataset. (GH/1352, PR/1361).
  • New function xclim.indices.generic.get_zones attributing a histogram bin index (a zone) to each value in an input array. (GH/1290, PR/1396).

Bug fixes

  • Fixed a bug in xclim.core.calendar.time_bnds when using DataArrayResample objects, caused by an upstream change in xarray 2023.5.0. (GH/1368, PR/1377).
  • ensembles.change_significance will returns NaNs when the input values are all NaNs, instead of failing. (GH/1379, PR/1380).
  • Accelerated import of xclim by caching the compilation of guvectorize functions. (PR/1378).
  • Fixed many issues with xclim.indices.helpers.cosine_of_solar_zenith_angle, the signature changed. (GH/1110, PR/1399).

Internal changes

  • In order to ensure documentation can be rebuilt at a later time, errors raised by sphinx linkcheck are now set to be ignored when building the documentation. (PR/1375).
  • With the publication of xclim, the code repository now offers a CITATION.cff configuration for users to properly cite the software (APA formatted and raw BibTeX) for academic purposes. (GH/95, PR/250).
  • Logging messages emitted when redefining units via pint (caused by logging interactions with dependencies) have been silenced. (GH/1373, PR/1384).
  • Fixed some annotations and dev recipe dependencies issues to allow for the development of xclim inside a python3.11 environment. (GH/1376, PR/1381).
  • The deprecated mamba-org/provision-with-micromamba GitHub Action has been replaced with mamba-org/setup-micromamba. (PR/1388).
  • xclim GitHub CI workflows now run builds against Python3.11. (PR/1388).
  • In indices, verify that all parameters of type Quantified that have a default value have their dimension declared. (GH/1293, PR/1393).
  • Updated roy_extremeprecip_2021 to the newly published paper. (PR/1394).
  • Two new GitHub CI Actions have been added to the existing Workflows (PR/1390):
    • actions/add-to-project: Automatically adds issues to the xclim project.
    • saadmk11/github-actions-version-updater: Updates GitHub Action versions in all Workflows (triggered monthly).
  • Added method parameter to frequency_analysis and fa. (GH/1168, PR/1398).

Breaking changes

  • Signature of hot_spell_{frequency | max_length | total_length} : thresh_tasmax modified to thresh. (GH/1352, PR/1359).

v0.43.0

09 May 19:46
39efa10
Compare
Choose a tag to compare

Contributors to this version: Trevor James Smith (@Zeitsperre), Ludwig Lierhammer (@ludwiglierhammer), Pascal Bourgault (@aulemahal), Juliette Lavoie (@juliettelavoie), Alexis Beaupré (@Beauprel), Éric Dupuis (@coxipi).

Announcements

New features and enhancements

  • New xclim.sdba measure xclim.sdba.measures.taylordiagram. (PR/1360).

New indicators

  • ensembles.change_significance now supports the Brown-Forsythe test. (PR/1292).

Bug fixes

  • Fixed a bug in the pyproject.toml configuration that excluded the changelog (CHANGES.rst) from the packaged source distribution. (PR/1349).
  • When summing an all-NaN period with resample, xarray v2023.04.0 now returns NaN, whereas earlier versions returned 0. This broke fraction_over_precip_thresh, but is now fixed. (PR/1354, GH/1337).
  • In xclim.sdba's Quantile Delta Mapping algorithm, the quantiles of the simulation to adjust were computed slightly differently than when creating the adjustment factor. The xclim.sdba.utils.rank function has been fixed to return "percentage-ranks" (quantiles) in the proper range. (GH/1334, PR/1355).
  • The radiation converters (longwave_upwelling_radiation_from_net_downwelling and shortwave_upwelling_radiation_from_net_downwelling) were hard-coded to redefine output units as W m-2, regardless of input units, so long as unit dimensions checks cleared. Units are now set directly from inputs. (GH/1365, PR/1366).

Breaking changes

  • Many previously deprecated indices and indicators have been removed from xclim (PR/1318), with replacement indicators suggested as follows:
    • xclim.indicators.atmos.first_day_above -> xclim.indicators.atmos.first_day_{tn | tg | tx}_above
    • xclim.indicators.atmos.first_day_below -> xclim.indicators.atmos.first_day_{tn | tg | tx}_below
    • xclim.indicators.land.continuous_snow_cover_end -> xclim.indicators.land.snd_season_end
    • xclim.indicators.land.continuous_snow_cover_start -> xclim.indicators.land.snd_season_start
    • xclim.indicators.land.fit -> xclim.indicators.generic.fit
    • xclim.indicators.land.frequency_analysis -> xclim.indicators.generic.return_level
    • xclim.indicators.land.snow_cover_duration -> xclim.indicators.land.snd_season_length
    • xclim.indicators.land.stats -> xclim.indicators.generic.stats
    • xclim.indices.continuous_snow_cover_end -> xclim.indices.snd_season_end
    • xclim.indices.continuous_snow_cover_start -> xclim.indices.snd_season_start
    • xclim.indices.snow_cover_duration -> xclim.indices.snd_season_length
  • Several _private functions within xclim.indices.fire._cffwis that had been exposed publicly have now been rendered as hidden functions. Affected functions are: _day_length, _day_length_factor, _drought_code, _duff_moisture_code, _fine_fuel_moisture_code, _overwintering_drought_code. (PR/1159, PR/1369).

Internal changes

  • The testing suite has been adjusted to ensure calls are made to existing functions using non-deprecated syntax. The volume of warnings emitted during testing has been significantly reduced. (PR/1318).
  • In order to follow best practices and reduce the installed size of the xclim wheel, the tests folder containing the testing suite has been split from the package and placed in the top-level of the code repository. (GH/1348, PR/1349, suggested from PyOpenSci Software Review). Submodules that were previously called within xclim.testing.tests have been refactored as follows:
    • xclim.testing.tests.dataxclim.testing.helpers
    • xclim.testing.tests.test_sdba.utilsxclim.testing.sdba_utils
  • Added a "Conventions" section to the README. (GH/1342, PR/1351).
  • New helper function xclim.testing.helpers.test_timeseries for generating timeseries objects with specified variable names and units. (PR/1356).
  • tox recipes and documentation now refer to the official build of SBCK, available on PyPI. (GH/1362, PR/1364).
  • Excluded some URLs from sphinx linkcheck that were causing issues on ReadTheDocs. (PR/1364).
  • Tagged versions of xclim-testdata now follow a calendar-based versioning scheme for easier determination of compatibility between xclim and testing data. (PR/1367, xclim-testdata discussion).
  • flake8, pycodestyle, and pydocstyle checks have been significantly changed in order to clean up the code base of redundant # noqa markers. Linting checks for Makefile and tox recipes have been synchronized as well. (PR/1369).
  • flake8 plugin flake8-alphabetize has been added to development recipes in order to check order of __all__ entries and Exceptions. (PR/1369).
  • Corrected translations of cold_spell_{frequency | days} (PR/1372).

v0.42.0

03 Apr 22:37
cbb4371
Compare
Choose a tag to compare

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

Announcements

  • xclim now supports testing against tagged versions of Ouranosinc/xclim-testdata <https://github.com/Ouranosinc/xclim-testdata>_ in order to support older versions of xclim. For more information, see the Contributing Guide for more details. (PR/1339).
  • xclim v0.42.0 will be the last version to explicitly support Python3.8. (GH/1268, PR/1344).

New features and enhancements

  • Two previously private functions for selecting a day of year in a time series when performing calendar conversions are now exposed. (GH/1305, PR/1317). New functions are:
    • xclim.core.calendar.yearly_interpolated_doy
    • xclim.core.calendar.yearly_random_doy
  • scipy is no longer pinned below v1.9 and lmoments3>=1.0.5 is now a core dependency and installed by default with pip. (GH/1142, PR/1171).
  • Fix bug on number of bins in xclim.sdba.propeties.spatial_correlogram. (PR/1336)
  • Add resample_before_rl argument to control when resampling happens in maximum_consecutive_{frost|frost_free|dry|tx}_days and in heat indices (in _threshold) (GH/1329, PR/1331)
  • Add xclim.ensembles.make_criteria to help create inputs for the ensemble-reduction methods. (GH/1338, PR/1341).

Bug fixes

  • Warnings emitted from regular usage of some indices (snowfall_approximation with method="brown", effective_growing_degree_days) due to successive convert_units_to calls within their logic have been silenced. (PR/1319).
  • Fixed a bug that prevented the use of the sdba_encode_cf option with xarray 2023.3.0 (PR/1333).
  • Fixed bugs in xclim.core.missing and xclim.sdba.base.Grouper when using pandas 2.0. (PR/1344).

Breaking changes

  • The call signatures for xclim.ensembles.create_ensemble and xclim.ensembles._base._ens_align_dataset have been deprecated. Calls to these functions made with the original signature will emit warnings. Changes will become breaking in xclim>=0.43.0.(GH/1305, PR/1317). Affected variable:
    • mf_flag (bool) -> multifile (bool)
  • The indice and indicator for last_spring_frost has been modified to use tasmin by default, reflecting its docstring and literature definition (GH/1324, PR/1325).
  • following indices now accept the op argument for modifying the threshold comparison operator (PR/1325):
    • snw_season_length, snd_season_length, growing_season_length, frost_season_length, frost_free_season_length, rprcptot, daily_pr_intensity
  • In order to support older environments, pandas is now conditionally pinned below v2.0 when installing xclim on systems running Python3.8. (PR/1344).

Bug fixes

  • xclim.indices.run_length.last_run nows works when freq is not None. (GH/1321, PR/1323).

Internal changes

  • Added xclim to the ouranos Zenodo community . (PR/1313).
  • Significant documentation adjustments. (GH/1305, PR/1308):
    • The CONTRIBUTING page has been moved to the top level of the repository.
    • Information concerning the licensing of xclim is clearly indicated in README.
    • sphinx-autodoc-typehints is now used to simplify call signatures generated in documentation.
    • The SDBA module API is now found with the rest of the User API documentation.
    • HISTORY.rst has been renamed CHANGES.rst, to follow dask-like conventions.
    • Hyperlink targets for individual indices and indicators now point to their entries under API or Indices.
    • Module-level docstrings have migrated from the library scripts directly into the documentation RestructuredText files.
    • The documentation now includes a page explaining the reasons for developing xclim and a section briefly detailing similar and related projects.
    • Markdown explanations in some Jupyter Notebooks have been edited for clarity
  • Removed Mapping abstract base class types in call signatures (dict variables were always expected). (PR/1308).
  • Changes in testing setup now prevent test_mean_radiant_temperature from sometimes causing a segmentation fault. (GH/1303, PR/1315).
  • Addressed a formatting bug that caused Indicators with multiple variables returned to not be properly formatted in the documentation. (GH/1305, PR/1317).
  • tox now include sbck and eofs flags for easier testing of dependencies. CI builds now test against sbck-python @ master. (PR/1328).
  • upstream CI tests are now run on push to master, at midnight, and can also be triggered via workflow_dispatch. Failures from upstream build will open issues using xarray-contrib/issue-from-pytest-log. (PR/1327).
  • Warnings from set _version_deprecated within Indicators now emit FutureWarning instead of DeprecationWarning for greater visibility. (PR/1319).
  • The Graphics section of the Usage notebook has been expanded upon while grammar and spelling mistakes within the notebook-generated documentation have been reduced. (GH/1335, PR/1338, suggested from PyOpenSci Software Review).
  • The Contributing guide now lists three separate subsections to help users understand the gains from optional dependencies. (GH/1335, PR/1338, suggested from PyOpenSci Software Review).

v0.41.0

28 Feb 16:38
edeaa91
Compare
Choose a tag to compare

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

New features and enhancements

  • New properties xclim.sdba.properties.decorrelation_length and xclim.sdba.properties.transition_probability. (PR/1252)

New indicators

  • ensembles.change_significance now supports Mann-whitney U-test and flexible realization. (PR/1285).
  • New indices and indicators for converting from snow water equivalent to snow depth (snw_to_snd) and snow depth to snow water equivalent (snd_to_snw) using snow density [kg / m^3]. (PR/1271).
  • New indices and indicators for determining upwelling radiation (shortwave_upwelling_radiation_from_net_downwelling and longwave_upwelling_radiation_from_net_downwelling; CF variables rsus and rlus) from net and downwelling radiation (shortwave: rss and rsds; longwave: rls and rlds). (PR/1271).
  • New indice and indicator {snd | snw}_season_{length | start | end} which generalize snow_cover_duration and continuous_snow_cover_{start | end} to allow using these functions with variable snw (PR/1275).
  • New indice and indicator (dryness_index) for estimating soil humidity classifications for winegrowing regions (based on Riou et al. (1994)). (GH/355, PR/1235).

Breaking changes

  • xclim testing default behaviours have been changed (GH/1295, PR/1297):
    • Running $ pytest will no longer use pytest-xdist distributed testing be default (can be set with -n auto|logical|#. Coverage is also no longer gathered/reported by default.
    • Running $ tox will now set pytest-xdist to use -n logical processes (with a max of 10).
    • Default behaviour for testing is to no longer always fetch xclim-testdata. If testdata is found in $HOME/.xclim_testing_data, files will be copied to individual processes, otherwise, will be fetched as needed.
  • Environment variables evaluated when running pytest have been changed (GH/1295, PR/1297):
    • For testing against specific branches of xclim-testdata: MAIN_TESTDATA_BRANCH -> XCLIM_TESTDATA_BRANCH
    • The option to skip fetching of testdata (SKIP_TEST_DATA) has been removed
    • A new environment variable (XCLIM_PREFETCH_TESTING_DATA) is now available to gather xclim-testdata before running test ensemble (default: False).
    • Environment variables are now passed to tox on execution.

Bug fixes

  • build_indicator_module_from_yaml now accepts a reload argument. When re-building a module that already exists, reload=True removes all previous indicator before creating the new ones. (GH/1192, PR/1284).
  • The test for French translations of official indicators was fixed and translations for CFFWIS indices, FFDI, KDBI, DF and Jetstream metric woollings have been added or fixed. (PR/1271).
  • use_ufunc in windowed_run_count is now supplied with argument freq to warn users that the 1d method does not support resampling after run length operations (GH/1279, PR/1291).
  • {snd | snw}_max_doy now avoids an error due to xr.argmax when there are all-NaN slices. (PR/1277).

Internal changes

  • xclim has adopted PEP 517 and PEP 621 (pyproject.toml using the flit backend) to replace the legacy setup.py used to manage package organisation and building. Many tooling configurations that already supported the pyproject.toml standard have been migrated to this file. CI and development tooling documentation has been updated to reflect these changes. (PR/1278, suggested from PyOpenSci Software Review).
  • Documentation source files have been moved around to remove some duplicated image files. (PR/1278).
  • Coveralls GitHub Action removed as it did not support pyproject.toml-based configurations. (PR/1278).
  • Add a remark about how xclim's CFFWIS is different from the original 1982 implementation. (GH/1104, PR/1284).
  • Update CI runs to use Python3.9 when examining upstream dependencies. Replace setup-conda action with provision-with-micromamba action. (PR/1286).
  • Update CI runs to always use tox~=4.0 and the latest virtual machine images (now ubuntu-22.04). (PR/1288, PR/1297).
  • SBCK installation command now points to the official development repository. (PR/1288).
  • Some references in the BibTeX were updated to point to better resources. (PR/1288).
  • Add a GitHub CI workflow for performing dependency security review scanning. (PR/1287).
  • Grammar and spelling corrections were applied to some docstrings. (PR/1271).
  • Added [radiation] ([power] / [area]) to list of defined acceptable units. (PR/1271).
  • Updated testing data used to generate the atmosds dataset to use more reproducibly-converted ERA5 data, generated with the miranda Python package. (PR/1269).
  • Updated testing dependencies to use pytest-xdist>=3.2, allowing for the new --dist=worksteal scheduler for distributing the pool of remaining tests across workers after individual workers have exhausted their own queues. (PR/1235).
  • Adding infer context to the unit conversion in of the training of ExtremeValues. (PR/1299).
  • Added sphinxcontrib-svg2pdfconverter for converting SVG graphics within documentation to PDF-compatible images. (PR/1296).
  • README badges for supported Python versions and repository health have been added. (GH/1304, PR/1307).

v0.40.0

13 Jan 21:56
Compare
Choose a tag to compare

History

0.40.0 (2023-01-13)

Contributors to this version: Trevor James Smith (@Zeitsperre), Pascal Bourgault (@aulemahal), David Huard (@huard), Juliette Lavoie (@juliettelavoie).

New features and enhancements

  • Virtual modules can add variables to xclim.core.utils.VARIABLES through the new variables section of the yaml files. (GH/1129, PR/1231).
  • xclim.core.units.convert_units_to can now perform automatic conversions based on the standard name of the input when needed. (GH/1205, PR/1206).
    • Conversion from amount (thickness) to flux (rate), using amount2rate and rate2amount.
    • Conversion from amount to thickness for liquid water quantities, using the new amount2lwethickness and lwethickness2amount. This is similar to the implicit transformations enabled by the "hydro" unit context.
    • Passing context='infer' will activate the "hydro" context if the source or the target are DataArrays with a standard name that is compatible, as decided by the new xclim.core.units.infer_context function.
  • New generic indicator realm. Now holds indicators previously meant for streamflow analysis in the land realm: fit, return_level (previously freq_analysis) and stats. (GH/1130, PR/1225).
  • Thresholds and other quantities passed as parameters of indicators can now be multi-dimensional DataArrays. xarray broadcasting mechanisms will apply. These parameters are now annotated as "Quantity" in the signatures (xclim.core.utils.Quantity), instead of "str" as before. Attributes where such thresholds where included will now read "" (french: "") for these new cases. Multi-dimensional quantities are still largely unsupported, except where documented in the docstring. (GH/1093, PR/1236).

Breaking changes

  • Rewrite of xclim.core.calendar.time_bnds. It should now be more resilient and versatile, but all cftime_* and cfindex_* functions were removed. (GH/74, PR/1207).
  • hydro context is not always enabled, as it led to unwanted unit conversions. Unit conversion operations now need to explicitly declare the hydro context to support conversions from kg / m2 /s to mm/day. (GH/1208, PR/1227).
  • Many previously deprecated indices and indicators have been removed from xclim (PR/1228), with replacement indices/indicators suggested as follows:
    • xclim.indicators.atmos.fire_weather_indexesxclim.indicators.atmos.cffwis_indices
    • xclim.indices.freshet_startxclim.indices.first_day_temperature_above
    • xclim.indices.first_day_abovexclim.indices.first_day_temperature_above
    • xclim.indices.first_day_belowxclim.indices.first_day_temperature_below
    • xclim.indices.tropical_nightsxclim.indices.tn_days_above
    • xclim.indices.generic.degree_daysxclim.indices.generic.cumulative_difference
  • The following modules have been removed (PR/1228):
    • xclim.indices.fwi → functions migrated to xclim.indices.fire
    • xclim.subset (mock submodule) → functions migrated to clisops.core.subset
  • Indicators standardized_precipitation_index and standardized_precipitation_evapotranspiration_index will now require pr_cal and wb_cal as keyword arguments only. (PR/1236).
  • The internal object PercentileDataArray has been removed. (PR/1236).
  • The xclim.testing.utils.get_all_CMIP6_variables and xclim.testing.utils.update_variable_yaml function were removed as the former was extremely slow and unusable. (PR/1258).
  • The wind speed input of atmos.potential_evapotranspiration and atmos.water_budget was renamed to sfcWind (capital W) as this is the correct CMIP6 name. (PR/1258).
  • Indicator land.stats, land.fit and land.freq_analysis are now deprecated and will be removed in version 0.43. They are being phased out in favor of generic indicators generic.stats, generic.fit and generic.return_level respectively. (GH/1130, PR/1225).

Bug fixes

  • The weighted ensemble statistics are now performed within a context in order to preserve data attributes. (GH/1232, PR/1234).
  • The make docs Makefile recipe was failing with an esoteric error. This has been resolved by splitting the linkcheck and docs steps into separate actions. (GH/1248. PR/1251).
  • The setup step for pytest needed to be addressed due to the fact that files were being accessed/modified by multiple tests at a time, causing segmentation faults in some tests. This has been resolved by splitting functions into those that fetch or generate test data (under xclim.testing.tests.data) and the fixtures that supply accessors to them (under xclim.testing.tests.conftest). (GH/1238, PR/1254).
  • Relaxed the expected output for test_spatial_analogs[friedman_rafsky] to support expected results from scikit-learn 1.2.0.
  • The MBCn example in documentation has been fixed to properly imitate the source. (GH/1249, PR/1250).
  • Streamflow indicators relying on indices defined in xclim.indices.stats were not checking input variable units. These indicators will now raise an error if input data units are not m^3/s. (GH/1130, PR/1225).
  • Adjusted some documentation examples were not being rendered properly. (GH/1264, PR/1266).

Internal changes

  • Minor adjustments to GitHub Actions workflows (newest Ubuntu images, updated actions version, better CI triggering). (PR/1221).
  • Pint units context added to various operations, tests and Indicator attributes. (GH/1208, PR/1227).
  • Updated article from Alavoine & Grenier (2022) within documentation. Many article reference URLs have been updated to use HTTPS where possible. (GH/1246, PR/1247).
  • Added relevant variable dataflag checks for potential evaporation, convective precipitation, and air pressure at sea level. (PR/1241).
  • Documentation restructured to include ReadMe page (as About) with some minor changes to documentation titles. (PR/1233).
  • xclim development build now uses nbqa to effectively run black checks over notebook cells. (PR/1233).
  • Some tox recipes (opt-slow, conda) are temporarily deactivated until a tox>=4.0-compatible tox-conda plugin is released. (PR/1258).
  • A notebook (extendingxclim.ipynb) has been updated to remove mentions of obsolete xclim.subset module. (PR/1258).
  • Merge of sdba documentation from the module and the rst files, some cleanup and addition of a section refering to github issues. (PR/1230).