Releases: Ouranosinc/xclim
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).
v0.39.0
Contributors to this version: Trevor James Smith (@Zeitsperre), Abel Aoun (@bzah), Éric Dupuis (@coxipi), Travis Logan (@tlogan2000), Pascal Bourgault (@aulemahal).
New features and enhancements
- The general
xclim
description and ReadMe have been updated to reflect recent enhancements. (GH/1185, PR/1209). - Documentation now supports intersphinx mapping references within code examples via
sphinx-codeautolink
and copying of code blocks viasphinx-copybutton
. (PR/1182). - Log-logistic distribution added to
stats.py
for use withstandardized_precipitation_index
andstandardized_precipitation_evapotranspiration_index
. (GH/1141, PR/1183). - New option in many indices allowing for resampling in given periods after
run_length
operations. (GH/505, GH/916, GH/917, PR/1161). - New base indicator class for sdba:
StatisticalPropertyMeasure
, those measures that also reduce the time (as a property does). (PR/1198). xclim.core.calendar.common_calendar
to find the best calendar to use when uniformizing an heterogeneous collection of data. (PR/1217).xclim.ensembles.create_ensemble
now acceptscalendar=None
, and uses the above function to guess the best one. It also now acceptscal_kwargs
to fine tune the calendar conversion. (GH/1190, PR/1217).- New data check :
xclim.core.datachecks.check_common_time
that ensures all inputs of multivariate indicators have the same frequency (and the same time anchoring for daily and hourly data). (GH/1111, PR/1217).
New indicators
- New indices
first_day_temperature_{above | below}
and indicatorsxclim.indices.first_day_{tn | tg | tx}_{above | below}
. These indices/indicators accept operator (op
) keyword for finer threshold comparison controls. (GH/1175, PR/1186). - New generic indice
cumulative_difference
for calculating difference between values and thresholds across time (e.g. temperature: degree-days, precipitation: moisture deficit), with or without resampling/accumulating by frequency. (PR/1202). - New spatial sdba properties and measures :
spatial_correlogram
,scorr
andfirst_eof
. The later needs the optional dependency eofs. (PR/1198).
Breaking changes
- Indices that accept
lat
orlon
coordinates in their call signatures will now usecf-xarray
accessors to gather these variables in the event that they are not explicitly supplied. (PR/1180). This affects the following:huglin_index
,biologically_effective_degree_days
,cool_night_index
,latitude_temperature_index
,water_budget
,potential_evapotranspiration
cool_night_index
now optionally acceptslat: str = "north" | "south"
for calculating CNI over DataArrays lacking a latitude coordinate. (PR/1180).- The offset value in
standardized_precipitation_evapotranspiration_index
is changed to better reproduce results in the reference librarymonocongo/climate_indices
. (GH/1141, PR/1183). - The
first_day_below
andfirst_day_above
indices are now deprecated in order to clearly communicate the variables they act upon (GH/1175, PR/1186). The suggested migrations are as follows:xclim.indices.first_day_above
->xclim.indices.first_day_temperature_above
xclim.indices.first_day_below
->xclim.indices.first_day_temperature_below
- The
first_day_below
andfirst_day_above
atmos indicators are now deprecated in order to clearly communicate the variables they act upon (GH/1175, PR/1186). The suggested migrations are as follows:xclim.atmos.first_day_above
->xclim.indices.first_day_{tn | tg | tx}_above
xclim.atmos.first_day_below
->xclim.indices.first_day_{tn | tg | tx}_below
- The
degree_days
generic indice has been deprecated in favour ofcumulative_difference
that is not limited only to temperature variables (GH/1200, PR/1202). The indices foratmos.{heating | cooling | growing}_degree_days
are now built fromgeneric.cumulative_difference
. - Running
pytest
now requires thepytest-xdist
distributed testing dependency. This library has been added to thedev
requirements and conda environment configuration. (PR/1203). - Parameters
reducer
andwindow
inxclim.indices.rle_statistics
are now positional. (PR/1161). - The
relative_annual_cycle_amplitude
andannual_cycle_amplitude
have been rewritten to match the version defined in the VALUE project, outputs will change drastically (for the better) (PR/1198). - English indicator metadata has been adjusted to remove frequencies from fields in the
long_name
of indicators. English indicators now have an explicittitle
andabstract
. (GH/936, PR/1123). - French indicator metadata translations are now more uniform and more closely follow agreed-upon grammar conventions, while also removing frequency fields in
long_name_fr
. (GH/936, PR/1123). - The
freshet_start
indice is now deprecated in favour offirst_day_temperature_above
withthresh='0 degC', window=5
. Thefreshet_start
indicator is now based onfirst_day_temperature_above
, but is otherwise unaffected. (GH/1195, PR/1196). - Call signatures for several indices/indicators have been modified to optionally accept
op
for manually setting threshold comparison operators (GH/1194, PR/1197). The affected indices and indicators as follows:hot_spell_max_length
,hot_spell_frequency
,cold_spell_days
,cold_spell_frequency
,heat_wave_index
,warm_day_frequency
(indice only),warm_night_frequency
(indice only),dry_days
,wetdays
,wetdays_prop
.
- Cleaner
xclim.core.calendar.parse_offset
: fails on invalid frequencies, return implicit anchors (YS -> JAN, Y -> DEC) and implicitis_start_anchored
(D -> True). (GH/1213, , PR/1217).
Bug fixes
- The docstring of
cool_night_index
suggested thatlat
was an optional parameter. This has been corrected. (GH/1179, PR/1180). - The
mean_radiant_temperature
indice was accessing hardcodedlat
andlon
coordinates from passed DataArrays. This now usescf-xarray
accessors. (PR/1180). - Adopt (and adapt) unit registry declaration and preprocessors from
cf-xarray
to circumvent bugs caused by a refactor inpint
0.20. It also cleans the code a little bit. (GH/1211, PR/1212).
Internal changes
- The documentation build now relies on
sphinx-codeautolink
andsphinx-copybutton
. (PR/1182). - Many docstrings did not fully adhere to the numpy docstring format. Fields and entries for many classes and functions have been adjusted to adhere better. (PR/1182).
- The xdoctest namespace now provides access to session-scoped
{variable}_dataset
accessors, as well as apath_to_atmos_file
object. These can be used for running doctests on all variables made in the pytestatmosds()
fixture. (PR/1882). - Upgrade CodeQL GitHub Action to v2. (GH/1188, PR/1189).
- New generic index
first_day_threshold_reached
is now used to compose allfirst_day_XYZ
indices. (GH/1175, [PR/1186](https://github.com/Ouranosinc...
v0.38.0
Contributors to this version: Pascal Bourgault (@aulemahal), Éric Dupuis (@coxipi), Trevor James Smith (@Zeitsperre), Abel Aoun (@bzah), Gabriel Rondeau-Genesse (@RondeauG), Dougie Squire (@dougiesquire).
New features and enhancements
- Adjustment methods of SBCK are wrapped into xclim when that package is installed. (GH/1109, PR/1115).
- Wrapped SBCK tests are also properly run in the tox testing ensemble. (PR/1119).
- Method
FAO_PM98
(based on Penman-Monteith formula) to compute potential evapotranspiration. (PR/1122). - New indices for droughts: SPI (standardized precipitations) and SPEI (standardized water budgets). (GH/131, PR/1096).
- Most numba functions of
sdba.nbutils
now use the "lazy" compilation mode. This significantly accelerates the import time of xclim. (GH/1135, PR/1167). - Statistical properties and measures from
xclim.sdba
are nowIndicator
subclasses (PR/1149).
New indicators
xclim
now has the McArthur Forest Fire Danger Index and related indices under a newxclim.indices.fire
module. These indices are also available as indicators. (GH/1152, PR/1159)- Drought-related indicators: SPI (standardized precipitations) and SPEI (standardized water budgets). (GH/131, PR/1096).
ensembles.create_ensembles
now accepts arealizations
argument to assign a coordinate to the "realization" axis. It also accepts a dictionary as input so that keys are used as that coordinate. (PR/1153).ensembles.ensemble_percentiles
,ensembles.ensemble_mean_std_max_min
andensembles.change_significance
now support weights (PR/1151).- Many generic indicators that compare arrays or against thresholds or now accept an
op
keyword for specifying the logical comparison operation to use in their calculations (i.e.{">", ">=", "<", "<=, "!=", "=="}
). (GH/389, PR/1157).- In order to prevent user error, many of these generic indices now have a
constrain
variable that prevents calling an indice with an inappropriate comparison operator. (e.g. The following will raise an error:op=">", constrain=("<", "<=")
). This behaviour has been added to indices acceptingop
where appropriate.
- In order to prevent user error, many of these generic indices now have a
Breaking changes
scipy
has been pinned below version 1.9 untillmoments3
can be adapted to the new API. (GH/1142, PR/1143).xclim
now requiresxarray>=2022.06.0
. (PR/1151).- Documentation CI (ReadTheDocs) builds will now fail if there are any misconfigured pages, internal link/reference warnings, or broken external hyperlinks. (GH/1094, PR/1131, GH/1139, PR/1140, PR/1160).
- Call signatures for generic indices have been reordered and/or modified to accept
op
, and optionallyconstrain
, in many cases, andcondition
/conditional
/operation
has been renamed toop
for consistency. (GH/389, PR/1157). The affected indices are as follows:get_op
,compare
,threshold_count
,get_daily_events
,count_level_crossings
,count_occurrences
,first_occurrence
,last_occurrence
,spell_length
,thresholded_statistics
,temperature_sum
,degree_days
.
- All indices in
xclim.indices.generic
now usethreshold
in lieu ofthresh
for consistency. (PR/1157). - Existing function
xclim.indices.generic.compare
can now be used to construct operations withop
andconstrain
variables to allow for dynamic comparisons with user input handling. (GH/389, PR/1157). - Two deprecated indices have been removed from
xclim
. (PR/1157):xclim.indices._multivariate.daily_freezethaw_cycles
-> Replaceable with the genericmultiday_temperature_swing
withthresh_tasmax='0 degC'
,thresh_tasmin='0 degC'
,window=1
, andop='sum'
. The indicator version (xclim.atmos.daily_freezethaw_cycles
) is unaffected.xclim.indices.generic.select_time
-> Was previously moved toxclim.core.calendar
.
- The
clix-meta
indicator table parsing function (xclim.core.utils.adapt_clix_meta_yaml
) has been adapted to support the new "op" operator handler. (PR/1157). - Because they have been re-implemented as
Indicator
subclasses, statistical properties and measures ofxclim.sdba
no longer preserve attributes of their inputs by default. Usexclim.set_options(keep_attrs=True)
to get the previous behaviour. (PR/1149). - The
xclim.indices.generic.extreme_temperature_range
function has been fixed so it now does what its definition says. Results fromxclim.indicators.cf.etr
will change. (GH/1172, PR/1173). xclim
now has a dedicatedindices.fire
submodule that houses all fire-related indices. The previousxclim.indices.fwi
submodule is deprecated and will be removed in a future version. (GH/1152, PR/1159).- The indicator
xclim.indicators.atmos.fire_weather_indexes
and indicexclim.indices.fire_weather_indexes
have both been deprecated and renamed tocffwis_indices
. Calls using the previous naming will be removed in a future version. (PR/1159). xclim
now explicitly requirespybtex
in order to generate documentation. (PR/1176).
Bug fixes
- Fixed
saturation_vapor_pressure
for temperatures in other units than Kelvins (also fixesrelative_humidity_from_dewpoint
). (GH/1125, PR/1127). - Indicators that do not care about the input frequency of the data will not check the cell methods of their inputs. (PR/1128).
- Fixed the signature and docstring of
heat_index
by changingtasmax
totas
. (GH/1126, PR/1128). - Fixed a formatting issue with virtual indicator modules (
_gen_returns_section
) that was creating malformedReturns
sections insphinx
-generated documentation. (PR/1131). - Fix
biological_effective_degree_days
for non-scalar latitudes, when using method "gladstones". (GH/1136, PR/1137). - Fixed some
extlink
warnings found insphinx
and configured ReadTheDocs to usemamba
as the dependency solver. (GH/1139, PR/1140). - Fixed some broken hyperlinks to articles, users, and external documentation throughout the code base and jupyter notebooks. (PR/1160).
- Removed some artefact reference roles introduced in PR/1131 that were causing LaTeX builds of the documentation to fail. (GH/1154, PR/1156).
- Fix
biological_effective_degree_days
for non-scalar latitudes, when using method "gladstones". (GH/1136, PR/1137). - Fixed some
extlink
warnings found insphinx
and configured ReadTheDocs to usemamba
as the dependency solver. (GH/1139, PR/1140). - Fixed some broken hyperlinks to articles, users, and external documentation throughout the code base and jupyter notebooks. (PR/1160).
- Addressed a bug that was causing
pylint
to stackoverflow by removing it from the tox configuration.pylint
should only be called from an active environment. (PR/1163) - Fixed kmeans_reduce_ensemble breaking when using dask arrays ([PR/1170](ht...
v0.37.0
Contributors to this version: Abel Aoun (@bzah), Pascal Bourgault (@aulemahal), Trevor James Smith (@Zeitsperre), Gabriel Rondeau-Genesse (@RondeauG), Juliette Lavoie (@juliettelavoie), Ludwig Lierhammer (@ludwiglierhammer).
Announcements
xclim
is now compliant with PEP 563. Python3.10-style annotations are now permitted. (GH/1065, PR/1071).xclim
is now fully compatible withxarray
'sflox
-enabledGroupBy
andresample
operations. (PR/1081).xclim
now (properly) enforces docstring compliance checks usingpydocstyle
with modifiednumpy
-style docstrings. Docstring errors will now cause build failures. See the pydocstyle documentation for more information. (PR/1074).xclim
now uses GitHub Actions to manage patch version bumping. Merged Pull Requests that modifyxclim
code now trigger version-bumping automatically when pushed to the main development branch. Running$ bump2version patch
within development branches is no longer necessary. (PR/1102).
New features and enhancements
- Add "Celsius" to aliases of "celsius" unit. (GH/1067, PR/1068).
- All indicators now have indexing enabled, except those computing statistics on spells. (GH/1069, PR/1070).
- A convenience function for returning the version numbers for relevant xclim dependencies (
xclim.testing.show_versions
) is now offered. (PR/1073).- A CLI version of this function is also available from the command line (
$ xclim show_version_info
). (PR/1073).
- A CLI version of this function is also available from the command line (
- New "keep_attrs" option to control the handling of the attributes within the indicators. (GH/1026, PR/1076).
- Added a notebook showcasing some simple examples of Spatial Analogues. (GH/585, PR/1075).
create_ensembles
now accepts a glob string to find datasets. (PR/1081).- Improved percentile based indicators metadata with the window, threshold and climatology period used to compute percentiles. (GH/1047, PR/1050).
- New
xclim.core.calendar.construct_offset
, the inverse operation ofparse_offset
. (PR/1090). - Rechunking operations in
xclim.indices.run_length.rle
are now synchronized with dask's options. (PR/1090). - A mention of the "missing" checks and options is added to the history attribute of indicators, where appropriate. (GH/1100, PR/1103).
Breaking changes
xclim.atmos.water_budget
has been separated intowater_budget
(calculated directly with 'evspsblpot') andwater_budget_from_tas
(original function). (PR/1086).- Injected parameters in indicators are now left out of a function's signature and will not be included in the history attribute. (PR/1086).
- The signature for the following Indicators have been modified (PR/1050):
- cold_spell_duration_index, tg90p, tg10p, tx90p, tx10p, tn90p, tn10p, warm_spell_duration_index, days_over_precip_doy_thresh, days_over_precip_thresh, fraction_over_precip_doy_thresh, fraction_over_precip_thresh, cold_and_dry_days, warm_and_dry_days, warm_and_wet_days, cold_and_wet_days
- The parameter for percentile values is now named after the variable it is supposed to be computed upon. (PR/1050).
pytest-runner
has been removed as a dependency (it was never needed forxclim
development). (PR/1074).xclim.testing._utils.py
has been renamed toxclim.testing.utils.py
for added documentation visibility. (PR/1074).- Some unused functions and classes (
as_tuple
,TestFile
,TestDataSet
) have been removed. (PR/1107).
- Some unused functions and classes (
New indicators
universal_thermal_climate_index
andmean_radiant_temperature
for computing the universal thermal climate index from the near-surface temperature, relative humidity, near-surface windspeed and radiation. (GH/1060, PR/1062).
Internal changes
- Typing syntax has been updated within pre-commit via
isort
. Pre-commit hooks now appendfrom __future__ import annotations
to all python module imports for backwards compatibility. (GH/1065, PR/1071) isort
project configurations are now set insetup.cfg
. (PR/1071).- Many function docstrings, external target links, and internal section references have been adjusted to reduce warnings when building the docs. (PR/1074).
- Code snippets within documentation are now checked and reformatted to
black
conventions withblackdoc
. Apre-commit
hook is now in place to run these checks. (PR/1098). - Test coverage statistic no longer includes coverage of the test files themselves. Coverage now reflects lines of usable code covered. (PR/1101).
- Reordered listed authors alphabetically. Promoted @bzah to core contributor. (PR/1105).
- Tests have been added for some functions in
xclim.testing.utils.py
; some previously uncaught bugs inlist_input_variables
,publish_release_notes
, andshow_versions
have been patched. (GH/1078, PR/1107). - A convenience command for installing xclim with key development branches of some dependencies has been added (
$ make upstream
). (GH/1088, PR/1092; amended in GH/1113, PR/1114).- This build configuration is also available in
tox
for local development purposes ($ tox -e pyXX-upstream
).
- This build configuration is also available in
Bug fixes
- Clean the
bias_adjustement
andhistory
attributes created byxclim.sdba.adjust
(e.g. when an argument is anxr.DataArray
, only print the name instead of the whole array). (GH/1083, PR/1087). pydocstyle
checks were silently failing in thepre-commit
configuration due to a badly-formed regex. This has been adjusted. (PR/1074).adjust_doy_calendar
was broken when the source or the target were seasonal. (GH/1097, GH/1091, PR/1099)
v0.36.0
Contributors to this version: Pascal Bourgault (@aulemahal), Juliette Lavoie (@juliettelavoie), David Huard (@huard).
Bug fixes
- Invoking
lazy_indexing
twice in row (or more) using the same indexes (using dask) is now fixed. (GH/1048, PR/1049). - Filtering out the nans before choosing the first and last values as
fill_value
in_interp_on_quantiles_1D
. (GH/1056, PR/1057). - Translations from virtual indicator modules do not override those of the base indicators anymore. (GH/1053, PR/1058).
- Fix mmday unit definition (factor 1000 error). (GH/1061, PR/1063).
New features and enhancements
xclim.sdba.measures.rmse
andxclim.sdba.measures.mae
now usenumpy
instead ofsklearn
. This improves their performances when usingdask
. (PR/1051).- Argument
append_ends
added tosdba.unpack_moving_yearly_window
(PR/1059).
Internal changes
v0.35.0
Contributors to this version: David Huard (@huard), Trevor James Smith (@Zeitsperre) and Pascal Bourgault (@aulemahal).
New indicators
- New indicator
specific_humidity_from_dewpoint
, computing specific humidity from the dewpoint temperature and air pressure. (GH/864, PR/1027)
New features and enhancements
- New spatial analogues method "szekely_rizzo" (PR/1033).
- Loess smoothing (and detrending) now skip NaN values, instead of propagating them. This can be controlled through the
skipna
argument. (PR/1030).
Bug fixes
xclim.analog.spatial_analogs
is now compatible with dask-backed DataArrays. (PR/1033).- Parameter
dmin
added to spatial analog method "zech_aslan", to avoid singularities on identical points. (PR/1033). xclim
is now compatible with changes inxarray
that enabled explicit indexing operations. (PR/1038, xarray PR).
Internal changes
v0.34.0
Contributors to this version: Pascal Bourgault (@aulemahal), Trevor James Smith (@Zeitsperre), David Huard (@huard), Aoun Abel (@bzah).
Announcements
xclim
now officially supports Python3.10. (PR/1013).
Breaking changes
- The version pin for
bottleneck
(<1.4) has been lifted. (PR/1013). packaging
has been removed from thexclim
run dependencies. (PR/1013).- Quantile mapping adjustment objects (EQM, DQM and QDM) and
sdba.utils.equally_spaced_nodes
will not add additional endpoints to the quantile range. With those endpoints, variables are capped to the reference's range in the historical period, which can be dangerous with high variability in the extremes (ex: pr), especially if the reference doesn't reproduce those extremes credibly. (GH/1015, PR/1016). To retrieve the same functionality as before use:
from xclim import sdba
# NQ is the the number of equally spaced nodes, the argument previously given to nquantiles directly.
EQM = sdba.EmpiricalQuantileMapping.train(ref, hist, nquantiles=sdba.equally_spaced_nodes(NQ, eps=1e-6), ...)
- The "history" string attribute added by xclim has been modified for readability: (GH/963, PR/1018).
- The trailing dot (
.
) was dropped. None
inputs are now printed as "None" (and not "").- Arguments are now always shown as keyword-arguments. This mostly impacts
sdba
functions, as it was already the case forIndicators
.
- The trailing dot (
- The
cell_methods
string attribute appends only the operation from the indicator itself. In previous version, some indicators also appended the input data's owncell_method
. The clix-meta importer has been modified to follow the same convention. (GH/983, PR/1022)
New features and enhancements
publish_release_notes
now leverages much more regular expression logic for link translations to markdown. (PR/1023).- Improve performances of percentile bootstrap algorithm by using
xarray.map_block
(GH/932, PR/1017).
Bug fixes
- Loading virtual python modules with
build_indicator_module_from_yaml
is now fixed on some systems where the current directory was not part of python's path. Furthermore, paths of the python and json files can now be passed directly to theindices
andtranslations
arguments, respectively. (GH/1020, PR/1021).
Internal changes
- Due to an upstream bug in
bottleneck
's support of virtualenv,tox
builds for Python3.10 now depend on a patched fork ofbottleneck
. This workaround will be removed once the fix is merged upstream. (PR/1013, see: bottleneck PR/397).- This has been removed with the release of bottleneck version 1.3.4. (PR/1025).
- GitHub CI actions now use the deadsnakes python PPA Action for gathering the Python3.10 development headers. (PR/1013).
- The "is_dayofyear" attribute added by several indices is now a
numpy.int32
instance, instead of python'sint
. This ensures a THREDDS server can read it when the variable is saved to a netCDF file withxarray
/netCDF4-python
. (GH/980, PR/1019).
v0.33.2
Contributors to this version: Pascal Bourgault (@aulemahal), Juliette Lavoie (@juliettelavoie), Trevor James Smith (@Zeitsperre).
Announcements
xclim
no longer supports Python3.7. Code conventions and new features for Python3.8 (PEP 569) are now accepted. (GH/966, PR/1000).
Breaking changes
- Python3.7 (PEP 537)support has been officially deprecated. Continuous integration testing is no longer run against this version of Python. (GH/966, PR/1000).
Bug fixes
- Adjusted behaviour in
dataflags.ecad_compliant
to removedata_vars
of invalids checks that returnNone
, causing issues withdask
. (PR/1002). - Temporarily pinned
ipython
below version 8.0 due to behaviour causing hangs in GitHub Actions and ReadTheDocs. (GH/1005, PR/1006). indices.stats
methods where adapted to handle dask-backed arrays. (GH/1007, PR/1011).sdba.utils.interp_on_quantiles
, withextrapolation='constant'
, now interpolates the limits of the interpolation along the time grouping index, fixing an issue with "time.month" grouping. (GH/1008, PR/1009).
Internal changes
pre-commit
now uses Black 22.1.0 with Python3.8 style conventions. Existing code has been adjusted. (PR/1000).tox
builds for Python3.7 have been deprecated. (PR/1000).- Docstrings and documentation has been adjusted for grammar and typos. (PR/1000).
sdba.utils.extrapolate_qm
has been removed, as announced for xclim 0.33. (PR/1009).
v0.33.0
Contributors to this version: Trevor James Smith (@Zeitsperre), Pascal Bourgault (@aulemahal), Tom Keel (@Thomasjkeel), Jeremy Fyke (@JeremyFyke), David Huard (@huard), Abel Aoun (@bzah), Juliette Lavoie (@juliettelavoie), Yannick Rousseau (@yrouranos).
Announcements
- Deprecation: Release 0.33.0 of
xclim
will be the last version to explicitly support Python3.7 andxarray<0.21.0
. xclim
now requires yaml files to passyamllint
checks on Pull Requests. (PR/981).xclim
now requires docstrings have valid ReStructuredText formatting to pass basic linting checks. (PR/993). Checks generally require:- Working hyperlinks and reference tags.
- Valid content references (e.g.
:py:func:
). - Valid NumPy-formatted docstrings.
- The
xclim
developer community has now adopted the 'Contributor Covenant' Code of Conduct v2.1 (text <https://www.contributor-covenant.org/version/2/1/code_of_conduct/>
_). (GH/948, PR/996).
New indicators
jetstream_metric_woollings
indicator returns latitude and strength of jet-stream in u-wind field. (GH/923, PR/924).
New features and enhancements
- Features added and modified to allow proper multivariate adjustments. (PR/964).
- Added
xclim.sdba.processing.to_additive_space
andxclim.sdba.processing.from_additive_space
to transform "multiplicative" variables to the additive space. An example of multivariate adjustment using this technique was added to the "Advanced" sdba notebook. xclim.sdba.processing.normalize
now also returns the norm.xclim.sdba.processing.jitter
was created by combining the "under" and "over" methods.xclim.sdba.adjustment.PrincipalComponent
was modified to have a simpler signature. The "full" method for finding the best PC orientation was added. (GH/697).
- Added
- New
xclim.indices.stats.parametric_cdf
function to facilitate the computation of return periods over DataArrays of statistical distribution parameters (GH/876, PR/984). - Add
copy
parameter topercentile_doy
to control if the array input can be dumped after computing percentiles (GH/932, PR/985). - New improved algorithm for
dry_spell_total_length
, performing the temporal indexing at the right moment and with control on the aggregation operator (op
) for determining the dry spells. - Added
properties.py
andmeasures.py
in order to perform diagnostic tests of sdba (GH/424, PR/967). - Update how
percentile_doy
rechunk the input data to preserve the initial chunk size. This should make the computation memory footprint more predictable (GH/932, PR/987).
Breaking changes
- To reduce import complexity,
select_time
has been refactored/moved fromxclim.indices.generic
toxclim.core.calendar
. (GH/949, PR/969). - The stacking dimension of
xclim.sdba.stack_variables
has been renamed to "multivar" to avoid name conflicts with the "variables" property of xarray Datasets. (PR/964). xclim
now requirescf-xarray>=0.6.1
. (GH/923, PR/924).xclim
now requiresstatsmodels
. (GH/424, PR/967).
Internal changes
- Added a CI hook in
.pre-commit-config.yaml
to perform automatedpre-commit
corrections with GitHub CI. (PR/965). - Adjusted CI hooks to fail earlier if
lint
checks fail. (PR/972). TrainAdjust
andAdjust
object have a newskip_input_checks
keyword arg to theirtrain
andadjust
methods. WhenTrue
, all unit-, calendar- and coordinate-related input checks are skipped. This is an ugly solution to disappearing attributes when usingxr.map_blocks
with dask. (PR/964).- Some slow tests were marked
slow
to help speed up the standard test ensemble. (PR/969).- Tox testing ensemble now also reports slowest tests using the
--durations
flag.
- Tox testing ensemble now also reports slowest tests using the
pint
no longer emits warnings about redefined units when thelogging
module is loaded. (GH/990, PR/991).- Added a CI step for cancelling running workflows in pull requests that receive multiple pushes. (PR/988).