New indicators
days_over_precip_thresh
,fraction_over_precip_thresh
,liquid_precip_ratio
,warm_spell_duration_index
, all from eponymous indices.maximum_consecutive_warm_days
from indicemaximum_consecutive_tx_days
.
Breaking changes
-
Numerous changes to
xclim.core.calendar.percentile_doy
:per
now accepts a sequence as well as a scalar and as such the output has a percentiles axis.per
argument is now expected to between 0-100 (not 0-1).- input data must have a daily (or coarser) time frequency.
-
Change in unit handling paradigm for indices, which as a result will lead to some indices returning values with different units. Note that related
Indicator
objects remain unchanged and will return units consistent with CF Convention. If you are concerned with code stability, please useIndicator
objects. The change was necessary to resolve inconsistencies with xarray'skeep_attrs=True
context.- Indice functions now return output units that preserve consistency with input units. That is, feeding inputs in Celsius will yield outputs in Celsius instead of casting to Kelvin. In all cases the dimensionality is preserved.
- Indice functions now accept non-daily data, but daily frequency is assumed by default if the frequency cannot be inferred.
-
Removed the explicitly-installed
netCDF4
python library from the base installation, as this is never explicitly used (now only installed in thedocs
recipe for sdba documented example). -
Removed
xclim.core.checks
, which was deprecated since v0.18.
New features and enhancements
- Indicator now have docstrings generated from their metadata.
- Units and fixed choices set are parsed from indice docstrings into
Indicator.parameters
. - Units of indices using the
declare_units
decorator are stored inindice.in_units
andindice.out_units
. - Changes to
Indicator.format
andIndicator.json
to ensure the resulting json really is serializable.
Internal changes
- Leave
missing_options
undefined inland.fit
indicator to allow control viaset_options
. - Modified
xclim.core.calendar.percentile_doy
to improve performance. - New
xclim.core.calendar.compare_offsets
for comparing offset strings. - New
xclim.indices.generic.get_op
to retrieve a function from a string representation of that operator. - The CI pipeline has been migrated from Travis CI to GitHub Actions. All stages are still built using
tox
. - Indice functions must always set the units (the
declare_units
decorator does no check anymore). - New
xclim.core.units.rate2amout
to convert rates like precipitation to amounts. xclim.core.units.pint2cfunits
now removes ' * ' symbols and changesΔ°
todelta_deg
.- New
xclim.core.units.to_agg_units
andxclim.core.units.infer_sampling_units
for unit handling involving aggregation operations along the time dimension. - Added an indicators API page to the docs and links to there from the
Climate Indicators
page.
Bug fixes
- The unit handling change resolved a bug that prevented the use of
xr.set_options(keep_attrs=True)
with indices.