v0.40.0
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 newvariables
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
andrate2amount
. - Conversion from amount to thickness for liquid water quantities, using the new
amount2lwethickness
andlwethickness2amount
. 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 newxclim.core.units.infer_context
function.
- Conversion from amount (thickness) to flux (rate), using
- New
generic
indicator realm. Now holds indicators previously meant for streamflow analysis in theland
realm:fit
,return_level
(previouslyfreq_analysis
) andstats
. (GH/1130, PR/1225). - Thresholds and other quantities passed as parameters of indicators can now be multi-dimensional
DataArray
s.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 allcftime_*
andcfindex_*
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 thehydro
context to support conversions fromkg / m2 /s
tomm/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_indexes
→xclim.indicators.atmos.cffwis_indices
xclim.indices.freshet_start
→xclim.indices.first_day_temperature_above
xclim.indices.first_day_above
→xclim.indices.first_day_temperature_above
xclim.indices.first_day_below
→xclim.indices.first_day_temperature_below
xclim.indices.tropical_nights
→xclim.indices.tn_days_above
xclim.indices.generic.degree_days
→xclim.indices.generic.cumulative_difference
- The following modules have been removed (PR/1228):
xclim.indices.fwi
→ functions migrated toxclim.indices.fire
xclim.subset
(mock submodule) → functions migrated toclisops.core.subset
- Indicators
standardized_precipitation_index
andstandardized_precipitation_evapotranspiration_index
will now requirepr_cal
andwb_cal
as keyword arguments only. (PR/1236). - The internal object
PercentileDataArray
has been removed. (PR/1236). - The
xclim.testing.utils.get_all_CMIP6_variables
andxclim.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
andatmos.water_budget
was renamed tosfcWind
(capital W) as this is the correct CMIP6 name. (PR/1258). - Indicator
land.stats
,land.fit
andland.freq_analysis
are now deprecated and will be removed in version 0.43. They are being phased out in favor of generic indicatorsgeneric.stats
,generic.fit
andgeneric.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 thelinkcheck
anddocs
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 (underxclim.testing.tests.data
) and the fixtures that supply accessors to them (underxclim.testing.tests.conftest
). (GH/1238, PR/1254). - Relaxed the expected output for
test_spatial_analogs[friedman_rafsky]
to support expected results fromscikit-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 andIndicator
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 (asAbout
) with some minor changes to documentation titles. (PR/1233). xclim
development build now usesnbqa
to effectively run black checks over notebook cells. (PR/1233).- Some
tox
recipes (opt-slow
,conda
) are temporarily deactivated until atox>=4.0
-compatibletox-conda
plugin is released. (PR/1258). - A notebook (
extendingxclim.ipynb
) has been updated to remove mentions of obsoletexclim.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).