earthkit.climate.atmos.temperature.warm_spell_duration_index

earthkit.climate.atmos.temperature.warm_spell_duration_index(tasmax: xarray.DataArray | str = 'tasmax', tasmax_per: xarray.DataArray | str = 'tasmax_per', ds: xarray.Dataset | Any = None, *, window: int = 6, freq: str = 'YS', resample_before_rl: bool = True, bootstrap: bool = False, op: Literal['>', '>=', 'gt', 'ge'] = '>', **kwargs: Any) Any

Warm spell duration index.

Number of days part of a percentile-defined warm spell. A warm spell occurs when the maximum daily temperature is above a given percentile for a given number of consecutive days.

Units:

  • warm_spell_duration_index: days

This function wraps xclim.indicators.atmos.warm_spell_duration_index.

Parameters:
  • tasmax (xarray.DataArray | str) – Maximum daily temperature.

  • tasmax_per (xarray.DataArray | str) – Percentile(s) of daily maximum temperature.

  • window (int) – Minimum number of days with temperature above threshold to qualify as a warm spell.

  • freq (str) – Resampling frequency.

  • resample_before_rl (bool) – Determines if the resampling should take place before or after the run length encoding (or a similar algorithm) is applied to runs.

  • bootstrap (bool) – Flag to run bootstrapping of percentiles. Used by percentile_bootstrap decorator. Bootstrapping is only useful when the percentiles are computed on a part of the studied sample. This period, common to percentiles and the sample must be bootstrapped to avoid inhomogeneities with the rest of the time series. Do not enable bootstrap when there is no common period, otherwise it will provide the wrong results. Note that bootstrapping is computationally expensive.

  • op (Literal[``’>’, ``'>=', 'gt', 'ge']) – Comparison operation. Default: “>”.

  • ds (xarray.Dataset | Any) – Input dataset.

  • **kwargs (Any) – Additional keyword arguments.

Returns:

The computed index.

Return type:

Any