Climate indicators API

In addition to the indicators classified by realm, three IndicatorCollection that come with xclim are also documented in this page.

Atmospheric Indicators

While the compute module stores the computing functions, this module defines Indicator classes and instances that include a number of functionalities, such as input validation, unit conversion, output meta-data handling, and missing value masking.

The concept followed here is to define Indicator subclasses for each input variable, then create instances for each indicator.

xclim.indicators.atmos.antecedent_precipitation_index(pr='pr', *, window=7, p_exp=0.935, ds=None)

Antecedent Precipitation Index.

Calculate the running weighted sum of daily precipitation values given a window and weighting exponent. This index serves as an indicator for soil moisture.

Based on function antecedent_precipitation_index().

Parameters:
  • pr (str or DataArray) – Daily precipitation data. Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Window for the days of precipitation data to be weighted and summed, default is 7. Default: 7.

  • p_exp (number) – Weighting exponent, default is 0.935. Default: 0.935.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – Antecedent Precipitation Index. With additional attributes: description: Weighted moving sum of daily precipitation totals with a {window}-day window. Weights are an exponential decay of base {p_exp}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

Li, Wei, and Li [2021], Schröter, Kunz, Elmer, Mühr, and Merz [2015]

xclim.indicators.atmos.aridity_index(pr='pr', evspsblpot='evspsblpot', *, freq='YS', ds=None, **indexer)

Aridity index.

The ratio of total precipitation over potential evapotranspiration. Classification based on the Aridity Index (AI).

This indicator will check for missing values according to the method “from_context”. Based on function aridity_index().

Parameters:
  • pr (str or DataArray) – Precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • evspsblpot (str or DataArray) – Potential evapotranspiration. Default: ‘evspsblpot’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. A monthly or yearly frequency is expected. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray – Aridity Index. With additional attributes: description: The ratio of total precipitation over potential evapotranspiration.Classification based on the Aridity Index (AI).

Return type:

xarray.DataArray

Notes

  • The range in the aridity index define different environment categories (percentage of global land area covered)
    • Hyperarid (7.5%): AI < 0.05

    • Arid (12.1%): 0.05 ≤ AI < 0.20

    • Semi-Arid (17.7%): 0.20 ≤ AI < 0.50

    • Dry subhumid (9.9%): 0.50 ≤ AI < 0.65

    • Humid (52.8%): AI ≥ 0.65

  • In North America, higher aridity index values can be associated with colder climates due to lower evapotranspiration, even when precipitation is limited or occurring as snow.

References

:cite:cts:’zomer_2022’

xclim.indicators.atmos.australian_hardiness_zones(tasmin='tasmin', *, window=30, freq='YS', ds=None)

Australian hardiness zones

A climate indice based on a multi-year rolling average of the annual minimum temperature. Developed specifically to aid in determining plant suitability of geographic regions. The Australian National Botanical Gardens (ANBG) classification scheme divides categories into 5-degree Celsius zones, starting from -15 degrees Celsius and ending at 20 degrees Celsius.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function hardiness_zones(). With injected parameters: method=anbg.

Parameters:
  • tasmin (str or DataArray) – Minimum temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • window (number) – The length of the averaging window, in years. Default: 30.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [dimensionless] – Hardiness zones. With additional attributes: description: A climate indice based on a {window}-year rolling average of the annual minimum temperature. Developed specifically to aid in determining plant suitability of geographic regions. The Australian National Botanical Gardens (ANBG) classification scheme divides categories into 5-degree Celsius zones, starting from -15 degrees Celsius and ending at 20 degrees Celsius.

Return type:

xarray.DataArray

References

Dawson [1991], USDA Agricultural Research Service [2012]

xclim.indicators.atmos.biologically_effective_degree_days(tasmin='tasmin', tasmax='tasmax', lat='lat', *, thresh_tasmin='10 degC', method='gladstones', cap_value=1.0, low_dtr='10 degC', high_dtr='13 degC', max_daily_degree_days='9 degC', start_date='04-01', end_date='11-01', freq='YS', ds=None)

Biologically effective degree days

Considers daily minimum and maximum temperature with a given base threshold between 1 April and 31 October, with a maximum daily value for cumulative degree days (typically 9°C), and integrates modification coefficients for latitudes between 40°N and 50°N as well as for swings in daily temperature range. Metric originally published in Gladstones (1992).

This indicator will check for missing values according to the method “from_context”. Based on function biologically_effective_degree_days().

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • lat (str or DataArray) – Latitude coordinate. If None and method is not “icclim”, a CF-conformant “latitude” field must be available within the passed DataArray. Default: ‘lat’. [Required units : []]

  • thresh_tasmin (quantity (string or DataArray, with units)) – The minimum temperature threshold. Default: ‘10 degC’. [Required units : [temperature]]

  • method ({‘icclim’, ‘interpolated’, ‘jones’, ‘gladstones’, ‘huglin’}) – The formula to use for the daily temperature range and latitude coefficient. The “gladstones” method uses a temperature range adjustment and a latitude coefficient based on Gladstones [2011]. End_date should be “11-01” for the Northern Hemisphere. The “huglin” method uses a temperature range adjustment and a stepwise latitude coefficient for values between 40° and 50° based on Huglin [1978]. End_date should be “11-01” for the Northern Hemisphere. The “icclim” method does not implement daily temperature range and nor a latitude coefficient based on Project team ECA&D and KNMI [2013]. End date should be “10-01” for the Northern Hemisphere. The “interpolated” method uses a temperature range adjustment and a smoothed curve latitude coefficient for values between 40° and 50° based on Huglin [1978]. The “jones” method uses a temperature range adjustment and integrates axial tilt, latitude, and day-of-year based on Hall and Jones [2010]. End_date should be “11-01” for the Northern Hemisphere. Default: ‘gladstones’.

  • cap_value (number) – The value to use for the latitude coefficient for latitudes north of 50°N or south of 50°S. Only applicable for methods “huglin” and “interpolated”. Default: 1.0.

  • low_dtr (quantity (string or DataArray, with units)) – The lower bound for daily temperature range adjustment. Default: ‘10 degC’. [Required units : [temperature]]

  • high_dtr (quantity (string or DataArray, with units)) – The higher bound for daily temperature range adjustment. Default: ‘13 degC’. [Required units : [temperature]]

  • max_daily_degree_days (quantity (string or DataArray, with units)) – The maximum number of biologically effective degrees days that can be summed daily. Default: ‘9 degC’. [Required units : [temperature]]

  • start_date (date (string, MM-DD)) – The hemisphere-based start date to consider (north = April, south = October). Default: ‘04-01’.

  • end_date (date (string, MM-DD)) – The hemisphere-based start date to consider (north = October, south = April). This date is non-inclusive. Default: ‘11-01’.

  • freq (offset alias (string)) – Resampling frequency (For Southern Hemisphere, should be “YS-JUL”). Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K days] – Integral of mean daily temperature above {thresh_tasmin}, with maximum value of {max_daily_degree_days}, multiplied by day-length coefficient and temperature range modifier based on {method} method for days between {start_date} and {end_date}. With additional attributes: description: Heat-summation index for agroclimatic suitability estimation, developed specifically for viticulture. Computed with {method} formula (Summation of min((max((Tn + Tx)/2 - {thresh_tasmin}, 0) * k) + TR_adj, Dmax), where coefficient `k` is a latitude-based day-length for days between {start_date} and {end_date}), coefficient `TR_adj` is a modifier accounting for large temperature swings, and `Dmax` is the maximum possibleamount of degree days that can be gained within a day ({max_daily_degree_days}).

Return type:

xarray.DataArray

Notes

Lat coordinate must be provided if method is “gladstones”, “gladstones_simple”, or “huglin”; The “icclim” method for BEDD here differs from the approach detailed in the Heliothermal Index of Huglin (HI) by not considering the latitude coefficient.

The tasmax ceiling of 19°C is assumed to be the maximum temperature beyond which no further gains from warmer daily temperatures occur. Index originally published in Gladstones [1992].

Let \(TX_{i}\) and \(TN_{i}\) be the daily maximum and minimum temperature at day \(i\), \(lat\) the latitude of the point of interest, \(degdays_{max}\) the maximum amount of degrees that can be summed per day (typically, 9). Then the sum of daily biologically effective growing degree day (BEDD) units between 1 April and 31 October is:

\[BEDD_i = \sum_{i=\text{April 1}}^{\text{October 31}} min\left( \left( max\left( \frac{TX_i + TN_i)}{2} - 10, 0 \right) * k \right) + TR_{adj}, degdays_{max} \right)\]
\[\begin{split}TR_{adj} = f(TX_{i}, TN_{i}) = \begin{cases} 0.25(TX_{i} - TN_{i} - 13), & \text{if } (TX_{i} - TN_{i}) > 13 \\ 0, & \text{if } 10 < (TX_{i} - TN_{i}) < 13\\ 0.25(TX_{i} - TN_{i} - 10), & \text{if } (TX_{i} - TN_{i}) < 10 \\ \end{cases}\end{split}\]
\[k = f(lat) = 1 + \left( \frac{\left| lat \right|}{50} * 0.06, \text{if }40 < |lat| <50, \text{else } 0\right)\]

An alternative version of the BEDD (method=”icclim”) does not consider \(TR_{adj}\) and \(k\) and employs a different end date (30 September) [Project team ECA&D and KNMI, 2013]. The simplified formula is as follows:

\[BEDD_i = \sum_{i=\text{April 1}}^{ \text{September 30} } min\left( max\left( \frac{TX_i + TN_i)}{2} - 10, 0 \right), degdays_{max} \right)\]

References

Gladstones [1992], Hall and Jones [2010], Huglin and Schneider [1998], Project team ECA&D and KNMI [2013]

xclim.indicators.atmos.calm_days(sfcWind='sfcWind', *, thresh='2 m s-1', freq='MS', ds=None, **indexer)

Calm days

Number of days with surface wind speed below threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<, constrain=None.

Parameters:
  • sfcWind (str or DataArray) – Surface wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘2 m s-1’. [Required units : ([speed])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Number of days with surface wind speed below {thresh}. With additional attributes: description: {freq} number of days with surface wind speed below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.cffwis_indices(tas='tas', pr='pr', sfcWind='sfcWind', hurs='hurs', lat='lat', snd=None, ffmc0=None, dmc0=None, dc0=None, season_mask=None, *, season_method=None, overwintering=False, dry_start=None, initial_start_up=True, ds=None, **params)

Canadian Fire Weather Index System indices.

Computes the six (6) fire weather indexes, as defined by the Canadian Forest Service: - The Drought Code - The Duff-Moisture Code - The Fine Fuel Moisture Code - The Initial Spread Index - The Build Up Index - The Fire Weather Index.

Based on function cffwis_indices().

Parameters:
  • tas (str or DataArray) – Noon temperature. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Rain fall in open over previous 24 hours, at noon. Default: ‘pr’. [Required units : [precipitation]]

  • sfcWind (str or DataArray) – Noon wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • hurs (str or DataArray) – Noon relative humidity. Default: ‘hurs’. [Required units : []]

  • lat (str or DataArray) – Latitude coordinate. Default: ‘lat’. [Required units : []]

  • snd (str or DataArray, optional) – Noon snow depth, only used if season_method=’LA08’ is passed. Default: None. [Required units : [length]]

  • ffmc0 (str or DataArray, optional) – Initial values of the fine fuel moisture code. Default: None. [Required units : []]

  • dmc0 (str or DataArray, optional) – Initial values of the Duff moisture code. Default: None. [Required units : []]

  • dc0 (str or DataArray, optional) – Initial values of the drought code. Default: None. [Required units : []]

  • season_mask (str or DataArray, optional) – Boolean mask, True where/when the fire season is active. Default: None. [Required units : []]

  • season_method ({None, ‘GFWED’, ‘LA08’, ‘WF93’}) – How to compute the start-up and shutdown of the fire season. If “None”, no start-ups or shutdowns are computed, similar to the R fire function. Ignored if season_mask is given. Default: None.

  • overwintering (boolean) – Whether to activate DC overwintering or not. If True, either season_method or season_mask must be given. Default: False.

  • dry_start ({None, ‘GFWED’, ‘CFS’}) – Whether to activate the DC and DMC “dry start” mechanism or not, see fire_weather_ufunc(). Default: None.

  • initial_start_up (boolean) – If True (default), gridpoints where the fire season is active on the first timestep go through a start_up phase for that time step. Otherwise, previous codes must be given as a continuing fire season is assumed for those points. Default: True.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • params – Any other keyword parameters as defined in fire_weather_ufunc() and in default_params.

Returns:

  • dc (xarray.DataArray, [dimensionless]) – drought_code, Drought Code. With additional attributes: description: Numeric rating of the average moisture content of deep, compact organic layers.

  • dmc (xarray.DataArray, [dimensionless]) – duff_moisture_code, Duff Moisture Code. With additional attributes: description: Numeric rating of the average moisture content of loosely compacted organic layers of moderate depth.

  • ffmc (xarray.DataArray, [dimensionless]) – fine_fuel_moisture_code, Fine Fuel Moisture Code. With additional attributes: description: Numeric rating of the average moisture content of litter and other cured fine fuels.

  • isi (xarray.DataArray, [dimensionless]) – initial_spread_index, Initial Spread Index. With additional attributes: description: Numeric rating of the expected rate of fire spread.

  • bui (xarray.DataArray, [dimensionless]) – buildup_index, Buildup Index. With additional attributes: description: Numeric rating of the total amount of fuel available for combustion.

  • fwi (xarray.DataArray, [dimensionless]) – fire_weather_index, Fire Weather Index. With additional attributes: description: Numeric rating of fire intensity.

Return type:

tuple[xarray.DataArray, xarray.DataArray, xarray.DataArray, xarray.DataArray, xarray.DataArray, xarray.DataArray]

Notes

See Natural Resources Canada [n.d.], the xclim.compute.fire module documentation, and the docstring of fire_weather_ufunc() for more information. This algorithm follows the official R code released by the CFS, which contains revisions from the original 1982 Fortran code.

References

Wang, Anderson, and Suddaby [2015]

xclim.indicators.atmos.chill_portions(tas='tas', *, freq='YS', ds=None, **indexer)

Chill portions

Chill portions are a measure to estimate the bud breaking potential of different crops. The constants and functions are taken from Luedeling et al. (2009) which formalises the method described in Fishman et al. (1987). The model computes the accumulation of cold temperatures in a two-step process. First, cold temperatures contribute to an intermediate product that is transformed to a chill portion once it exceeds a certain concentration. The intermediate product can be broken down at higher temperatures but the final product is stable even at higher temperature. Thus the dynamic model is more accurate than other chill models like the Chilling hours or Utah model, especially in moderate climates like Israel, California or Spain.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function chill_portions().

Parameters:
  • tas (str or DataArray) – Hourly temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.compute.generic.select_time().

Returns:

xarray.DataArray, [unitless] – Chill portions after the Dynamic Model. With additional attributes: description: Chill portions are a measure to estimate the bud breaking potential of different crops. The constants and functions are taken from Luedeling et al. (2009) which formalises the method described in Fishman et al. (1987)., cell_methods: time: sum

Return type:

xarray.DataArray

Notes

Typically, this indicator is computed for a period of the year. You can use the **indexer arguments of select_time in combination with the freq argument to select e.g. a winter period:

cp = chill_portions(tas, date_bounds=("09-01", "03-30"), freq="YS-JUL")

Note that incomplete periods will lead to NaNs.

References

Fishman, Erez, and Couvillon [1987], Luedeling [2012]

xclim.indicators.atmos.chill_units(tas='tas', *, positive_only=False, freq='YS', ds=None, **indexer)

Chill units

Chill units are a measure to estimate the bud breaking potential of different crop based on Richardson et al. [1974]. The Utah model assigns a weight to each hour depending on the temperature recognising that high temperatures can actual decrease, the potential for bud breaking. Providing positive_only=True will ignore days with negative chill units.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function chill_units().

Parameters:
  • tas (str or DataArray) – Hourly temperature. Default: ‘tas’. [Required units : [temperature]]

  • positive_only (boolean) – If True, only positive daily chill units are aggregated. Default: False.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – Chill units after the Utah Model. With additional attributes: description: Chill units are a measure to estimate the bud breaking potential of different crops based on the Utah model developed in Richardson et al. (1974). The Utah model assigns a weight to each hour depending on the temperature recognising that high temperatures can actually decrease the potential for bud breaking., cell_methods: time: sum

Return type:

xarray.DataArray

References

Richardson, Seeley, and Walker [1974]

xclim.indicators.atmos.cold_and_dry_days(tas='tas', pr='pr', tas_per='tas_per', pr_per='pr_per', *, freq='YS', ds=None, **indexer)

Cold and dry days

Number of days with temperature below a given percentile and precipitation below a given percentile.

This indicator will check for missing values according to the method “from_context”. Based on function cold_and_dry_days().

Parameters:
  • tas (str or DataArray) – Mean daily temperature values. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tas_per (str or DataArray) – First quartile of daily mean temperature computed by month. Default: ‘tas_per’. [Required units : [temperature]]

  • pr_per (str or DataArray) – First quartile of daily total precipitation computed by month. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Number of days where temperature is below {tas_per_thresh}th percentile and precipitation is below {pr_per_thresh}th percentile. With additional attributes: description: {freq} number of days where temperature is below {tas_per_thresh}th percentile and precipitation is below {pr_per_thresh}th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Bootstrapping is not available for quartiles because it would make no significant difference to bootstrap percentiles so far from the extremes.

Formula to be written (Beniston [2009]).

References

Beniston [2009]

xclim.indicators.atmos.cold_and_wet_days(tas='tas', pr='pr', tas_per='tas_per', pr_per='pr_per', *, freq='YS', ds=None, **indexer)

Cold and wet days

Number of days with temperature below a given percentile and precipitation above a given percentile.

This indicator will check for missing values according to the method “from_context”. Based on function cold_and_wet_days().

Parameters:
  • tas (str or DataArray) – Mean daily temperature values. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tas_per (str or DataArray) – First quartile of daily mean temperature computed by month. Default: ‘tas_per’. [Required units : [temperature]]

  • pr_per (str or DataArray) – Third quartile of daily total precipitation computed by month. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Number of days where temperature is below {tas_per_thresh}th percentile and precipitation is above {pr_per_thresh}th percentile. With additional attributes: description: {freq} number of days where temperature is below {tas_per_thresh}th percentile and precipitation is above {pr_per_thresh}th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Bootstrapping is not available for quartiles because it would make no significant difference to bootstrap percentiles so far from the extremes.

Formula to be written (Beniston [2009]).

References

Beniston [2009]

xclim.indicators.atmos.cold_spell_days(tas='tas', *, window=5, condition='<', thresh, freq='YS-JUL', resample_before_rl=True, ds=None, **indexer)

Cold spell days

The number of days that are part of a cold spell. A cold spell is defined as a minimum number of consecutive days with mean daily temperature below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window_statistic=max, statistic=sum, min_gap=1, constrain=(‘<’, ‘<=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 5.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – cold_spell_days, Total number of days constituting events of at least {window} consecutive days where the mean daily temperature is below {thresh}. With additional attributes: description: {freq} number of days that are part of a cold spell. A cold spell is defined as {window} or more consecutive days with mean daily temperature below {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.cold_spell_duration_index(tasmin='tasmin', tasmin_per='tasmin_per', *, window=6, freq='YS', resample_before_rl=True, bootstrap=False, condition='<', ds=None)

Cold Spell Duration Index (CSDI)

Number of days part of a percentile-defined cold spell. A cold spell occurs when the daily minimum temperature is below a given percentile for a given number of consecutive days.

This indicator will check for missing values according to the method “from_context”. Based on function cold_spell_duration_index().

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmin_per (str or DataArray) – The nth percentile of daily minimum temperature with dayofyear coordinate. Default: ‘tasmin_per’. [Required units : [temperature]]

  • window (number) – Minimum number of days with temperature below threshold to qualify as a cold spell. Default: 6.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • bootstrap (boolean) – 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. Keep bootstrap to False when there is no common period, as bootstrapping is computationally expensive, and it might provide the wrong results. Default: False.

  • condition ({‘<’, ‘lt’, ‘<=’, ‘le’}) – Comparison operation. Default: “<”. Default: ‘<’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – cold_spell_duration_index, Total number of days constituting events of at least {window} consecutive days where the daily minimum temperature is below the {tasmin_per_thresh}th percentile. With additional attributes: description: {freq} number of days with at least {window} consecutive days where the daily minimum temperature is below the {tasmin_per_thresh}th percentile. A {tasmin_per_window} day(s) window, centred on each calendar day in the {tasmin_per_period} period, is used to compute the {tasmin_per_thresh}th percentile(s).

Return type:

xarray.DataArray

Notes

Let \(TN_i\) be the minimum daily temperature for the day of the year \(i\) and \(TN10_i\) the 10th percentile of the minimum daily temperature over the 1961-1990 period for day of the year \(i\), the cold spell duration index over period \(\phi\) is defined as:

\[\sum_{i \in \phi} \prod_{j=i}^{i+6} \left[ TN_j < TN10_j \right]\]

where \([P]\) is 1 if \(P\) is true, and 0 if false.

References

From the Expert Team on Climate Change Detection, Monitoring and Indices (ETCCDMI; [Zhang et al., 2011]).

xclim.indicators.atmos.cold_spell_frequency(tas='tas', *, window=5, condition='<', thresh='-10 °C', freq='YS-JUL', resample_before_rl=True, ds=None, **indexer)

Cold spell frequency

The frequency of cold periods of N days or more, during which the temperature over a given time window of days is below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window_statistic=max, statistic=count, min_gap=1, constrain=(‘<’, ‘<=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 5.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘-10 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray – Number of cold periods of {window} day(s) or more, during which the temperature on a window of {window} day(s) is below {thresh}.. With additional attributes: description: The {freq} number of cold periods of {window} day(s) or more, during which the temperature on a window of {window} day(s) is below {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.cold_spell_max_length(tas='tas', *, window=1, condition='<', thresh='-10 °C', freq='YS-JUL', resample_before_rl=True, ds=None, **indexer)

Cold spell maximum length

The maximum length of a cold period of N days or more, during which the temperature over a given time window of days is below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window_statistic=max, statistic=max, min_gap=1, constrain=(‘<’, ‘<=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 1.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘-10 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Maximum consecutive number of days in a cold period of {window} day(s) or more, during which the temperature within windows of {window} day(s) is under {thresh}.. With additional attributes: description: The maximum {freq} number of consecutive days in a cold period of {window} day(s) or more, during which the temperature within windows of {window} day(s) is under {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.cold_spell_total_length(tas='tas', *, window=3, condition='<', thresh='-10 °C', freq='YS-JUL', resample_before_rl=True, ds=None, **indexer)

Cold spell total length

The total length of cold periods of N days or more, during which the temperature over a given time window of days is below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window_statistic=max, statistic=sum, min_gap=1, constrain=(‘<’, ‘<=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘-10 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Number of days in cold periods of {window} day(s) or more, during which thetemperature within windows of {window} day(s) is under {thresh}.. With additional attributes: description: The {freq} number of days in cold periods of {window} day(s) or more, during which the temperature within windows of {window} day(s) is under {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.consecutive_frost_days(tasmin='tasmin', *, condition='<', thresh='0 degC', freq='YS-JUL', resample_before_rl=True, ds=None, **indexer)

Consecutive frost days

Maximum number of consecutive days where the daily minimum temperature is below a given threshold

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window=1, window_statistic=max, statistic=max, min_gap=1, constrain=(‘<’, ‘<=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive days where minimum daily temperature is {condition} {thresh}. With additional attributes: description: {freq} maximum number of consecutive days where minimum daily temperature is {condition} {thresh}., cell_methods: time: maximum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.cool_night_index(tasmin='tasmin', lat=None, *, freq='YS', ds=None)

Cool night index

A night coolness variable which takes into account the mean minimum night temperatures during the month when ripening usually occurs beyond the ripening period.

This indicator will check for missing values according to the method “from_context”. Based on function cool_night_index().

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • lat (str or DataArray, optional) – Latitude coordinate as an array, float or string. If None, a CF-conformant “latitude” field must be available within the passed DataArray. Default: None.

  • freq ({‘YS’, ‘YS-JAN’}) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degC] – Mean minimum temperature in late summer. With additional attributes: description: Mean minimum temperature for September (Northern hemisphere) or March (Southern hemisphere)., cell_methods: time: mean over days

Return type:

xarray.DataArray

Notes

Given that this index only examines September and March months, it is possible to send in DataArrays containing only these timesteps. Users should be aware that due to the missing values checks in wrapped Indicators, datasets that are missing several months will be flagged as invalid. This check can be ignored by setting the following context:

with xclim.set_options(check_missing="skip"):
    cni = cool_night_index(tasmin)

References

Tonietto and Carbonneau [2004]

xclim.indicators.atmos.cooling_degree_days(tas='tas', *, thresh='18.0 degC', freq='YS', ds=None, **indexer)

Cooling degree days

The cumulative degree days for days when the mean daily temperature is above a given threshold and buildings must be air conditioned.

This indicator will check for missing values according to the method “from_context”. Based on function integrated_difference(). With injected parameters: condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – The value threshold. Default: ‘18.0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_excess_wrt_time, Cumulative sum of temperature degrees for mean daily temperature above {thresh}. With additional attributes: description: {freq} cumulative cooling degree days (mean temperature above {thresh})., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.cooling_degree_days_approximation(tasmax='tasmax', tasmin='tasmin', tas='tas', *, thresh='18.0 degC', freq='YS', ds=None, **indexer)

Cooling degree days approximation

The cumulative degree days for days when temperatures are above a given threshold and buildings must be air conditioned. This method integrates mean, minimum, and maximum temperatures, accounting for asymmetry in the distributions of temperatures throughout the diurnal cycle.

This indicator will check for missing values according to the method “from_context”. Based on function degree_days_above_approximation().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Temperature threshold above which degree days are accumulated. Default: ‘18.0 degC’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_excess_wrt_time, Cumulative sum of temperature degrees for daily temperatures above {thresh}. With additional attributes: description: {freq} cumulative cooling degree days (temperature above {thresh}) using a combination of minimum, maximum, and mean daily temperatures., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

For each day, the integrated quantity depends on where the threshold lies in relation to the 3 temperature statistics.

  • thresh > tasmax : 0

  • tasmax >= thresh > tas : (tasmax - thresh) / 4

  • tas >= thresh > tasmin : (tasmax - thresh) / 2 - (thresh - tasmin) / 4,

  • `` tasmin > thresh`` : (tas - thresh).

References

Spinoni, Vogt, Barbosa, Dosio, McCormick, Bigano, and Füssel [2018]

xclim.indicators.atmos.corn_heat_units(tasmin='tasmin', tasmax='tasmax', *, thresh_tasmin='4.44 degC', thresh_tasmax='10 degC', ds=None)

Corn heat units

A temperature-based index used to estimate the development of corn crops. Corn growth occurs when the daily minimum and maximum temperatures exceed given thresholds.

Based on function corn_heat_units().

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh_tasmin (quantity (string or DataArray, with units)) – The minimum temperature threshold needed for corn growth. Default: ‘4.44 degC’. [Required units : [temperature]]

  • thresh_tasmax (quantity (string or DataArray, with units)) – The maximum temperature threshold needed for corn growth. Default: ‘10 degC’. [Required units : [temperature]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [unitless] – Corn heat units (Tmin > {thresh_tasmin} and Tmax > {thresh_tasmax}). With additional attributes: description: Temperature-based index used to estimate the development of corn crops. Corn growth occurs when the minimum and maximum daily temperatures both exceed {thresh_tasmin} and {thresh_tasmax}, respectively.

Return type:

xarray.DataArray

Notes

Formula used in calculating the Corn Heat Units for the Agroclimatic Atlas of Quebec [Audet et al., 2012].

The thresholds of 4.44°C for minimum temperatures and 10°C for maximum temperatures were selected following the assumption that no growth occurs below these values.

Let \(TX_{i}\) and \(TN_{i}\) be the daily maximum and minimum temperature at day \(i\). Then the daily corn heat unit is:

\[CHU_i = \frac{YX_{i} + YN_{i}}{2}\]

with

\[\begin{split}\begin{aligned} YX_i &= 3.33(TX_i - 10) - 0.084(TX_i - 10)^2, &\text{if } TX_i > 10^\circ\mathrm{C} \\ YN_i &= 1.8(TN_i - 4.44), &\text{if } TN_i > 4.44^\circ\mathrm{C} \end{aligned}\end{split}\]

Where \(YX_{i}\) and \(YN_{i}\) is 0 when \(TX_i \leq 10°C\) and \(TN_i \leq 4.44°C\), respectively.

References

Audet, Côté, Bachand, and Mailhot [2012], Bootsma, Tremblay, and Filion [1999]

xclim.indicators.atmos.daily_freezethaw_cycles(tasmin='tasmin', tasmax='tasmax', *, thresh_tasmin='0 degC', thresh_tasmax='0 degC', condition_tasmin='<=', condition_tasmax='>', freq='YS', resample_before_rl=True, ds=None, **indexer)

Daily freeze-thaw cycles

The number of days with a freeze-thaw cycle. A freeze-thaw cycle is defined as a day where maximum daily temperature is above a given threshold and minimum daily temperature is at or below a given threshold, usually 0°C for both.

This indicator will check for missing values according to the method “from_context”. Based on function multiday_temperature_swing(). With injected parameters: window=1, statistic=sum.

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh_tasmin (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a freeze event. Default: ‘0 degC’. [Required units : [temperature]]

  • thresh_tasmax (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a thaw event. Default: ‘0 degC’. [Required units : [temperature]]

  • condition_tasmin ({‘<’, ‘lt’, ‘<=’, ‘le’}) – Comparison operation for tasmin. Default: “<=”. Default: ‘<=’.

  • condition_tasmax ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation for tasmax. Default: “>”. Default: ‘>’.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Subsetting is done after finding the events, but before computing the statistic over them.

Returns:

xarray.DataArray, [days] – Number of days where maximum daily temperatures are above {thresh_tasmax} and minimum daily temperatures are at or below {thresh_tasmin}. With additional attributes: description: {freq} number of days with a diurnal freeze-thaw cycle, where maximum daily temperatures are above {thresh_tasmax} and minimum daily temperatures are at or below {thresh_tasmin}.

Return type:

xarray.DataArray

Notes

Let \(TX_{i}\) be the maximum temperature at day \(i\) and \(TN_{i}\) be the daily minimum temperature at day \(i\). Then freeze thaw spells during a given period are consecutive days where:

\[TX_{i} > 0℃ \land TN_{i} < 0℃\]

This function returns a given statistic of the found lengths, optionally dropping those shorter than window. For example, window=1 and statistic=’sum’ returns the same value as daily_freezethaw_cycles().

xclim.indicators.atmos.daily_pr_intensity(pr='pr', *, condition='>=', thresh='1 mm/day', freq='YS', ds=None, **indexer)

Simple Daily Intensity Index

Average precipitation for days with daily precipitation above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: statistic=mean, constrain=(‘>’, ‘>=’), out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold, should have the same dimensionality as data. Default: ‘1 mm/day’. [Required units : ([precipitation])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm d-1] – lwe_precipitation_rate, Average precipitation during days with daily precipitation over {thresh} (Simple Daily Intensity Index: SDII). With additional attributes: description: {freq} Simple Daily Intensity Index (SDII) or {freq} average precipitation for days with daily precipitation over {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.daily_temperature_range(tasmin='tasmin', tasmax='tasmax', *, statistic='mean', freq='YS', ds=None, **indexer)

Mean of daily temperature range

The average difference between the daily maximum and minimum temperatures.

This indicator will check for missing values according to the method “from_context”. Based on function difference_statistics(). With injected parameters: absolute=False.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • statistic ({‘max’, ‘min’, ‘mean’, ‘sum’}) – The statistic to compute over the difference between the two variables. Default: ‘mean’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Mean diurnal temperature range. With additional attributes: description: {freq} mean diurnal temperature range., cell_methods: time range within days time: mean over days

Return type:

xarray.DataArray

xclim.indicators.atmos.daily_temperature_range_variability(tasmin='tasmin', tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Variability of daily temperature range

The average day-to-day variation in daily temperature range.

This indicator will check for missing values according to the method “from_context”. Based on function interday_difference_statistics(). With injected parameters: statistic=mean, absolute=False.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Subsetting is done after differentiating along time.

Returns:

xarray.DataArray, [K] – air_temperature, Mean diurnal temperature range variability. With additional attributes: description: {freq} mean diurnal temperature range variability, defined as the average day-to-day variation in daily temperature range for the given time period., cell_methods: time range within days time: difference over days time: mean over days

Return type:

xarray.DataArray

xclim.indicators.atmos.day_to_day_temperature_variability(tas='tas', *, freq='YS', ds=None, **indexer)

Day-to-day temperature variability

Computes the standard deviation of the variable within each sub-period (e.g. month), then averages those standard deviations over the main resampling period (e.g. year). This provides a measure of typical day-to-day variability as described in Kotz et al. [2021].

This indicator will check for missing values according to the method “from_context”. Based on function day_to_day_variability(). With injected parameters: subfreq=MS.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency used to average the sub-period standard deviations. Default is "YS" (yearly). Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – Mean of the day-to-day temperature variability. With additional attributes: description: {freq} mean of the day-to-day variability computed as the {subfreq} standard deviation, cell_methods: time: standard_deviation within months time: mean over months

Return type:

xarray.DataArray

References

Kotz, Wenz, Stechemesser, Kalkuhl, and Levermann [2021]

xclim.indicators.atmos.days_over_precip_doy_thresh(pr='pr', pr_per='pr_per', *, thresh='1 mm/day', freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Number of days with precipitation above a given daily percentile

Number of days in a period where precipitation is above a given daily percentile and a fixed threshold.

This indicator will check for missing values according to the method “from_context”. Based on function days_over_precip_thresh().

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – Percentile of wet day precipitation flux. Either computed daily (one value per day of year) or computed over a period (one value per spatial point). Default: ‘pr_per’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Precipitation value over which a day is considered wet. Default: ‘1 mm/day’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_daily_threshold, Number of days with daily precipitation flux above the {pr_per_thresh}th percentile of {pr_per_period}. With additional attributes: description: {freq} number of days with precipitation above the {pr_per_thresh}th daily percentile. Only days with at least {thresh} are counted. A {pr_per_window} day(s) window, centered on each calendar day in the {pr_per_period} period, is used to compute the {pr_per_thresh}th percentile(s)., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.days_over_precip_thresh(pr='pr', pr_per='pr_per', *, thresh='1 mm/day', freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Number of days with precipitation above a given percentile

Number of days in a period where precipitation is above a given percentile, calculated over a given period and a fixed threshold.

This indicator will check for missing values according to the method “from_context”. Based on function days_over_precip_thresh().

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – Percentile of wet day precipitation flux. Either computed daily (one value per day of year) or computed over a period (one value per spatial point). Default: ‘pr_per’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Precipitation value over which a day is considered wet. Default: ‘1 mm/day’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of days with precipitation flux above the {pr_per_thresh}th percentile of {pr_per_period}. With additional attributes: description: {freq} number of days with precipitation above the {pr_per_thresh}th percentile of {pr_per_period} period. Only days with at least {thresh} are counted., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.days_with_snow(prsn='prsn', *, freq='YS-JUL', ds=None, low='0 kg m-2 s-1', high='1E6 kg m-2 s-1', **indexer)

Days with snowfall

Number of days with snow between a lower and upper limit.

This indicator will check for missing values according to the method “from_context”. Based on function count_domain_occurrences(). With injected parameters: low_condition=>, high_condition=<=.

Parameters:
  • prsn (str or DataArray) – Surface snowfall flux. Default: ‘prsn’. [Required units : [mass]/([area]*[time])]

  • freq (offset alias (string)) – Resampling frequency defining the periods defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • low (quantity (string or DataArray, with units)) – Minimum value. Default: ‘0 kg m-2 s-1’. [Required units : ([mass]/([area]*[time]))]

  • high (quantity (string or DataArray, with units)) – Maximum value. Default: ‘1E6 kg m-2 s-1’. [Required units : ([mass]/([area]*[time]))]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Number of days with snowfall between {low} and {high} thresholds. With additional attributes: description: {freq} number of days with snowfall larger than {low} and smaller or equal to {high}.

Return type:

xarray.DataArray

xclim.indicators.atmos.degree_days_exceedance_date(tas='tas', *, thresh='0 degC', sum_thresh='25 K days', condition='>', after_date=None, never_reached=None, freq='YS', ds=None)

Degree day exceedance date

The day of the year when the sum of degree days exceeds a threshold, occurring after a given date. Degree days are calculated above or below a given temperature threshold.

This indicator will check for missing values according to the method “from_context”. Based on function degree_days_exceedance_date().

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold temperature on which to base degree-days evaluation. Default: ‘0 degC’. [Required units : [temperature]]

  • sum_thresh (quantity (string or DataArray, with units)) – Threshold of the degree days sum. Default: ‘25 K days’. [Required units : K days]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – If equivalent to ‘>’, degree days are computed as tas - thresh and if equivalent to ‘<’, they are computed as thresh - tas. Default: ‘>’.

  • after_date (date (string, MM-DD)) – Date at which to start the cumulative sum. In “MM-DD” format, defaults to the start of the sampling period. Default: None.

  • never_reached (date (string, MM-DD)) – What to do when sum_thresh is never exceeded. If an int, the value to assign as a day-of-year. If a string, must be in “MM-DD” format, the day-of-year of that date is assigned. Default (None) assigns “NaN”. Default: None.

  • freq (offset alias (string)) – Resampling frequency. If after_date is given, freq should be annual. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [dimensionless] – day_of_year, Day of year when the integral of mean daily temperature {condition} {thresh} exceeds {sum_thresh}. With additional attributes: description: <function <lambda> at 0x718e953f07c0>

Return type:

xarray.DataArray

Notes

Let \(TG_{ij}\) be the daily mean temperature at day \(i\) of period \(j\), \(T\) is the reference threshold and \(ST\) is the sum threshold. Then, starting at day :math:i_0:, the degree days exceedance date is the first day \(k\) such that:

\[\begin{split}\begin{cases} ST < \sum_{i=i_0}^{k} \max(TG_{ij} - T, 0) & \text{if $condition$ is '>' | '>='} \\ ST < \sum_{i=i_0}^{k} \max(T - TG_{ij}, 0) & \text{if $condition$ is '<' | '<='} \end{cases}\end{split}\]

The resulting \(k\) is expressed as a day of year.

Cumulated degree days have numerous applications including plant and insect phenology. See: https://en.wikipedia.org/wiki/Growing_degree-day for examples (Wikipedia Contributors [2021]).

xclim.indicators.atmos.drought_code(tas='tas', pr='pr', lat='lat', snd=None, dc0=None, season_mask=None, *, season_method=None, overwintering=False, dry_start=None, initial_start_up=True, ds=None, **params)

Daily drought code

The Drought Index is part of the Canadian Forest-Weather Index system. It is a numerical code that estimates the average moisture content of organic layers.

Based on function drought_code().

Parameters:
  • tas (str or DataArray) – Noon temperature. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Rain fall in open over previous 24 hours, at noon. Default: ‘pr’. [Required units : [precipitation]]

  • lat (str or DataArray) – Latitude coordinate. Default: ‘lat’. [Required units : []]

  • snd (str or DataArray, optional) – Noon snow depth. Default: None. [Required units : [length]]

  • dc0 (str or DataArray, optional) – Initial values of the drought code. Default: None. [Required units : []]

  • season_mask (str or DataArray, optional) – Boolean mask, True where/when the fire season is active. Default: None. [Required units : []]

  • season_method ({None, ‘GFWED’, ‘LA08’, ‘WF93’}) – How to compute the start-up and shutdown of the fire season. If “None”, no start-ups or shutdowns are computed, similar to the R fire function. Ignored if season_mask is given. Default: None.

  • overwintering (boolean) – Whether to activate DC overwintering or not. If True, either season_method or season_mask must be given. Default: False.

  • dry_start ({None, ‘GFWED’, ‘CFS’}) – Whether to activate the DC and DMC “dry start” mechanism and which method to use. See fire_weather_ufunc(). Default: None.

  • initial_start_up (boolean) – If True (default), grid points where the fire season is active on the first timestep go through a start_up phase for that time step. Otherwise, previous codes must be given as a continuing fire season is assumed for those points. Default: True.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • params – Any other keyword parameters as defined in xclim.compute.fire.fire_weather_ufunc and in default_params.

Returns:

xarray.DataArray, [dimensionless] – Drought Code. With additional attributes: description: Numerical code estimating the average moisture content of organic layers.

Return type:

xarray.DataArray

Notes

See Natural Resources Canada [n.d.], the xclim.compute.fire module documentation, and the docstring of fire_weather_ufunc() for more information. This algorithm follows the official R code released by the CFS, which contains revisions from the original 1982 Fortran code.

References

Wang, Anderson, and Suddaby [2015]

xclim.indicators.atmos.dry_days(pr='pr', *, condition='<', thresh='0.2 mm/d', freq='YS', ds=None, **indexer)

Number of dry days

The number of days with daily precipitation under a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘<’, ‘<=’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘0.2 mm/d’. [Required units : ([precipitation])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_below_threshold, Number of dry days. With additional attributes: description: {freq} number of days with daily precipitation under {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.dry_spell_frequency(pr='pr', *, window=3, window_statistic='sum', thresh='1 mm', freq='YS', resample_before_rl=True, ds=None, **indexer)

Dry spell frequency

The frequency of dry periods of N days or more, during which the accumulated or maximum precipitation over a given time window of days is below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: condition=<, statistic=count, min_gap=1, constrain=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Minimum length of a spell. Default: 3.

  • window_statistic ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘sum’.

  • thresh (quantity (string or DataArray, with units)) – An amount of precipitation (not a flux or rate). Default: ‘1 mm’. [Required units : ([mass]/[area])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray – Number of dry periods of at least {window} days. With additional attributes: description: The {freq} number of dry periods of at least {window} days. A period is dry if its {window_statistic} precipitation on a window of {window} days is below {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.dry_spell_max_length(pr='pr', *, window=3, window_statistic='sum', thresh='1 mm', freq='YS', resample_before_rl=True, ds=None, **indexer)

Dry spell maximum length

The maximum length of a dry period of N days or more, during which the accumulated or maximum precipitation over a given time window of days is below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: condition=<, statistic=max, min_gap=1, constrain=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Minimum length of a spell. Default: 3.

  • window_statistic ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘sum’.

  • thresh (quantity (string or DataArray, with units)) – An amount of precipitation (not a flux or rate). Default: ‘1 mm’. [Required units : ([mass]/[area])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Maximum consecutive number of days in a dry period of at least {window} days. With additional attributes: description: The maximum {freq} number of consecutive days in a dry period of at least {window} days, during which the {window_statistic} precipitation within windows of {window} days is under {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.dry_spell_total_length(pr='pr', *, window=3, window_statistic='sum', thresh='1 mm', freq='YS', resample_before_rl=True, ds=None, **indexer)

Dry spell total length

The total length of dry periods of N days or more, during which the accumulated or maximum precipitation over a given time window of days is below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: condition=<, statistic=sum, min_gap=1, constrain=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Minimum length of a spell. Default: 3.

  • window_statistic ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘sum’.

  • thresh (quantity (string or DataArray, with units)) – An amount of precipitation (not a flux or rate). Default: ‘1 mm’. [Required units : ([mass]/[area])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Number of days in dry periods of at least {window} days.. With additional attributes: description: The {freq} number of days in dry periods of at least {window} days, during which the {window_statistic} precipitation within windows of {window} days is under {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.dryness_index(pr='pr', evspsblpot='evspsblpot', lat=None, *, wo='200 mm', freq='YS', ds=None)

Dryness index

The dryness index is a characterization of the water component in winegrowing regions which considers the precipitation and evapotranspiration factors without deduction for surface runoff or drainage. Metric originally published in Riou et al. (1994).

This indicator will check for missing values according to the method “from_context”. Based on function dryness_index().

Parameters:
  • pr (str or DataArray) – Precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • evspsblpot (str or DataArray) – Potential evapotranspiration. Default: ‘evspsblpot’. [Required units : [precipitation]]

  • lat (str or DataArray, optional) – Latitude coordinate as an array, float or string. If None, a CF-conformant “latitude” field must be available within the passed DataArray. Default: None.

  • wo (quantity (string or DataArray, with units)) – The initial soil water reserve accessible to root systems [length]. Default: 200 mm. Default: ‘200 mm’. [Required units : [length]]

  • freq ({‘YS’, ‘YS-JAN’}) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – Growing season humidity. With additional attributes: description: Estimation of growing season humidity (precipitation minus adjusted evapotranspiration) for the period of April to September (Northern Hemisphere) or October to March (Southern Hemisphere), with initial soil moisture content set to {wo} and an adjustment based on monthly precipitation and evapotranspiration limits.

Return type:

xarray.DataArray

Notes

Given that this index only examines monthly total accumulations for six-month periods depending on the hemisphere, it is possible to send in DataArrays containing only these timesteps. Users should be aware that due to the missing values checks in wrapped Indicators, datasets that are missing several months will be flagged as invalid. This check can be ignored by setting the following context:

with xclim.set_options(check_missing="skip"):
    di = dryness_index(pr, evspsblpot)

Let \(Wo\) be the initial useful soil water reserve (typically “200 mm”), \(P\) be precipitation, \(T_{v}\) be the potential transpiration in the vineyard, and \(E_{s}\) be the direct evaporation from the soil. Then the Dryness Index, or the estimate of soil water reserve at the end of a period (1 April to 30 September in the Northern Hemispherere or 1 October to 31 March in the Southern Hemisphere), can be given by the following formulae:

\[W = \sum_{\text{April 1}}^{\text{September 30}} \left( Wo + P - T_{v} - E_{s} \right)\]

or (for the Southern Hemisphere):

\[W = \sum_{\text{October 1}}^{\text{March 31}} \left( Wo + P - T_{v} - E_{s} \right)\]

Where \(T_{v}\) and \(E_{s}\) are given by the following formulae:

\[T_{v} = ETP * k\]

and

\[E_{s} = \frac{ETP}{N}\left( 1 - k \right) * JPm\]

Where \(ETP\) is evapotranspiration, \(N\) is the number of days in the given month. \(k\) is the coefficient for radiative absorption given by the vine plant architecture, and \(JPm\) is the number of days of effective evaporation from the soil per month, both provided by the following formulae:

\[\begin{split}k = \begin{cases} 0.1, & \text{if month = April (NH) or October (SH)} \\ 0.3, & \text{if month = May (NH) or November (SH)} \\ 0.5, & \text{if month = June - September (NH) or December - March (SH)} \\ \end{cases}\end{split}\]
\[JPm = \max\left( P / 5, N \right)\]

References

Riou [1994], Tonietto and Carbonneau [2004]

xclim.indicators.atmos.duff_moisture_code(tas='tas', pr='pr', hurs='hurs', lat='lat', snd=None, dmc0=None, season_mask=None, *, season_method=None, dry_start=None, initial_start_up=True, ds=None, **params)

Duff moisture code (FWI component).

The duff moisture code is part of the Canadian Forest Fire Weather Index System. It is a numeric rating of the average moisture content of loosely compacted organic layers of moderate depth.

Based on function duff_moisture_code().

Parameters:
  • tas (str or DataArray) – Noon temperature. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Rain fall in open over previous 24 hours, at noon. Default: ‘pr’. [Required units : [precipitation]]

  • hurs (str or DataArray) – Noon relative humidity. Default: ‘hurs’. [Required units : []]

  • lat (str or DataArray) – Latitude coordinate. Default: ‘lat’. [Required units : []]

  • snd (str or DataArray, optional) – Noon snow depth. Default: None. [Required units : [length]]

  • dmc0 (str or DataArray, optional) – Initial values of the duff moisture code. Default: None. [Required units : []]

  • season_mask (str or DataArray, optional) – Boolean mask, True where/when the fire season is active. Default: None. [Required units : []]

  • season_method ({None, ‘GFWED’, ‘LA08’, ‘WF93’}) – How to compute the start-up and shutdown of the fire season. If “None”, no start-ups or shutdowns are computed, similar to the R fire function. Ignored if season_mask is given. Default: None.

  • dry_start ({None, ‘GFWED’, ‘CFS’}) – Whether to activate the DC and DMC “dry start” mechanism and which method to use. See fire_weather_ufunc(). Default: None.

  • initial_start_up (boolean) – If True (default), grid points where the fire season is active on the first timestep go through a start_up phase for that time step. Otherwise, previous codes must be given as a continuing fire season is assumed for those points. Default: True.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • params – Any other keyword parameters as defined in xclim.compute.fire.fire_weather_ufunc and in default_params.

Returns:

xarray.DataArray, [dimensionless] – Duff Moisture Code. With additional attributes: description: Numeric rating of the average moisture content of loosely compacted organic layers of moderate depth.

Return type:

xarray.DataArray

Notes

See Natural Resources Canada [n.d.], the xclim.compute.fire module documentation, and the docstring of fire_weather_ufunc() for more information. This algorithm follows the official R code released by the Canadian Forestry Service, which contains revisions from the original 1982 Fortran code.

References

Wang, Anderson, and Suddaby [2015]

xclim.indicators.atmos.extreme_temperature_range(tasmin='tasmin', tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Extreme temperature range

The maximum of the maximum temperature minus the minimum of the minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function extreme_range().

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Intra-period extreme temperature range. With additional attributes: description: {freq} range between the maximum of daily maximum temperature and the minimum of dailyminimum temperature.

Return type:

xarray.DataArray

xclim.indicators.atmos.fire_season(tas='tas', snd=None, *, method='WF93', freq=None, temp_start_thresh='12 degC', temp_end_thresh='5 degC', temp_condition_days=3, snow_condition_days=3, snow_thresh='0.01 m', ds=None)

Fire season mask.

Binary mask of the active fire season, defined by conditions on consecutive daily temperatures and, optionally, snow depths.

Based on function fire_season().

Parameters:
  • tas (str or DataArray) – Daily surface temperature, cffdrs recommends using maximum daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • snd (str or DataArray, optional) – Snow depth, used with method == ‘LA08’. Default: None. [Required units : [length]]

  • method ({‘GFWED’, ‘LA08’, ‘WF93’}) – Which method to use. “LA08” and “GFWED” need the snow depth. Default: ‘WF93’.

  • freq (offset alias (string)) – If given only the longest fire season for each period defined by this frequency, Every “seasons” are returned if None, including the short shoulder seasons. Default: None.

  • temp_start_thresh (quantity (string or DataArray, with units)) – Minimal temperature needed to start the season. Must be scalar. Default: ‘12 degC’. [Required units : [temperature]]

  • temp_end_thresh (quantity (string or DataArray, with units)) – Maximal temperature needed to end the season. Must be scalar. Default: ‘5 degC’. [Required units : [temperature]]

  • temp_condition_days (number) – Number of days with temperature above or below the thresholds to trigger a start or an end of the fire season. Default: 3.

  • snow_condition_days (number) – Parameters for the fire season determination. See fire_season(). Temperature is in degC, snow in m. The snow_thresh parameters is also used when dry_start is set to “GFWED”. Default: 3.

  • snow_thresh (quantity (string or DataArray, with units)) – Minimal snow depth level to end a fire season, only used with method “LA08”. Must be scalar. Default: ‘0.01 m’. [Required units : [length]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – Fire season mask.. With additional attributes: description: Fire season mask, computed with method {method}.

Return type:

xarray.DataArray

References

Lawson and Armitage [2008], Wotton and Flannigan [1993]

xclim.indicators.atmos.first_day_tg_above(tas='tas', *, condition='>', thresh='0 degC', freq='YS', window=1, ds=None, after_date='01-01', **indexer)

First or last day of values fulfilling a condition.

Returns first or last day of period where values meet a given condition for a minimum number of consecutive days, limited to a starting or ending calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: which=first, constrain=(‘>’, ‘>=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • window (number) – Minimum number of days with values above thresh needed for evaluation. Default: 1. Default: 1.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • after_date (date (string, MM-DD)) – Date of the year after which to look for the first event, or before which to look for the last event. Should have the format ‘%m-%d’. None means there is no limit. Default: ‘01-01’.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, First day of year with a period of at least {window} days of mean temperature above {thresh}. With additional attributes: description: First day of year with mean temperature above {thresh} for at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.first_day_tg_below(tas='tas', *, condition='<', thresh='0 degC', freq='YS', window=1, ds=None, after_date='07-01', **indexer)

First or last day of values fulfilling a condition.

Returns first or last day of period where values meet a given condition for a minimum number of consecutive days, limited to a starting or ending calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: which=first, constrain=(‘<’, ‘<=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • window (number) – Minimum number of days with values above thresh needed for evaluation. Default: 1. Default: 1.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • after_date (date (string, MM-DD)) – Date of the year after which to look for the first event, or before which to look for the last event. Should have the format ‘%m-%d’. None means there is no limit. Default: ‘07-01’.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, First day of year with a period of at least {window} days of mean temperature below {thresh}. With additional attributes: description: First day of year with mean temperature below {thresh} for at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.first_day_tn_above(tasmin='tasmin', *, condition='>', thresh='0 degC', freq='YS', window=1, ds=None, after_date='01-01', **indexer)

First or last day of values fulfilling a condition.

Returns first or last day of period where values meet a given condition for a minimum number of consecutive days, limited to a starting or ending calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: which=first, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • window (number) – Minimum number of days with values above thresh needed for evaluation. Default: 1. Default: 1.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • after_date (date (string, MM-DD)) – Date of the year after which to look for the first event, or before which to look for the last event. Should have the format ‘%m-%d’. None means there is no limit. Default: ‘01-01’.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, First day of year with a period of at least {window} days of minimum temperature above {thresh}. With additional attributes: description: First day of year with minimum temperature above {thresh} for at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.first_day_tn_below(tasmin='tasmin', *, condition='<', thresh='0 degC', freq='YS', window=1, ds=None, after_date='07-01', **indexer)

First or last day of values fulfilling a condition.

Returns first or last day of period where values meet a given condition for a minimum number of consecutive days, limited to a starting or ending calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: which=first, constrain=(‘<’, ‘<=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • window (number) – Minimum number of days with values above thresh needed for evaluation. Default: 1. Default: 1.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • after_date (date (string, MM-DD)) – Date of the year after which to look for the first event, or before which to look for the last event. Should have the format ‘%m-%d’. None means there is no limit. Default: ‘07-01’.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, First day of year with a period of at least {window} days of minimum temperature below {thresh}. With additional attributes: description: First day of year with minimum temperature below {thresh} for at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.first_day_tx_above(tasmax='tasmax', *, condition='>', thresh='0 degC', freq='YS', window=1, ds=None, after_date='01-01', **indexer)

First or last day of values fulfilling a condition.

Returns first or last day of period where values meet a given condition for a minimum number of consecutive days, limited to a starting or ending calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: which=first, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • window (number) – Minimum number of days with values above thresh needed for evaluation. Default: 1. Default: 1.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • after_date (date (string, MM-DD)) – Date of the year after which to look for the first event, or before which to look for the last event. Should have the format ‘%m-%d’. None means there is no limit. Default: ‘01-01’.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, First day of year with a period of at least {window} days of maximum temperature above {thresh}. With additional attributes: description: First day of year with maximum temperature above {thresh} for at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.first_day_tx_below(tasmax='tasmax', *, condition='<', thresh='0 degC', freq='YS', window=1, ds=None, after_date='07-01', **indexer)

First or last day of values fulfilling a condition.

Returns first or last day of period where values meet a given condition for a minimum number of consecutive days, limited to a starting or ending calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: which=first, constrain=(‘<’, ‘<=’).

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • window (number) – Minimum number of days with values above thresh needed for evaluation. Default: 1. Default: 1.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • after_date (date (string, MM-DD)) – Date of the year after which to look for the first event, or before which to look for the last event. Should have the format ‘%m-%d’. None means there is no limit. Default: ‘07-01’.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, First day of year with a period of at least {window} days of maximum temperature below {thresh}. With additional attributes: description: First day of year with maximum temperature below {thresh} for at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.first_snowfall(prsn='prsn', *, thresh='1 mm/d', freq='YS-JUL', ds=None, **indexer)

First day where snowfall exceeded a given threshold

The first day where snowfall exceeded a given threshold during a time period (the threshold can be given as a snowfall flux or a liquid water equivalent snowfall rate).

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: condition=>=, date=None, which=first, window=1, constrain=None.

Parameters:
  • prsn (str or DataArray) – Surface snowfall flux. Default: ‘prsn’. [Required units : [mass]/([area]*[time])]

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘1 mm/d’. [Required units : ([mass]/([area]*[time]))]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, Date of first day where snowfall exceeded {thresh}. With additional attributes: description: {freq} first day where snowfall exceeded {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.fraction_over_precip_doy_thresh(pr='pr', pr_per='pr_per', *, thresh='1 mm/day', freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Fraction of precipitation due to wet days with daily precipitation over a given daily percentile.

The percentage of the total precipitation over a period occurring for days when the precipitation is above a threshold defining wet days and above a given percentile for that day.

This indicator will check for missing values according to the method “from_context”. Based on function fraction_over_precip_thresh().

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – Percentile of wet day precipitation flux. Either computed daily (one value per day of year) or computed over a period (one value per spatial point). Default: ‘pr_per’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Precipitation value over which a day is considered wet. Default: ‘1 mm/day’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – Fraction of precipitation due to days with daily precipitation above {pr_per_thresh}th daily percentile. With additional attributes: description: {freq} fraction of total precipitation due to days with precipitation above {pr_per_thresh}th daily percentile. Only days with at least {thresh} are included in the total. A {pr_per_window} day(s) window, centered on each calendar day in the {pr_per_period} period, is used to compute the {pr_per_thresh}th percentile(s).

Return type:

xarray.DataArray

xclim.indicators.atmos.fraction_over_precip_thresh(pr='pr', pr_per='pr_per', *, thresh='1 mm/day', freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Fraction of precipitation due to wet days with daily precipitation over a given percentile.

The percentage of the total precipitation over a period occurring for days when the precipitation is above a threshold defining wet days and above a given percentile for that day.

This indicator will check for missing values according to the method “from_context”. Based on function fraction_over_precip_thresh().

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – Percentile of wet day precipitation flux. Either computed daily (one value per day of year) or computed over a period (one value per spatial point). Default: ‘pr_per’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Precipitation value over which a day is considered wet. Default: ‘1 mm/day’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – Fraction of precipitation due to days with precipitation above {pr_per_thresh}th daily percentile. With additional attributes: description: {freq} fraction of total precipitation due to days with precipitation above {pr_per_thresh}th percentile of {pr_per_period} period. Only days with at least {thresh} are included in the total.

Return type:

xarray.DataArray

xclim.indicators.atmos.freezethaw_spell_frequency(tasmin='tasmin', tasmax='tasmax', *, thresh_tasmin='0 degC', thresh_tasmax='0 degC', window=1, condition_tasmin='<=', condition_tasmax='>', freq='YS', resample_before_rl=True, ds=None, **indexer)

Freeze-thaw spell frequency

Frequency of daily freeze-thaw spells. A freeze-thaw spell is defined as a number of consecutive days where maximum daily temperatures are above a given threshold and minimum daily temperatures are at or below a given threshold, usually 0°C for both.

This indicator will check for missing values according to the method “from_context”. Based on function multiday_temperature_swing(). With injected parameters: statistic=count.

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh_tasmin (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a freeze event. Default: ‘0 degC’. [Required units : [temperature]]

  • thresh_tasmax (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a thaw event. Default: ‘0 degC’. [Required units : [temperature]]

  • window (number) – The minimal length of spells to be included in the statistics. Default: 1.

  • condition_tasmin ({‘<’, ‘lt’, ‘<=’, ‘le’}) – Comparison operation for tasmin. Default: “<=”. Default: ‘<=’.

  • condition_tasmax ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation for tasmax. Default: “>”. Default: ‘>’.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Subsetting is done after finding the events, but before computing the statistic over them.

Returns:

xarray.DataArray, [time] – Frequency of events where maximum daily temperatures are above {thresh_tasmax} and minimum daily temperatures are at or below {thresh_tasmin} for at least {window} consecutive day(s).. With additional attributes: description: {freq} number of freeze-thaw spells, where maximum daily temperatures are above {thresh_tasmax} and minimum daily temperatures are at or below {thresh_tasmin} for at least {window} consecutive day(s).

Return type:

xarray.DataArray

Notes

Let \(TX_{i}\) be the maximum temperature at day \(i\) and \(TN_{i}\) be the daily minimum temperature at day \(i\). Then freeze thaw spells during a given period are consecutive days where:

\[TX_{i} > 0℃ \land TN_{i} < 0℃\]

This function returns a given statistic of the found lengths, optionally dropping those shorter than window. For example, window=1 and statistic=’sum’ returns the same value as daily_freezethaw_cycles().

xclim.indicators.atmos.freezethaw_spell_max_length(tasmin='tasmin', tasmax='tasmax', *, thresh_tasmin='0 degC', thresh_tasmax='0 degC', window=1, condition_tasmin='<=', condition_tasmax='>', freq='YS', resample_before_rl=True, ds=None, **indexer)

Maximal length of freeze-thaw spells

Maximal length of daily freeze-thaw spells. A freeze-thaw spell is defined as a number of consecutive days where maximum daily temperatures are above a given threshold and minimum daily temperatures are at or below a threshold, usually 0°C for both.

This indicator will check for missing values according to the method “from_context”. Based on function multiday_temperature_swing(). With injected parameters: statistic=max.

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh_tasmin (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a freeze event. Default: ‘0 degC’. [Required units : [temperature]]

  • thresh_tasmax (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a thaw event. Default: ‘0 degC’. [Required units : [temperature]]

  • window (number) – The minimal length of spells to be included in the statistics. Default: 1.

  • condition_tasmin ({‘<’, ‘lt’, ‘<=’, ‘le’}) – Comparison operation for tasmin. Default: “<=”. Default: ‘<=’.

  • condition_tasmax ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation for tasmax. Default: “>”. Default: ‘>’.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Subsetting is done after finding the events, but before computing the statistic over them.

Returns:

xarray.DataArray, [days] – Maximal length of events where maximum daily temperatures are above {thresh_tasmax} and minimum daily temperatures are at or below {thresh_tasmin} for at least {window} consecutive day(s).. With additional attributes: description: {freq} maximal length of freeze-thaw spells, where maximum daily temperatures are above {thresh_tasmax} and minimum daily temperatures are at or below {thresh_tasmin} for at least {window} consecutive day(s).

Return type:

xarray.DataArray

Notes

Let \(TX_{i}\) be the maximum temperature at day \(i\) and \(TN_{i}\) be the daily minimum temperature at day \(i\). Then freeze thaw spells during a given period are consecutive days where:

\[TX_{i} > 0℃ \land TN_{i} < 0℃\]

This function returns a given statistic of the found lengths, optionally dropping those shorter than window. For example, window=1 and statistic=’sum’ returns the same value as daily_freezethaw_cycles().

xclim.indicators.atmos.freezethaw_spell_mean_length(tasmin='tasmin', tasmax='tasmax', *, thresh_tasmin='0 degC', thresh_tasmax='0 degC', window=1, freq='YS', resample_before_rl=True, ds=None, **indexer)

Freeze-thaw spell mean length

Average length of daily freeze-thaw spells. A freeze-thaw spell is defined as a number of consecutive days where maximum daily temperatures are above a given threshold and minimum daily temperatures are at or below a given threshold, usually 0°C for both.

This indicator will check for missing values according to the method “from_context”. Based on function multiday_temperature_swing(). With injected parameters: statistic=mean, condition_tasmin=<=, condition_tasmax=>.

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh_tasmin (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a freeze event. Default: ‘0 degC’. [Required units : [temperature]]

  • thresh_tasmax (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a thaw event. Default: ‘0 degC’. [Required units : [temperature]]

  • window (number) – The minimal length of spells to be included in the statistics. Default: 1.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Subsetting is done after finding the events, but before computing the statistic over them.

Returns:

xarray.DataArray, [days] – Average length of events where maximum daily temperatures are above {thresh_tasmax} and minimum daily temperatures are at or below {thresh_tasmin} for at least {window} consecutive day(s).. With additional attributes: description: {freq} average length of freeze-thaw spells, where maximum daily temperatures are above {thresh_tasmax} and minimum daily temperatures are at or below {thresh_tasmin} for at least {window} consecutive day(s).

Return type:

xarray.DataArray

Notes

Let \(TX_{i}\) be the maximum temperature at day \(i\) and \(TN_{i}\) be the daily minimum temperature at day \(i\). Then freeze thaw spells during a given period are consecutive days where:

\[TX_{i} > 0℃ \land TN_{i} < 0℃\]

This function returns a given statistic of the found lengths, optionally dropping those shorter than window. For example, window=1 and statistic=’sum’ returns the same value as daily_freezethaw_cycles().

xclim.indicators.atmos.freezing_degree_days(tas='tas', *, thresh='0 degC', freq='YS', ds=None, **indexer)

Freezing degree days

The cumulative degree days for days when the average temperature is below a given threshold, typically 0°C.

This indicator will check for missing values according to the method “from_context”. Based on function integrated_difference(). With injected parameters: condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – The value threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_deficit_wrt_time, Cumulative sum of temperature degrees for mean daily temperature below {thresh}. With additional attributes: description: {freq} freezing degree days (mean temperature below {thresh})., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.freshet_start(tas='tas', *, condition='>', thresh='0 degC', freq='YS', window=5, ds=None, after_date='01-01', **indexer)

Day of year of spring freshet start

Day of year of the spring freshet start, defined as the first day when the temperature exceeds a certain threshold for a given number of consecutive days.

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: which=first, constrain=(‘>’, ‘>=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • window (number) – Minimum number of days with values above thresh needed for evaluation. Default: 1. Default: 5.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • after_date (date (string, MM-DD)) – Date of the year after which to look for the first event, or before which to look for the last event. Should have the format ‘%m-%d’. None means there is no limit. Default: ‘01-01’.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, First day where temperature threshold of {thresh} is exceeded for at least {window} days. With additional attributes: description: Day of year of the spring freshet start, defined as the first day a temperature threshold of {thresh} is exceeded for at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.frost_days(tasmin='tasmin', *, thresh='0 °C', freq='YS', ds=None, **indexer)

Frost days

Number of days where the daily minimum temperature is below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<, constrain=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘0 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Number of days where the daily minimum temperature is below {thresh}. With additional attributes: description: {freq} number of days where the daily minimum temperature is below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.frost_free_season_end(tasmin='tasmin', *, condition='>=', thresh='0 degC', window=5, freq='YS', mid_date='07-01', ds=None, **indexer)

Frost free season end

First day when the temperature is below a given threshold for a given number of consecutive days after a median calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: aspect=end, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Comparison operation. Computed as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘0 degC’. [Required units : ([temperature])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 5.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • mid_date (date (string, MM-DD)) – An optional middle date. The start must happen before and the end after for the season to be valid. Default: ‘07-01’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] or [time] – day_of_year, First day, after {mid_date}, following a period of {window} days with minimum daily temperature below {thresh}. With additional attributes: description: Day of the year of the end of the frost-free season, defined as the interval between the first set of {window} days when the minimum daily temperature is at or above {thresh} and the first set (after {mid_date}) of {window} days when it is below {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.frost_free_season_length(tasmin='tasmin', *, condition='>=', thresh='0 degC', window=5, freq='YS', mid_date='07-01', ds=None, **indexer)

Frost free season length

Duration of the frost free season, defined as the period when the minimum daily temperature is above 0°C without a freezing window of N days, with freezing occurring after a median calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: aspect=length, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Comparison operation. Computed as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘0 degC’. [Required units : ([temperature])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 5.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • mid_date (date (string, MM-DD)) – An optional middle date. The start must happen before and the end after for the season to be valid. Default: ‘07-01’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_above_threshold, Number of days between the first occurrence of at least {window} consecutive days with minimum daily temperature at or above {thresh} and the first occurrence of at least {window} consecutive days with minimum daily temperature below {thresh} after {mid_date}. With additional attributes: description: {freq} number of days between the first occurrence of at least {window} consecutive days with minimum daily temperature at or above {thresh} and the first occurrence of at least {window} consecutive days with minimum daily temperature below {thresh} after {mid_date}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.frost_free_season_start(tasmin='tasmin', *, condition='>=', thresh='0 degC', window=5, freq='YS', mid_date='07-01', ds=None, **indexer)

Frost free season start

First day when minimum daily temperature exceeds a given threshold for a given number of consecutive days

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: aspect=start, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Comparison operation. Computed as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘0 degC’. [Required units : ([temperature])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 5.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • mid_date (date (string, MM-DD)) – An optional middle date. The start must happen before and the end after for the season to be valid. Default: ‘07-01’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] or [time] – day_of_year, First day following a period of {window} days with minimum daily temperature at or above {thresh}. With additional attributes: description: Day of the year of the beginning of the frost-free season, defined as the {window}th consecutive day when minimum daily temperature exceeds {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.frost_free_spell_max_length(tasmin='tasmin', *, window=1, condition='>=', thresh='0 °C', freq='YS-JUL', resample_before_rl=True, ds=None, **indexer)

Frost free spell maximum length

The maximum length of a frost free period of N days or more, during which the minimum temperature over a given time window of days is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window_statistic=max, statistic=max, min_gap=1, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 1.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘0 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Maximum consecutive number of days in a frost free period of {window} day(s) or more, during which the minimum temperature within windows of {window} day(s) is above {thresh}.. With additional attributes: description: The maximum {freq} number of consecutive days in a frost free period of {window} day(s) or more, during which the minimum temperature within windows of {window} day(s) is above {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.frost_season_length(tasmin='tasmin', *, condition='<', thresh='0 degC', window=5, freq='YS-JUL', mid_date='01-01', ds=None, **indexer)

Frost season length

Duration of the freezing season, defined as the period when the daily minimum temperature is below 0°C without a thawing window of days, with the thaw occurring after a median calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: aspect=length, constrain=(‘<’, ‘<=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Comparison operation. Computed as data {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘0 degC’. [Required units : ([temperature])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 5.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • mid_date (date (string, MM-DD)) – An optional middle date. The start must happen before and the end after for the season to be valid. Default: ‘01-01’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Number of days between the first occurrence of at least {window} consecutive days with minimum daily temperature below {thresh} and the first occurrence of at least {window} consecutive days with minimum daily temperature at or above {thresh} after {mid_date}. With additional attributes: description: {freq} number of days between the first occurrence of at least {window} consecutive days with minimum daily temperature below {thresh} and the first occurrence of at least {window} consecutive days with minimum daily temperature at or above {thresh} after {mid_date}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.griffiths_drought_factor(pr='pr', smd='smd', *, limiting_func='xlim', ds=None)

Griffiths drought factor based on the soil moisture deficit.

The drought factor is a numeric indicator of the forest fire fuel availability in the deep litter bed. It is often used in the calculation of the McArthur Forest Fire Danger Index. The method implemented here follows Finkele et al. [2006].

Based on function griffiths_drought_factor().

Parameters:
  • pr (str or DataArray) – Total rainfall over previous 24 hours [mm/day]. Default: ‘pr’. [Required units : [precipitation]]

  • smd (str or DataArray) – Daily soil moisture deficit (often KBDI) [mm/day]. Default: ‘smd’. [Required units : [precipitation]]

  • limiting_func ({‘xlim’, ‘discrete’}) – How to limit the values of the drought factor. If “xlim” (default), use equation (14) in Finkele et al. [2006]. If “discrete”, use equation Eq (13) in Finkele et al. [2006], but with the lower limit of each category bound adjusted to match the upper limit of the previous bound. Default: ‘xlim’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – griffiths_drought_factor, Griffiths Drought Factor. With additional attributes: description: Numeric indicator of the forest fire fuel availability in the deep litter bed

Return type:

xarray.DataArray

Notes

Calculation of the Griffiths drought factor depends on the rainfall over the previous 20 days. Thus, the first non-NaN time point in the drought factor returned by this function corresponds to the 20th day of the input data.

References

Finkele, Mills, Beard, and Jones [2006], Griffiths [1999], Holgate, Van DIjk, Cary, and Yebra [2017]

xclim.indicators.atmos.growing_degree_days(tas='tas', *, thresh='4.0 degC', freq='YS', ds=None, **indexer)

Growing degree days

The cumulative degree days for days when the average temperature is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function integrated_difference(). With injected parameters: condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – The value threshold. Default: ‘4.0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_excess_wrt_time, Cumulative sum of temperature degrees for mean daily temperature above {thresh}. With additional attributes: description: {freq} growing degree days (mean temperature above {thresh})., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.growing_season_end(tas='tas', *, condition='>=', thresh='5.0 degC', window=5, freq='YS', mid_date='07-01', ds=None, **indexer)

Growing season end

The first day when the temperature is below a certain threshold for a certain number of consecutive days after a given calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: aspect=end, constrain=(‘>’, ‘>=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Comparison operation. Computed as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘5.0 degC’. [Required units : ([temperature])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 5.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • mid_date (date (string, MM-DD)) – An optional middle date. The start must happen before and the end after for the season to be valid. Default: ‘07-01’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] or [time] – day_of_year, First day of the first series of {window} days with mean daily temperature {condition} {thresh}, occurring after {mid_date}. With additional attributes: description: Day of year of end of growing season, defined as the first day of consistent inferior threshold temperature of {thresh} after a run of {window} days superior to threshold temperature, occurring after {mid_date}.

Return type:

xarray.DataArray

xclim.indicators.atmos.growing_season_length(tas='tas', *, condition='>=', thresh='5.0 degC', window=5, freq='YS', mid_date='07-01', ds=None, **indexer)

Growing season length

Number of days between the first occurrence of a series of days with a daily average temperature above a threshold and the first occurrence of a series of days with a daily average temperature below that same threshold, occurring after a given calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: aspect=length, constrain=(‘>’, ‘>=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Comparison operation. Computed as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘5.0 degC’. [Required units : ([temperature])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 5.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • mid_date (date (string, MM-DD)) – An optional middle date. The start must happen before and the end after for the season to be valid. Default: ‘07-01’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – growing_season_length, Number of days between the first occurrence of at least {window} consecutive days with mean daily temperature over {thresh} and the first occurrence of at least {window} consecutive days with mean daily temperature below {thresh}, occurring after {mid_date}. With additional attributes: description: {freq} number of days between the first occurrence of at least {window} consecutive days with mean daily temperature over {thresh} and the first occurrence of at least {window} consecutive days with mean daily temperature below {thresh}, occurring after {mid_date}.

Return type:

xarray.DataArray

xclim.indicators.atmos.growing_season_start(tas='tas', *, condition='>=', thresh='5.0 degC', window=5, freq='YS', mid_date='07-01', ds=None, **indexer)

Growing season start

The first day when the temperature exceeds a certain threshold for a given number of consecutive days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: aspect=start, constrain=(‘>’, ‘>=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Comparison operation. Computed as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘5.0 degC’. [Required units : ([temperature])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 5.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • mid_date (date (string, MM-DD)) – An optional middle date. The start must happen before and the end after for the season to be valid. Default: ‘07-01’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] or [time] – day_of_year, First day of the first series of {window} days with mean daily temperature {condition} {thresh}. With additional attributes: description: Day of the year marking the beginning of the growing season, defined as the first day of the first series of {window} days with mean daily temperature {condition} {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.heat_spell_frequency(tasmin='tasmin', tasmax='tasmax', *, window=3, freq='YS', min_gap=1, resample_before_rl=True, ds=None, win_reducer='mean', thresh_tasmin='20 °C', thresh_tasmax='33 °C', **indexer)

Heat spell frequency

Number of heat spells. A heat spell occurs when rolling averages of daily minimum and maximumtemperatures exceed given thresholds for a number of days.

This indicator will check for missing values according to the method “from_context”. Based on function bivariate_spell_length_statistics(). With injected parameters: condition=>=, statistic=count, constrain=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • min_gap (number) – The shortest possible gap between two spells. Spells closer than this are merged by assigning the gap steps to the merged spell. Default: 1.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • win_reducer ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘mean’.

  • thresh_tasmin (quantity (string or DataArray, with units)) – Threshold for tasmin Default: ‘20 °C’. [Required units : ([temperature])]

  • thresh_tasmax (quantity (string or DataArray, with units)) – Threshold for tasmax Default: ‘33 °C’. [Required units : ([temperature])]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray – Number of heat spells. With additional attributes: description: {freq} number of heat spells events. A heat spell occurs when the {window}-day averages of daily minimum and maximum temperatures each exceed {thresh_tasmin} and {thresh_tasmax}. All days of the {window}-day period are considered part of the spell. Gaps of fewer than {min_gap} day(s) are allowed within a spell.

Return type:

xarray.DataArray

xclim.indicators.atmos.heat_spell_max_length(tasmin='tasmin', tasmax='tasmax', *, window=3, freq='YS', min_gap=1, resample_before_rl=True, ds=None, win_reducer='mean', thresh_tasmin='20 °C', thresh_tasmax='33 °C', **indexer)

Heat spell maximum length

The longest heat spell of a period. A heat spell occurs when rolling averages of daily minimum and maximum temperatures exceed given thresholds for a number of days.

This indicator will check for missing values according to the method “from_context”. Based on function bivariate_spell_length_statistics(). With injected parameters: condition=>=, statistic=max, constrain=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • min_gap (number) – The shortest possible gap between two spells. Spells closer than this are merged by assigning the gap steps to the merged spell. Default: 1.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • win_reducer ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘mean’.

  • thresh_tasmin (quantity (string or DataArray, with units)) – Threshold for tasmin Default: ‘20 °C’. [Required units : ([temperature])]

  • thresh_tasmax (quantity (string or DataArray, with units)) – Threshold for tasmax Default: ‘33 °C’. [Required units : ([temperature])]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_above_threshold, Longest heat spell. With additional attributes: description: {freq} maximum length of heat spells. A heat spell occurs when the {window}-day averages of daily minimum and maximum temperatures each exceed {thresh_tasmin} and {thresh_tasmax}. All days of the {window}-day period are considered part of the spell. Gaps of fewer than {min_gap} day(s) are allowed within a spell.

Return type:

xarray.DataArray

xclim.indicators.atmos.heat_spell_total_length(tasmin='tasmin', tasmax='tasmax', *, window=3, freq='YS', min_gap=1, resample_before_rl=True, ds=None, win_reducer='mean', thresh_tasmin='20 °C', thresh_tasmax='33 °C', **indexer)

Heat spell total length

Total length of heat spells. A heat spell occurs when rolling averages of daily minimum and maximum temperatures exceed given thresholds for a number of days.

This indicator will check for missing values according to the method “from_context”. Based on function bivariate_spell_length_statistics(). With injected parameters: condition=>=, statistic=sum, constrain=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • min_gap (number) – The shortest possible gap between two spells. Spells closer than this are merged by assigning the gap steps to the merged spell. Default: 1.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • win_reducer ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘mean’.

  • thresh_tasmin (quantity (string or DataArray, with units)) – Threshold for tasmin Default: ‘20 °C’. [Required units : ([temperature])]

  • thresh_tasmax (quantity (string or DataArray, with units)) – Threshold for tasmax Default: ‘33 °C’. [Required units : ([temperature])]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_above_threshold, Total length of heat spells.. With additional attributes: description: {freq} total length of heat spell events. A heat spell occurs when the {window}-day  averages of daily minimum and maximum temperatures each exceed {thresh_tasmin} and {thresh_tasmax}.  All days of the {window}-day period are considered part of the spell. Gaps of fewer than {min_gap} day(s) are allowed within a spell.

Return type:

xarray.DataArray

xclim.indicators.atmos.heat_wave_frequency(tasmin='tasmin', tasmax='tasmax', *, window=3, condition='>', freq='YS', resample_before_rl=True, ds=None, thresh_tasmin='22 °C', thresh_tasmax='30 °C', **indexer)

Heat wave frequency

Number of heat waves. A heat wave occurs when daily minimum and maximum temperatures exceed given thresholds for a number of days.

This indicator will check for missing values according to the method “from_context”. Based on function bivariate_spell_length_statistics(). With injected parameters: window_statistic=min, statistic=count, min_gap=1, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>’.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • thresh_tasmin (quantity (string or DataArray, with units)) – Threshold to test against for data1. Default: ‘22 °C’. [Required units : ([temperature])]

  • thresh_tasmax (quantity (string or DataArray, with units)) – Threshold to test against for data2. Default: ‘30 °C’. [Required units : ([temperature])]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray – Total number of series of at least {window} consecutive days with daily minimum temperature above {thresh_tasmin} and daily maximum temperature above {thresh_tasmax}. With additional attributes: description: {freq} number of heat wave events within a given period. A heat wave occurs when daily minimum and maximum temperatures exceed {thresh_tasmin} and {thresh_tasmax}, respectively, over at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.heat_wave_index(tasmax='tasmax', *, thresh='25 degC', window=5, freq='YS', op='>', resample_before_rl=True, ds=None)

Heat wave index

Number of days that constitute heatwave events. A heat wave occurs when daily minimum and maximum temperatures exceed given thresholds for a number of days.

This indicator will check for missing values according to the method “from_context”. Based on function hot_spell_total_length().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a hot spell. Default: ‘25 degC’. [Required units : [temperature]]

  • window (number) – Minimum number of days with temperatures below the threshold to qualify as a hot spell. Default: 5.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • op ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – Total number of days constituting events of at least {window} consecutive days with daily maximum temperature above {thresh}. With additional attributes: description: {freq} total number of days that are part of a heatwave within a given period. A heat wave occurs when daily maximum temperatures exceed {thresh} over at least {window} days.

Return type:

xarray.DataArray

Notes

The threshold on tasmax follows the one used in heat waves. A day temperature threshold between 30° and 35°C was selected by Health Canada professionals, following a temperature–mortality analysis. This absolute temperature threshold characterize the occurrence of hot weather events that can result in adverse health outcomes for Canadian communities [Casati et al., 2013].

In Robinson [2001] where heat waves are also considered, the corresponding parameters would be thresh=39.44, window=2 (103F).

xclim.indicators.atmos.heat_wave_max_length(tasmin='tasmin', tasmax='tasmax', *, window=3, condition='>', freq='YS', resample_before_rl=True, ds=None, thresh_tasmin='22 °C', thresh_tasmax='30 °C', **indexer)

Heat wave maximum length

Maximal duration of heat waves. A heat wave occurs when daily minimum and maximum temperatures exceed given thresholds for a number of days.

This indicator will check for missing values according to the method “from_context”. Based on function bivariate_spell_length_statistics(). With injected parameters: window_statistic=min, statistic=max, min_gap=1, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>’.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • thresh_tasmin (quantity (string or DataArray, with units)) – Threshold to test against for data1. Default: ‘22 °C’. [Required units : ([temperature])]

  • thresh_tasmax (quantity (string or DataArray, with units)) – Threshold to test against for data2. Default: ‘30 °C’. [Required units : ([temperature])]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_above_threshold, Longest series of at least {window} consecutive days with daily minimum temperature above {thresh_tasmin} and daily maximum temperature above {thresh_tasmax}. With additional attributes: description: {freq} maximum length of heat wave events occurring within a given period. A heat wave occurs when daily minimum and maximum temperatures exceed {thresh_tasmin} and {thresh_tasmax}, respectively, over at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.heat_wave_total_length(tasmin='tasmin', tasmax='tasmax', *, window=3, condition='>', freq='YS', resample_before_rl=True, ds=None, thresh_tasmin='22 °C', thresh_tasmax='30 °C', **indexer)

Heat wave total length

Total length of heat waves. A heat wave occurs when daily minimum and maximum temperatures exceed given thresholds for a number of days.

This indicator will check for missing values according to the method “from_context”. Based on function bivariate_spell_length_statistics(). With injected parameters: window_statistic=min, statistic=sum, min_gap=1, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>’.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • thresh_tasmin (quantity (string or DataArray, with units)) – Threshold to test against for data1. Default: ‘22 °C’. [Required units : ([temperature])]

  • thresh_tasmax (quantity (string or DataArray, with units)) – Threshold to test against for data2. Default: ‘30 °C’. [Required units : ([temperature])]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_above_threshold, Total length of events of at least {window} consecutive days with daily minimum temperature above {thresh_tasmin} and daily maximum temperature above {thresh_tasmax}. With additional attributes: description: {freq} total length of heat wave events occurring within a given period. A heat wave occurs when daily minimum and maximum temperatures exceed {thresh_tasmin} and {thresh_tasmax}, respectively, over at least {window} days.

Return type:

xarray.DataArray

xclim.indicators.atmos.heating_degree_days(tas='tas', *, thresh='17.0 degC', freq='YS', ds=None, **indexer)

Heating degree days

The cumulative degree days for days when the mean daily temperature is below a given threshold and buildings must be heated.

This indicator will check for missing values according to the method “from_context”. Based on function integrated_difference(). With injected parameters: condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – The value threshold. Default: ‘17.0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_deficit_wrt_time, Cumulative sum of temperature degrees for mean daily temperature below {thresh}. With additional attributes: description: {freq} cumulative heating degree days (mean temperature below {thresh})., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.heating_degree_days_approximation(tasmax='tasmax', tasmin='tasmin', tas='tas', *, thresh='17.0 degC', freq='YS', ds=None, **indexer)

Heating degree days approximation

The cumulative degree days for days where temperatures are below a given threshold and buildings must be heated. This method integrates mean, minimum, and maximum temperatures, accounting for asymmetry in the distributions of temperatures throughout the diurnal cycle.

This indicator will check for missing values according to the method “from_context”. Based on function degree_days_below_approximation().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Temperature threshold below which degree days are accumulated. Default: ‘17.0 degC’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_deficit_wrt_time, Cumulative sum of temperature degrees for daily temperatures below {thresh}. With additional attributes: description: {freq} cumulative heating degree days (temperature below {thresh}) using a combination of minimum, maximum, and mean daily temperatures., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

For each day, the integrated quantity depends on where the threshold lies in relation to the 3 temperature statistics.

  • thresh > tasmax : (thresh - tas)

  • tasmax >= thresh > tas : (thresh - tasmin) / 2 - (tasmax - thresh) / 4

  • tas >= thresh > tasmin : (thresh - tasmin) / 4

  • tasmin > thresh : 0.

References

Spinoni, Vogt, Barbosa, Dosio, McCormick, Bigano, and Füssel [2018]

xclim.indicators.atmos.high_precip_low_temp(pr='pr', tas='tas', *, freq='YS', ds=None, pr_thresh='0.4 mm/d', tas_thresh='-0.2 degC', **indexer)

Days with precipitation and cold temperature

Number of days with precipitation above a given threshold and temperature below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function bivariate_count_occurrences(). With injected parameters: condition1=>=, condition2=<, var_reducer=all, constrain1=None, constrain2=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • pr_thresh (quantity (string or DataArray, with units)) – Threshold for data variable 1. Default: ‘0.4 mm/d’. [Required units : ([precipitation])]

  • tas_thresh (quantity (string or DataArray, with units)) – Threshold for data variable 2. If None, thresh1 is used. Default: ‘-0.2 degC’. [Required units : ([temperature])]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Days with precipitation at or above {pr_thresh} and temperature below {tas_thresh}. With additional attributes: description: {freq} number of days with precipitation at or above {pr_thresh} and temperature below {tas_thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Sampling length is derived from data1.

xclim.indicators.atmos.hot_days(tasmax='tasmax', *, thresh='25 °C', freq='YS', ds=None, **indexer)

Hot days

Number of days where the daily maximum temperature is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>, constrain=>.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘25 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_above_threshold, Number of days where the daily maximum temperature is above {thresh}. With additional attributes: description: {freq} number of days where the daily maximum temperature is above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.hot_spell_frequency(tasmax='tasmax', *, window=3, condition='>', thresh='30 °C', freq='YS', resample_before_rl=True, ds=None, **indexer)

Hot spell frequency

The frequency of hot periods of N days or more, during which the temperature over a given time window of days is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window_statistic=min, statistic=count, min_gap=1, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘30 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray – Number of hot periods of {window} day(s) or more, during which the temperature on a window of {window} day(s) is above {thresh}.. With additional attributes: description: The {freq} number of hot periods of {window} day(s) or more, during which the temperature on a window of {window} day(s) is above {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.hot_spell_max_length(tasmax='tasmax', *, window=1, condition='>', thresh='30 °C', freq='YS', resample_before_rl=True, ds=None, **indexer)

Hot spell maximum length

The maximum length of a hot period of N days or more, during which the temperature over a given time window of days is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window_statistic=min, statistic=max, min_gap=1, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 1.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘30 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Maximum consecutive number of days in a hot period of {window} day(s) or more, during which the temperature within windows of {window} day(s) is above {thresh}.. With additional attributes: description: The maximum {freq} number of consecutive days in a hot period of {window} day(s) or more, during which the temperature within windows of {window} day(s) is above {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.hot_spell_max_magnitude(tasmax='tasmax', *, thresh='25.0 degC', window=3, freq='YS', resample_before_rl=True, ds=None)

Hot spell maximum magnitude

Magnitude of the most intensive heat wave per {freq}. A heat wave occurs when daily maximum temperatures exceed given thresholds for a number of days.

This indicator will check for missing values according to the method “from_context”. Based on function hot_spell_max_magnitude().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold temperature on which to designate a heatwave. Default: ‘25.0 degC’. [Required units : [temperature]]

  • window (number) – Minimum number of days with temperature above the threshold to qualify as a heatwave. Default: 3.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K d] – Maximum cumulative difference between daily maximum temperature and {thresh} for days within a heat wave. A heat wave is defined as a series of at least {window} consecutive days with daily maximum temperature above {thresh}.. With additional attributes: description: Magnitude of the most intensive heat wave per {freq}. The magnitude is the cumulative exceedance of daily maximum temperature over {thresh}. A heat wave is defined as a series of at least {window} consecutive days with daily maximum temperature above {thresh}

Return type:

xarray.DataArray

References

Russo, Dosio, Graversen, Sillmann, Carrao, Dunbar, Singleton, Montagna, Barbola, and Vogt [2014], Zhang, She, Zhang, Wang, Chen, and Hao [2022].

xclim.indicators.atmos.hot_spell_total_length(tasmax='tasmax', *, window=3, condition='>', thresh='30 °C', freq='YS', resample_before_rl=True, ds=None, **indexer)

Hot spell total length

The total length of hot periods of N days or more, during which the temperature over a given time window of days is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window_statistic=min, statistic=sum, min_gap=1, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • window (number) – Minimum length of a spell. Default: 3.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘30 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Number of days in hot periods of {window} day(s) or more, during which thetemperature within windows of {window} day(s) is above {thresh}.. With additional attributes: description: The {freq} number of days in hot periods of {window} day(s) or more, during which the temperature within windows of {window} day(s) is above {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.huglin_index(tas='tas', tasmax='tasmax', lat='lat', *, thresh='10 degC', method='jones', cap_value=1.0, start_date='04-01', end_date='10-01', freq='YS', ds=None)

Huglin heliothermal index

Heat-summation index for agroclimatic suitability estimation, developed specifically for viticulture. Considers daily minimum and maximum temperature with a given base threshold, typically between 1 April and 30September, and integrates a day-length coefficient calculation for higher latitudes. Metric originally published in Huglin (1978). Day-length coefficient based on Hall & Jones (2010).

This indicator will check for missing values according to the method “from_context”. Based on function huglin_index().

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • lat (str or DataArray) – Latitude coordinate. If None, a CF-conformant “latitude” field must be available within the passed DataArray. Default: ‘lat’. [Required units : []]

  • thresh (quantity (string or DataArray, with units)) – The temperature threshold. Default: “10 degC”. Default: ‘10 degC’. [Required units : [temperature]]

  • method ({‘interpolated’, ‘huglin’, ‘jones’}) – The formula to use for the latitude coefficient calculation. The “huglin” method uses a stepwise latitude coefficient for values between 40° and 50° based on Huglin [1978]. The “interpolated” method uses a smoothed curve latitude coefficient for values based on the intervals set in Huglin [1978]. The “jones” method integrates axial tilt, latitude, and day-of-year based on Hall and Jones [2010]. Default: ‘jones’.

  • cap_value (number) – The value to use for the latitude coefficient when latitude is above 50°N or below 50°S. Only applicable for methods “huglin” and “interpolated” (default: 1.0). Default: 1.0.

  • start_date (date (string, MM-DD)) – The hemisphere-based start date to consider (north = April, south = October). Default: ‘04-01’.

  • end_date (date (string, MM-DD)) – The hemisphere-based start date to consider (north = October, south = April). This date is non-inclusive. Default: ‘10-01’.

  • freq ({‘YS’, ‘YS-JAN’, ‘YS-JUL’}) – Resampling frequency (default: “YS”; For Southern Hemisphere, should be “YS-JUL”). Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [unitless] – Integral of mean daily temperature above {thresh} multiplied by day-length coefficient with {method} method for days between {start_date} and {end_date}. With additional attributes: description: Heat-summation index for agroclimatic suitability estimation, developed specifically for viticulture, computed with {method} formula (Summation of ((Tn + Tx)/2 - {thresh}) * k), where coefficient `k` is a latitude-based day-length for days between {start_date} and {end_date}.

Return type:

xarray.DataArray

Notes

Let \(TX_{i}\) and \(TG_{i}\) be the daily maximum and mean temperature at day \(i\) and \(T_{thresh}\) the base threshold needed for heat summation (typically, 10 degC). A day-length multiplication, \(k\), based on latitude, \(lat\), is also considered. Then the heliothermal index for dates between 1 April and 30 September is:

\[HI = \sum_{i=\text{April 1}}^{\text{September 30}} \left(\frac{TX_i + TG_i}{2} - T_{thresh} \right) * k\]

There are a few methods provided for calculating the day-length multiplication factor (\(k\)) based on latitude:

  • For the “huglin” and “interpolated” methods, values for k increase from 1.0 at 40°N or 40°S to 1.06 at 50°N or 50°S, where the interpolated method uses a smoothed curve and the huglin method uses a stepwise function. Values above 50°N or below 50°S are set via the cap_value variable, with 1.0 set as default. See: xclim.compute.helpers.huglin_day_length_latitude_coefficient() for more information.

  • For the “jones” method, A more robust day-length calculation based on latitude, calendar, day-of-year, and obliquity is used. The current implementation requires an annual frequency for consistent results. See: xclim.compute.generic.jones_day_length_coefficient() or Hall and Jones [2010] for more information.

For compatibility with the original ICCLIM implementation [Project team ECA&D and KNMI, 2013], end_date should be set to 11-01 with method=”huglin”.

References

Hall and Jones [2010], Huglin [1978]

xclim.indicators.atmos.ice_days(tasmax='tasmax', *, thresh='0 °C', freq='YS', ds=None, **indexer)

Ice days

Number of days where the daily maximum temperature is below 0°C

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<, constrain=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘0 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Number of days with maximum daily temperature below {thresh}. With additional attributes: description: {freq} number of days where the maximum daily temperature is below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.jetstream_metric_woollings(ua='ua', *, ds=None)

Strength and latitude of jetstream

Identify latitude and strength of maximum smoothed zonal wind speed in the region from 15 to 75°N and -60 to 0°E, using the formula outlined in [Woollings et al., 2010]. Wind is smoothened using a Lanczos filter approach.

Based on function jetstream_metric_woollings().

Parameters:
  • ua (str or DataArray) – Eastward wind component (u) at between 750 and 950 hPa. Default: ‘ua’. [Required units : [speed]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

  • jetlat (xarray.DataArray, [degrees_north]) – Latitude of maximum smoothed zonal wind speed. With additional attributes: description: Daily latitude of maximum Lanczos smoothed zonal wind speed.

  • jetstr (xarray.DataArray, [m s-1]) – Maximum strength of smoothed zonal wind speed. With additional attributes: description: Daily maximum strength of Lanczos smoothed zonal wind speed.

Return type:

tuple[xarray.DataArray, xarray.DataArray]

References

Woollings, Hannachi, and Hoskins [2010]

xclim.indicators.atmos.keetch_byram_drought_index(pr='pr', tasmax='tasmax', pr_annual='pr_annual', kbdi0=None, *, ds=None)

Keetch-Byram drought index (KBDI) for soil moisture deficit.

The KBDI indicates the amount of water necessary to bring the soil moisture content back to field capacity. It is often used in the calculation of the McArthur Forest Fire Danger Index. The method implemented here follows Finkele et al. [2006] but limits the maximum KBDI to 203.2 mm, rather than 200 mm, in order to align best with the majority of the literature.

Based on function keetch_byram_drought_index().

Parameters:
  • pr (str or DataArray) – Total rainfall over previous 24 hours [mm/day]. Default: ‘pr’. [Required units : [precipitation]]

  • tasmax (str or DataArray) – Maximum temperature near the surface over previous 24 hours [degC]. Default: ‘tasmax’. [Required units : [temperature]]

  • pr_annual (str or DataArray) – Mean (over years) annual accumulated rainfall [mm/year]. Default: ‘pr_annual’. [Required units : [precipitation]]

  • kbdi0 (str or DataArray, optional) – Previous KBDI values used to initialise the KBDI calculation [mm/day]. Defaults to 0. Default: None. [Required units : [precipitation]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm/day] – keetch_byram_drought_index, Keetch-Byran Drought Index. With additional attributes: description: Amount of water necessary to bring the soil moisture content back to field capacity

Return type:

xarray.DataArray

Notes

This method implements the method described in Finkele et al. [2006] (section 2.1.1) for calculating the KBDI with one small difference: in Finkele et al. [2006] the maximum KBDI is limited to 200 mm to represent the maximum field capacity of the soil (8 inches according to Keetch and Byram [1968]). However, it is more common in the literature to limit the KBDI to 203.2 mm which is a more accurate conversion from inches to mm. In this function, the KBDI is limited to 203.2 mm.

References

Dolling, Chu, and Fujioka [2005], Finkele, Mills, Beard, and Jones [2006], Holgate, Van DIjk, Cary, and Yebra [2017], Keetch and Byram [1968]

xclim.indicators.atmos.last_snowfall(prsn='prsn', *, thresh='1 mm/d', freq='YS-JUL', ds=None, **indexer)

Last day where snowfall exceeded a given threshold

The last day where snowfall exceeded a given threshold during a time period (the threshold can be given as a snowfall flux or a liquid water equivalent snowfall rate).

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: condition=>=, date=None, which=last, window=1, constrain=None.

Parameters:
  • prsn (str or DataArray) – Surface snowfall flux. Default: ‘prsn’. [Required units : [mass]/([area]*[time])]

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘1 mm/d’. [Required units : ([mass]/([area]*[time]))]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, Date of last day where snowfall exceeded {thresh}. With additional attributes: description: {freq} last day where snowfall exceeded {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.last_spring_frost(tasmin='tasmin', *, condition='<', thresh='0°C', freq='YS', window=1, ds=None, before_date='07-01', **indexer)

Last spring frost

The last day when minimum temperature is below a given threshold for a certain number of days, limited by a final calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function day_threshold_reached(). With injected parameters: which=last, constrain=(‘<’, ‘<=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold. Default: ‘0°C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • window (number) – Minimum number of days with values above thresh needed for evaluation. Default: 1. Default: 1.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • before_date (date (string, MM-DD)) – Date of the year after which to look for the first event, or before which to look for the last event. Should have the format ‘%m-%d’. None means there is no limit. Default: ‘07-01’.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – day_of_year, Last day of minimum daily temperature below a threshold of {thresh} for at least {window} days before a given date ({before_date}). With additional attributes: description: Day of year of last spring frost, defined as the last day a minimum temperature remains below a threshold of {thresh} for at least {window} days before a given date ({before_date}).

Return type:

xarray.DataArray

xclim.indicators.atmos.late_frost_days(tasmin='tasmin', *, thresh='0 °C', freq='YS', ds=None, **indexer)

Late frost days

Number of days where the daily minimum temperature is below a given threshold between a givenstart date and a given end date.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<, constrain=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘0 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Number of days where the daily minimum temperature is below {thresh}. With additional attributes: description: {freq} number of days where the daily minimum temperature is below {thresh}over the period {indexer}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.latitude_temperature_index(tas='tas', lat='lat', *, freq='YS', ds=None)

Latitude temperature index

A climate indice based on mean temperature of the warmest month and a latitude-based coefficient to account for longer day-length favouring growing conditions. Developed specifically for viticulture. Mean temperature of warmest month multiplied by the difference of latitude factor coefficient minus latitude. Metric originally published in Jackson, D. I., & Cherry, N. J. (1988).

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function latitude_temperature_index(). With injected parameters: lat_factor=60.

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • lat (str or DataArray) – Latitude coordinate. If None, a CF-conformant “latitude” field must be available within the passed DataArray. Default: ‘lat’. [Required units : []]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [unitless] – Mean temperature of warmest month multiplied by the difference of {lat_factor} minus latitude. With additional attributes: description: A climate indice based on mean temperature of the warmest month and a latitude-based coefficient to account for longer day-length favouring growing conditions. Developed specifically for viticulture. Mean temperature of warmest month multiplied by the difference of {lat_factor} minus latitude.

Return type:

xarray.DataArray

Notes

The latitude factor of 75 is provided for examining the poleward expansion of wine-growing climates under scenarios of climate change [Kenny and Shao, 1992]. For comparing 20th century/observed historical records, the original scale factor of 60 is more appropriate [Jackson and Cherry, 1988].

Let \(Tn_{j}\) be the average temperature for a given month \(j\), \(lat_{f}\) be the latitude factor, and \(lat\) be the latitude of the area of interest. Then the Latitude-Temperature Index (\(LTI\)) is:

\[LTI = max(TN_{j}: j = 1..12)(lat_f - | lat | )\]

References

Jackson and Cherry [1988], Kenny and Shao [1992]

xclim.indicators.atmos.liquid_precip_accumulation(pr='pr', tas='tas', *, thresh='0 degC', freq='YS', ds=None, **indexer)

Total accumulated liquid precipitation.

Total accumulated liquid precipitation. Precipitation is considered liquid when the average daily temperature is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function precip_accumulation(). With injected parameters: phase=liquid.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean, maximum or minimum daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold of tas over which the precipication is assumed to be liquid rain. Default: ‘0 degC’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_liquid_precipitation_amount, Total accumulated precipitation when temperature is above {thresh}. With additional attributes: description: {freq} total {phase} precipitation, estimated as precipitation when temperature is above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation of day \(i\), then for a period \(j\) starting at day \(a\) and finishing on day \(b\):

\[PR_{ij} = \sum_{i=a}^{b} PR_i\]

If tas and phase are given, the corresponding phase precipitation is estimated before computing the accumulation, using one of snowfall_approximation or rain_approximation with the binary method.

xclim.indicators.atmos.liquid_precip_average(pr='pr', tas='tas', *, thresh='0 degC', freq='YS', ds=None, **indexer)

Averaged liquid precipitation.

Averaged liquid precipitation. Precipitation is considered liquid when the average daily temperature is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function precip_average(). With injected parameters: phase=liquid.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean, maximum or minimum daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold of tas over which the precipication is assumed to be liquid rain. Default: ‘0 degC’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm] – lwe_average_of_liquid_precipitation_amount, Averaged precipitation when temperature is above {thresh}. With additional attributes: description: {freq} mean {phase} precipitation, estimated as precipitation when temperature is above {thresh}., cell_methods: time: mean over days

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation of day \(i\), then for a period \(j\) starting at day \(a\) and finishing on day \(b\):

\[PR_{ij} =\frac{ \sum_{i=a}^{b} PR_i }{b - a + 1}\]

If tas and phase are given, the corresponding phase precipitation is estimated before computing the accumulation, using one of snowfall_approximation or rain_approximation with the binary method.

xclim.indicators.atmos.liquid_precip_ratio(pr='pr', tas='tas', prra=None, *, thresh='0 degC', freq='QS-DEC', ds=None, **indexer)

Fraction of liquid to total precipitation

The ratio of total liquid precipitation over the total precipitation. Liquid precipitation is approximated from total precipitation on days where temperature is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function liquid_precip_ratio(). With injected parameters: prsn=None.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • prra (str or DataArray, optional) – Mean daily liquid precipitation flux. Default: None.

  • thresh (quantity (string or DataArray, with units)) – Threshold temperature under which precipitation is assumed to be solid. Default: ‘0 degC’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘QS-DEC’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – Fraction of liquid to total precipitation (temperature above {thresh}). With additional attributes: description: The {freq} ratio of rainfall to total precipitation. Rainfall is estimated as precipitation on days where temperature is above {thresh}.

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation on day \(i\), and \(PRSN_i\) the mean daily solid precipitation. For a period \(j\) starting on day \(a\) and ending on day \(b\):

\[PR_{j} = \sum_{i=a}^{b} PR_i\]
\[PR^{\mathrm{liquid}}_{j} = \sum_{i=a}^{b} (PR_i - PRSN_i)\]

The liquid precipitation ratio is then:

\[R_j = \frac{PR^{\mathrm{liquid}}_{j}}{PR_j}\]
xclim.indicators.atmos.max_1day_precipitation_amount(pr='pr', *, freq='YS', ds=None, **indexer)

Maximum 1-day total precipitation

Maximum total daily precipitation for a given period.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm/day] – lwe_thickness_of_precipitation_amount, Maximum 1-day total precipitation. With additional attributes: description: {freq} maximum 1-day total precipitation, cell_methods: time: maximum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.max_daily_temperature_range(tasmin='tasmin', tasmax='tasmax', *, statistic='max', freq='YS', ds=None, **indexer)

Maximum of daily temperature range

The maximum difference between the daily maximum and minimum temperatures.

This indicator will check for missing values according to the method “from_context”. Based on function difference_statistics(). With injected parameters: absolute=False.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • statistic ({‘max’, ‘min’, ‘mean’, ‘sum’}) – The statistic to compute over the difference between the two variables. Default: ‘max’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Maximum diurnal temperature range. With additional attributes: description: {freq} maximum diurnal temperature range., cell_methods: time range within days time: max over days

Return type:

xarray.DataArray

xclim.indicators.atmos.max_n_day_precipitation_amount(pr='pr', *, window, freq='YS', ds=None, **indexer)

maximum n-day total precipitation

Maximum of the moving sum of daily precipitation for a given period.

This indicator will check for missing values according to the method “from_context”. Based on function running_statistics(). With injected parameters: window_statistic=integral, statistic=max, window_center=True, out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Size of the rolling window. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Resampling is done after the running statistic. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Time selection is done after applying the running statistic.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, maximum {window}-day total precipitation amount. With additional attributes: description: {freq} maximum {window}-day total precipitation amount., cell_methods: time: maximum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.max_pr_intensity(pr='pr', *, window=1, freq='YS', ds=None, **indexer)

Maximum precipitation intensity over time window

Maximum precipitation intensity over a given rolling time window.

This indicator will check for missing values according to the method “from_context”. Based on function running_statistics(). With injected parameters: window_statistic=mean, statistic=max, window_center=False, out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Size of the rolling window. Default: 1.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Resampling is done after the running statistic. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Time selection is done after applying the running statistic.

Returns:

xarray.DataArray, [mm h-1] – precipitation, Maximum precipitation intensity over rolling {window}h time window. With additional attributes: description: {freq} maximum precipitation intensity over rolling {window}h time window., cell_methods: time: max

Return type:

xarray.DataArray

xclim.indicators.atmos.maximum_consecutive_dry_days(pr='pr', *, condition='<', thresh='1 mm/day', freq='YS', min_gap=1, resample_before_rl=True, ds=None, **indexer)

Maximum consecutive dry days

The longest number of consecutive days where daily precipitation below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window=1, window_statistic=max, statistic=max, constrain=(‘<’, ‘<=’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘1 mm/day’. [Required units : ([precipitation])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • min_gap (number) – The shortest possible gap between two spells. Spells closer than this are merged by assigning the gap steps to the merged spell. Default: 1.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_below_threshold, Maximum consecutive days with daily precipitation {condition} {thresh}. With additional attributes: description: {freq} maximum number of consecutive days with daily precipitation {condition} {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.maximum_consecutive_frost_free_days(tasmin='tasmin', *, condition='>', thresh='0 degC', freq='YS', resample_before_rl=True, ds=None, **indexer)

Maximum consecutive frost free days

Maximum number of consecutive frost-free days: where the daily minimum temperature is above or equal to given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window=1, window_statistic=min, statistic=max, min_gap=1, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive days with minimum temperature {condition} {thresh}. With additional attributes: description: {freq} maximum number of consecutive days with minimum daily temperature {condition} {thresh}., cell_methods: time: maximum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.maximum_consecutive_warm_days(tasmax='tasmax', *, thresh='25 °C', freq='YS', op='>', resample_before_rl=True, ds=None)

Maximum consecutive warm days

Maximum number of consecutive days where the maximum daily temperature exceeds a certain threshold.

This indicator will check for missing values according to the method “from_context”. Based on function hot_spell_max_length(). With injected parameters: window=1.

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – The temperature threshold needed to trigger a hot spell. Default: ‘25 °C’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • op ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive days with #maximum daily temperature {op} {thresh}. With additional attributes: description: {freq} longest spell of consecutive days with maximum daily temperature {op} {thresh}., cell_methods: time: maximum over days

Return type:

xarray.DataArray

Notes

The threshold on tasmax follows the one used in heat waves. A day temperature threshold between 30° and 35°C was selected by Health Canada professionals, following a temperature–mortality analysis. This absolute temperature threshold characterizes the occurrence of hot weather events that can result in adverse health outcomes for Canadian communities [Casati et al., 2013].

In Robinson [2001] where heat waves are also considered, the corresponding parameters would be thresh=39.44, window=2 (103F).

References

Casati, Yagouti, and Chaumont [2013], Robinson [2001]

xclim.indicators.atmos.maximum_consecutive_wet_days(pr='pr', *, condition='>=', thresh='1 mm/day', freq='YS', min_gap=1, resample_before_rl=True, ds=None, **indexer)

Maximum consecutive wet days

The longest number of consecutive days where daily precipitation is at or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: window=1, window_statistic=max, statistic=max, constrain=(‘>=’, ‘>’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold to test against. Default: ‘1 mm/day’. [Required units : ([precipitation])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • min_gap (number) – The shortest possible gap between two spells. Spells closer than this are merged by assigning the gap steps to the merged spell. Default: 1.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Maximum consecutive days with daily precipitation {condition} {thresh}. With additional attributes: description: {freq} maximum number of consecutive days with daily precipitation {condition} {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.mcarthur_forest_fire_danger_index(drought_factor='drought_factor', tasmax='tasmax', hurs='hurs', sfcWind='sfcWind', *, ds=None)

McArthur forest fire danger index (FFDI) Mark 5.

The FFDI is a numeric indicator of the potential danger of a forest fire.

Based on function mcarthur_forest_fire_danger_index().

Parameters:
  • drought_factor (str or DataArray) – The drought factor, often the daily Griffiths drought factor (see griffiths_drought_factor()). Default: ‘drought_factor’. [Required units : []]

  • tasmax (str or DataArray) – The daily maximum temperature near the surface, or similar. Different applications have used different inputs here, including the previous/current day’s maximum daily temperature at a height of 2m, and the daily mean temperature at a height of 2m. Default: ‘tasmax’. [Required units : [temperature]]

  • hurs (str or DataArray) – The relative humidity near the surface and near the time of the maximum daily temperature, or similar. Different applications have used different inputs here, including the mid-afternoon relative humidity at a height of 2m, and the daily mean relative humidity at a height of 2m. Default: ‘hurs’. [Required units : []]

  • sfcWind (str or DataArray) – The wind speed near the surface and near the time of the maximum daily temperature, or similar. Different applications have used different inputs here, including the mid-afternoon wind speed at a height of 10m, and the daily mean wind speed at a height of 10m. Default: ‘sfcWind’. [Required units : [speed]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – mcarthur_forest_fire_danger_index, McArthur Forest Fire Danger Index. With additional attributes: description: Numeric rating of the potential danger of a forest fire

Return type:

xarray.DataArray

References

Dowdy [2018], Holgate, Van DIjk, Cary, and Yebra [2017], Noble, Gill, and Bary [1980]

xclim.indicators.atmos.precip_accumulation(pr='pr', *, freq='YS', ds=None)

Total accumulated precipitation (solid and liquid)

Total accumulated precipitation.

This indicator will check for missing values according to the method “from_context”. Based on function precip_accumulation(). With injected parameters: tas=None, phase=None, thresh=None.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Total accumulated precipitation. With additional attributes: description: {freq} total precipitation., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation of day \(i\), then for a period \(j\) starting at day \(a\) and finishing on day \(b\):

\[PR_{ij} = \sum_{i=a}^{b} PR_i\]

If tas and phase are given, the corresponding phase precipitation is estimated before computing the accumulation, using one of snowfall_approximation or rain_approximation with the binary method.

xclim.indicators.atmos.precip_average(pr='pr', *, thresh='0 degC', freq='YS', ds=None)

Averaged precipitation (solid and liquid)

Averaged precipitation.

This indicator will check for missing values according to the method “from_context”. Based on function precip_average(). With injected parameters: tas=None, phase=None.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Threshold of tas over which the precipication is assumed to be liquid rain. Default: ‘0 degC’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_average_of_precipitation_amount, Averaged precipitation. With additional attributes: description: {freq} mean precipitation., cell_methods: time: mean over days

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation of day \(i\), then for a period \(j\) starting at day \(a\) and finishing on day \(b\):

\[PR_{ij} =\frac{ \sum_{i=a}^{b} PR_i }{b - a + 1}\]

If tas and phase are given, the corresponding phase precipitation is estimated before computing the accumulation, using one of snowfall_approximation or rain_approximation with the binary method.

xclim.indicators.atmos.precipitation_concentration_index(pr='pr', *, freq='YS', subfreq='MS', ds=None)

Precipitation Concentration Index.

A measure of the unevenness of precipitation distribution within a period. Computed as the ratio of the sum of squared sub-period totals to the square of the sum of sub-period totals, multiplied by 100 [Oliver, 1980].

This indicator will check for missing values according to the method “from_context”. Based on function precipitation_concentration_index().

Parameters:
  • pr (str or DataArray) – Precipitation flux or rate, with units convertible to a precipitation unit (e.g. "mm/day"). Default: ‘pr’.

  • freq (offset alias (string)) – Resampling frequency for the output (main period). Default is "YS" (yearly). Default: ‘YS’.

  • subfreq (str) – Resampling frequency for computing sub-period totals. Default is "MS" (monthly). Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Precipitation Concentration Index. With additional attributes: description: A measure of the unevenness of the {freq} distribution of precipitations. Computed as the ratio of the sum of squared {subfreq} totals to the square of the sum of {subfreq} totals, multiplied by 100

Return type:

xarray.DataArray

Notes

The precipitation concentration index (PCI) can be calculated as follows:

\[PCI = \frac{\sum_{i=1}^{n} p_i^2}{\left(\sum_{i=1}^{n} p_i\right)^2} \times 100\]

where \(p_i\) is the precipitation total for sub-period \(i\) and \(n\) is the number of sub-periods per main period.

A PCI of 8.3 (i.e. \(100/n\)) indicates perfectly uniform precipitation. Higher values indicate increasing concentration. Values above ~20 indicate a highly irregular or seasonal distribution.

References

Oliver [1980]

xclim.indicators.atmos.rain_on_frozen_ground_days(pr='pr', tas='tas', *, thresh='1 mm/d', window=7, freq='YS', ds=None, **indexer)

Number of rain on frozen ground days

The number of days with rain above a given threshold after a series of seven days with average daily temperature below 0°C. Precipitation is assumed to be rain when the daily average temperature is above 0°C.

This indicator will check for missing values according to the method “from_context”. Based on function rain_on_frozen_ground_days().

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Precipitation threshold to consider a day as a rain event. Default: ‘1 mm/d’. [Required units : [precipitation]]

  • window (number) – Minimum number of days below freezing temperature needed to consider the ground frozen. Default: 7.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of rain on frozen ground days (mean daily temperature > 0℃ and precipitation > {thresh}). With additional attributes: description: {freq} number of days with rain above {thresh} after a series of seven days with average daily temperature below 0℃. Precipitation is assumed to be rain when the daily average temperature is above 0℃.

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation and \(TG_i\) be the mean daily temperature of day \(i\). Then for a period \(j\), rain on frozen grounds days are counted where:

\[PR_{i} > Threshold [mm]\]

and where

\[TG_{i} ≤ 0℃\]

is true for continuous periods where \(i ≥ window\)

xclim.indicators.atmos.rain_season(pr='pr', *, thresh_wet_start='25.0 mm', window_wet_start=3, window_not_dry_start=30, thresh_dry_start='1.0 mm', window_dry_start=7, method_dry_start='per_day', date_min_start='05-01', date_max_start='12-31', thresh_dry_end='0.0 mm', window_dry_end=20, method_dry_end='per_day', date_min_end='09-01', date_max_end='12-31', freq='YS-JAN', ds=None)

Rain season

Start time, end time and length of the rain season, notably useful for West Africa (sivakumar, 1998). The rain season starts with a period of abundant rainfall, followed by a period without prolonged dry sequences, which must happen before a given date. The rain season stops during a dry period happening after a given date.

This indicator will check for missing values according to the method “from_context”. Based on function rain_season().

Parameters:
  • pr (str or DataArray) – Precipitation data. Default: ‘pr’. [Required units : [precipitation]]

  • thresh_wet_start (quantity (string or DataArray, with units)) – Accumulated precipitation threshold associated with window_wet_start. Default: ‘25.0 mm’. [Required units : [length]]

  • window_wet_start (number) – Number of days when accumulated precipitation is above thresh_wet_start. Defines the first condition to start the rain season. Default: 3.

  • window_not_dry_start (number) – Number of days, after window_wet_start days, during which no dry period must be found as a second and last condition to start the rain season. A dry sequence is defined with thresh_dry_start, window_dry_start and method_dry_start. Default: 30.

  • thresh_dry_start (quantity (string or DataArray, with units)) – Threshold length defining a dry day in the sequence related to window_dry_start. Default: ‘1.0 mm’. [Required units : [length]]

  • window_dry_start (number) – Number of days used to define a dry sequence in the start of the season. Daily precipitations lower than thresh_dry_start during window_dry_start days are considered a dry sequence. The precipitations must be lower than thresh_dry_start for either every day in the sequence (method_dry_start == “per_day”) or for the total (method_dry_start == “total”). Default: 7.

  • method_dry_start ({‘total’, ‘per_day’}) – Method used to define a dry sequence associated with window_dry_start. The threshold thresh_dry_start is either compared to every daily precipitation (method_dry_start == “per_day”) or to total precipitations (method_dry_start == “total”) in the sequence window_dry_start days. Default: ‘per_day’.

  • date_min_start (date (string, MM-DD)) – First day of year when season can start (“mm-dd”). Default: ‘05-01’.

  • date_max_start (date (string, MM-DD)) – Last day of year when season can start (“mm-dd”). Default: ‘12-31’.

  • thresh_dry_end (quantity (string or DataArray, with units)) – Threshold length defining a dry day in the sequence related to window_dry_end. Default: ‘0.0 mm’. [Required units : [length]]

  • window_dry_end (number) – Number of days used to define a dry sequence in the end of the season. Daily precipitations lower than thresh_dry_end during window_dry_end days are considered a dry sequence. The precipitations must be lower than thresh_dry_end for either every day in the sequence (method_dry_end == “per_day”) or for the total (method_dry_end == “total”). Default: 20.

  • method_dry_end ({‘total’, ‘per_day’}) – Method used to define a dry sequence associated with window_dry_end. The threshold thresh_dry_end is either compared to every daily precipitation (method_dry_end == “per_day”) or to total precipitations (method_dry_end == “total”) in the sequence window_dry days. Default: ‘per_day’.

  • date_min_end (date (string, MM-DD)) – First day of year when season can end (“mm-dd”). Default: ‘09-01’.

  • date_max_end (date (string, MM-DD)) – Last day of year when season can end (“mm-dd”). Default: ‘12-31’.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS-JAN’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

  • rain_season_start (xarray.DataArray, [dimensionless]) – Start of the rain season. With additional attributes: description: First step of a run where i) a sequence of {window_wet_start} days accumulated {thresh_wet_start} of precipitations ii) followed by a sequence of {window_not_dry_start} days with no dry sequence, i.e. a sequence of {window_dry_start} days with at least {thresh_dry_start} {method_dry_start}. The start of the season is on the last day of the first sequence i) and must be between {date_min_start} and {date_max_start}.

  • rain_season_end (xarray.DataArray, [dimensionless]) – End of the rain season. With additional attributes: description: Last day in a dry sequence after the start of the season, i.e. a sequence of {window_dry_end} days with at least {thresh_dry_end} {method_dry_end}. It must be between {date_min_end} and {date_max_end}.

  • rain_season_length (xarray.DataArray, [days]) – Length of the rain season. With additional attributes: description: Number of steps of the original series in the season, between 'start' and 'end'.

Return type:

tuple[xarray.DataArray, xarray.DataArray, xarray.DataArray]

Notes

The rain season starts at the end of a period of raining (a total precipitation of thresh_wet_start over window_wet_start days). This must be directly followed by a period of window_not_dry_start days with no dry sequence. The dry sequence is a period of window_dry_start days where precipitations are below thresh_dry_start (either the total precipitations over the period, or the daily precipitations, depending on method_dry_start). The rain season stops when a dry sequence happens (the dry sequence is defined as in the start sequence, but with parameters window_dry_end, thresh_dry_end and method_dry_end). The dates on which the season can start are constrained by date_min_start`and `date_max_start (and similarly for the end of the season).

References

Sivakumar [1988]

xclim.indicators.atmos.rprctot(pr='pr', prc='prc', *, thresh='1.0 mm/day', freq='YS', op='>=', ds=None, **indexer)

Proportion of accumulated precipitation arising from convective processes

The proportion of total precipitation due to convective processes. Only days with surpassing a minimum precipitation flux are considered.

This indicator will check for missing values according to the method “from_context”. Based on function rprctot().

Parameters:
  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • prc (str or DataArray) – Daily convective precipitation. Default: ‘prc’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Precipitation value over which a day is considered wet. Default: ‘1.0 mm/day’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • op ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>=”. Default: ‘>=’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – Proportion of accumulated precipitation arising from convective processeswith precipitation of at least {thresh}. With additional attributes: description: {freq} proportion of accumulated precipitation arising from convective processes with precipitation of at least {thresh}., cell_methods: time: sum

Return type:

xarray.DataArray

xclim.indicators.atmos.sfcWind_max(sfcWind='sfcWind', *, freq='YS', ds=None, **indexer)

Maximum near-surface mean wind speed

Maximum of daily mean near-surface wind speed.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • sfcWind (str or DataArray) – Surface wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [m s-1] – wind_speed, Maximum daily mean wind speed. With additional attributes: description: {freq} maximum of daily mean wind speed, cell_methods: time: max over days

Return type:

xarray.DataArray

xclim.indicators.atmos.sfcWind_mean(sfcWind='sfcWind', *, freq='YS', ds=None, **indexer)

Mean near-surface wind speed

Mean of daily near-surface wind speed.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • sfcWind (str or DataArray) – Surface wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [m s-1] – wind_speed, Mean daily mean wind speed. With additional attributes: description: {freq} mean of daily mean wind speed, cell_methods: time: mean over days

Return type:

xarray.DataArray

xclim.indicators.atmos.sfcWind_min(sfcWind='sfcWind', *, freq='YS', ds=None, **indexer)

Minimum near-surface mean wind speed

Minimum of daily mean near-surface wind speed.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • sfcWind (str or DataArray) – Surface wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [m s-1] – wind_speed, Minimum daily mean wind speed. With additional attributes: description: {freq} minimum of daily mean wind speed, cell_methods: time: min over days

Return type:

xarray.DataArray

xclim.indicators.atmos.sfcWindmax_max(sfcWindmax='sfcWindmax', *, freq='YS', ds=None, **indexer)

Maximum near-surface maximum wind speed

Maximum of daily maximum near-surface wind speed.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • sfcWindmax (str or DataArray) – Surface maximum wind speed. Default: ‘sfcWindmax’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [m s-1] – wind_speed, Maximum daily maximum wind speed. With additional attributes: description: {freq} maximum of daily maximum wind speed, cell_methods: time: max over days

Return type:

xarray.DataArray

xclim.indicators.atmos.sfcWindmax_mean(sfcWindmax='sfcWindmax', *, freq='YS', ds=None, **indexer)

Mean near-surface maximum wind speed

Mean of daily maximum near-surface wind speed.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • sfcWindmax (str or DataArray) – Surface maximum wind speed. Default: ‘sfcWindmax’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [m s-1] – wind_speed, Mean daily maximum wind speed. With additional attributes: description: {freq} mean of daily maximum wind speed, cell_methods: time: mean over days

Return type:

xarray.DataArray

xclim.indicators.atmos.sfcWindmax_min(sfcWindmax='sfcWindmax', *, freq='YS', ds=None, **indexer)

Minimum near-surface maximum wind speed

Minimum of daily maximum near-surface wind speed.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • sfcWindmax (str or DataArray) – Surface maximum wind speed. Default: ‘sfcWindmax’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [m s-1] – wind_speed, Minimum daily maximum wind speed. With additional attributes: description: {freq} minimum of daily maximum wind speed, cell_methods: time: min over days

Return type:

xarray.DataArray

xclim.indicators.atmos.snowfall_frequency(prsn='prsn', *, thresh='1 mm/day', freq='YS-JUL', ds=None, **indexer)

Snowfall frequency

Percentage of days with snowfall above a given threshold (either a snowfall flux or a liquid water equivalent snowfall rate).

This indicator will check for missing values according to the method “from_context”. Based on function snowfall_frequency().

Parameters:
  • prsn (str or DataArray) – Snowfall flux. Default: ‘prsn’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Threshold snowfall flux or liquid water equivalent snowfall rate (default: 1 mm/day). Default: ‘1 mm/day’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [%] – Percentage of days with snowfall above {thresh} threshold. With additional attributes: description: {freq} percentage of days with snowfall larger than {thresh}.

Return type:

xarray.DataArray

Notes

The 1 mm/day liquid water equivalent snowfall rate threshold in Frei, Kotlarski, Liniger, and Schär [2018] corresponds to the 1 cm/day snowfall rate threshold in CBCL [2020] using a snow density of 100 kg/m**3.

If the threshold and prsn differ by a density (i.e. [length/time] vs. [mass/area/time]), a liquid water equivalent snowfall rate is assumed, and the threshold is converted using a 1000 kg m-3 density.

References

Frei, Kotlarski, Liniger, and Schär [2018].

xclim.indicators.atmos.snowfall_intensity(prsn='prsn', *, thresh='1 mm/d', freq='YS-JUL', ds=None, **indexer)

Snowfall intensity

Mean daily liquid water equivalent snowfall rate above threshold (either a snowfall flux or a liquid water equivalent snowfall rate)

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: condition=>=, statistic=mean, constrain=None, out_units=None.

Parameters:
  • prsn (str or DataArray) – Surface snowfall flux. Default: ‘prsn’. [Required units : [mass]/([area]*[time])]

  • thresh (quantity (string or DataArray, with units)) – Threshold, should have the same dimensionality as data. Default: ‘1 mm/d’. [Required units : ([mass]/([area]*[time]))]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm/day] – Mean daily snowfall above {thresh} threshold. With additional attributes: description: {freq} mean daily snowfall larger than {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.solid_precip_accumulation(pr='pr', tas='tas', *, thresh='0 degC', freq='YS', ds=None, **indexer)

Total accumulated solid precipitation.

Total accumulated solid precipitation. Precipitation is considered solid when the average daily temperature is at or below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function precip_accumulation(). With injected parameters: phase=solid.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean, maximum or minimum daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold of tas over which the precipication is assumed to be liquid rain. Default: ‘0 degC’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_snowfall_amount, Total accumulated solid precipitation. With additional attributes: description: {freq} total solid precipitation, estimated as precipitation when temperature at or below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation of day \(i\), then for a period \(j\) starting at day \(a\) and finishing on day \(b\):

\[PR_{ij} = \sum_{i=a}^{b} PR_i\]

If tas and phase are given, the corresponding phase precipitation is estimated before computing the accumulation, using one of snowfall_approximation or rain_approximation with the binary method.

xclim.indicators.atmos.solid_precip_average(pr='pr', tas='tas', *, thresh='0 degC', freq='YS', ds=None, **indexer)

Averaged solid precipitation.

Averaged solid precipitation. Precipitation is considered solid when the average daily temperature is at or below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function precip_average(). With injected parameters: phase=solid.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean, maximum or minimum daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Threshold of tas over which the precipication is assumed to be liquid rain. Default: ‘0 degC’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm] – lwe_average_of_snowfall_amount, Averaged solid precipitation. With additional attributes: description: {freq} mean solid precipitation, estimated as precipitation when temperature at or below {thresh}., cell_methods: time: mean over days

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation of day \(i\), then for a period \(j\) starting at day \(a\) and finishing on day \(b\):

\[PR_{ij} =\frac{ \sum_{i=a}^{b} PR_i }{b - a + 1}\]

If tas and phase are given, the corresponding phase precipitation is estimated before computing the accumulation, using one of snowfall_approximation or rain_approximation with the binary method.

xclim.indicators.atmos.standardized_precipitation_evapotranspiration_index(wb='wb', *, freq='MS', window=1, dist='gamma', method='ML', fitkwargs=None, cal_start=None, cal_end=None, params=None, ds=None, **indexer)

Standardized Precipitation Evapotranspiration Index (SPEI)

Water budget (precipitation - evapotranspiration) over a moving window, normalized such that the SPEI averages to 0 for the calibration data. The window unit X is the minimal time period defined by the resampling frequency.

This indicator will check for missing values according to the method “from_context”. Based on function standardized_precipitation_evapotranspiration_index().

Parameters:
  • wb (str or DataArray) – Daily water budget (pr - pet). Default: ‘wb’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. A monthly or daily frequency is expected. Option None assumes that the desired resampling has already been applied input dataset and will skip the resampling step. Default: ‘MS’.

  • window (number) – Averaging window length relative to the resampling frequency. For example, if freq=”MS”, i.e. a monthly resampling, the window is an integer number of months. Default: 1.

  • dist ({‘genextreme’, ‘lognorm’, ‘fisk’, ‘gamma’}) – Name of the univariate distribution, or a callable rv_continuous (see scipy.stats). Default: ‘gamma’.

  • method ({‘APP’, ‘ML’, ‘PWM’}) – Name of the fitting method, such as ML (maximum likelihood), APP (approximate). The approximate method uses a deterministic function that does not involve any optimization, which can be sensitive to noise. PWM should be used with a lmoments3 distribution. Default: ‘ML’.

  • fitkwargs (dict) – Kwargs passed to xclim.compute.stats.fit used to impose values of certains parameters (floc, fscale). If method is PWM, fitkwargs should be empty, except for floc with dist`=`gamma which is allowed. Default: None.

  • cal_start (date (string, YYYY-MM-DD)) – Start date of the calibration period. A DateStr is expected, that is a str in format “YYYY-MM-DD”. Default option None means that the calibration period begins at the start of the input dataset. Default: None.

  • cal_end (date (string, YYYY-MM-DD)) – End date of the calibration period. A DateStr is expected, that is a str in format “YYYY-MM-DD”. Default option None means that the calibration period finishes at the end of the input dataset. Default: None.

  • params (quantity (string or DataArray, with units)) – Fit parameters. The params can be computed using xclim.compute.stats.standardized_index_fit_params in advance. The output can be given here as input, and it overrides other options. Default: None. [Required units : []]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.compute.generic.select_time().

Returns:

xarray.DataArray – spei, Standardized precipitation evapotranspiration index (SPEI). With additional attributes: description: Water budget (precipitation minus evapotranspiration) over a moving {window}-X window, normalized such that SPEI averages to 0 for calibration data. The window unit `X` is the minimal time period defined by the resampling frequency {freq}.

Return type:

xarray.DataArray

xclim.indicators.atmos.standardized_precipitation_index(pr='pr', *, freq='MS', window=1, dist='gamma', method='ML', fitkwargs=None, cal_start=None, cal_end=None, params=None, prob_zero_interpolation='upper', plotting_position_zero='ecdf', ds=None, **indexer)

Standardized Precipitation Index (SPI)

Precipitation over a moving window, normalized such that SPI averages to 0 for the calibration data. The window unit X is the minimal time period defined by the resampling frequency.

This indicator will check for missing values according to the method “from_context”. Based on function standardized_precipitation_index().

Parameters:
  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. A monthly or daily frequency is expected. Option None assumes that the desired resampling has already been applied input dataset and will skip the resampling step. Default: ‘MS’.

  • window (number) – Averaging window length relative to the resampling frequency. For example, if freq=”MS”, i.e. a monthly resampling, the window is an integer number of months. Default: 1.

  • dist ({‘genextreme’, ‘lognorm’, ‘fisk’, ‘gamma’}) – Name of the univariate distribution, or a callable rv_continuous (see scipy.stats). Default: ‘gamma’.

  • method ({‘APP’, ‘ML’, ‘PWM’}) – Name of the fitting method, such as ML (maximum likelihood), APP (approximate). The approximate method uses a deterministic function that does not involve any optimization, which can be sensitive to noise. PWM should be used with a lmoments3 distribution. Default: ‘ML’.

  • fitkwargs (dict) – Kwargs passed to xclim.compute.stats.fit used to impose values of certains parameters (floc, fscale). If method is PWM, fitkwargs should be empty, except for floc with dist`=`gamma which is allowed. Default: None.

  • cal_start (date (string, YYYY-MM-DD)) – Start date of the calibration period. A DateStr is expected, that is a str in format “YYYY-MM-DD”. Default option None means that the calibration period begins at the start of the input dataset. Default: None.

  • cal_end (date (string, YYYY-MM-DD)) – End date of the calibration period. A DateStr is expected, that is a str in format “YYYY-MM-DD”. Default option None means that the calibration period finishes at the end of the input dataset. Default: None.

  • params (quantity (string or DataArray, with units)) – Fit parameters. The params can be computed using xclim.compute.stats.standardized_index_fit_params in advance. The output can be given here as input, and it overrides other options. Default: None. [Required units : []]

  • prob_zero_interpolation ({‘upper’, ‘center’}) – Interpolation method used to assign a probability to zero values (only used if zero_inflated is True). When the data contain multiple zeros, the admissible plotting position interval spans from the first zero rank to the last zero rank. This parameter selects a representative probability within that interval. The default method “upper” assigns the upper bound of the zero-rank interval. The “center” method assigns the midpoint of the zero-rank interval. If a float in [0, 1] is provided, it is used as a linear interpolation factor between the lower (0) and upper (1) zero-rank plotting positions. Default: ‘upper’.

  • plotting_position_zero ({‘ecdf’, ‘weibull’}) – Method used to assign a probability to a rank for the zeros (only used if zero_inflated is True). “ecdf” (default option) is the empirical cumulative distribution and divides the number or zeros by the total number of observations. “weibull” implements the unbiased version, dividing by the total number of observation plus one. A tuple consisting of two coefficients in [0,1] to relate the number of zeros and the total number of observations. “ecdf” corresponds to (0,1) and “weibull” to (0,0). See scipy.stats.mstats.plotting_positions() Default: ‘ecdf’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.compute.generic.select_time().

Returns:

xarray.DataArray, [unitless] – spi, Standardized Precipitation Index (SPI). With additional attributes: description: Precipitations over a moving {window}-X window, normalized such that SPI averages to 0 for calibration data. The window unit `X` is the minimal time period defined by resampling frequency {freq}.

Return type:

xarray.DataArray

Notes

  • N-month SPI / N-day SPI is determined by choosing the window = N and the appropriate frequency freq.

  • Supported statistical distributions are: [“gamma”, “fisk”], where “fisk” is scipy’s implementation of a log-logistic distribution

  • Supported frequencies are daily (“D”), weekly (“W”), and monthly (“MS”).

  • Weekly frequency will only work if the input array has a “standard” (non-cftime) calendar.

  • If params is given as input, it overrides the cal_start, cal_end, freq and window, dist and method options.

  • “APP” method only supports two-parameter distributions. Parameter loc needs to be fixed to use method APP.

  • The results from climate_indices library can be reproduced with method = “APP” and fitwkargs = {“floc”: 0}, except for the maximum and minimum values allowed which are greater in xclim ±8.21, . See xclim.compute.stats.standardized_index

References

McKee, Doesken, and Kleist [1993], Stagge, Tallaksen, Gudmundsson, Van Loon, and Stahl [2015]

xclim.indicators.atmos.tg10p(tas='tas', tas_per='tas_per', *, freq='YS', bootstrap=False, condition='<', ds=None, **indexer)

Days with mean temperature below the 10th percentile

Number of days with mean temperature below the 10th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tg10p().

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • tas_per (str or DataArray) – 10th percentile of daily mean temperature. Default: ‘tas_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘<’, ‘lt’, ‘<=’, ‘le’}) – Comparison operation. Default: “<”. Default: ‘<’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Number of days with mean temperature below the 10th percentile. With additional attributes: description: {freq} number of days with mean temperature below the 10th percentile. A {tas_per_window} day(s) window, centered on each calendar day in the {tas_per_period} period, is used to compute the 10th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 10th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

xclim.indicators.atmos.tg90p(tas='tas', tas_per='tas_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Days with mean temperature above the 90th percentile

Number of days with mean temperature above the 90th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tg90p().

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • tas_per (str or DataArray) – 90th percentile of daily mean temperature. Default: ‘tas_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_above_threshold, Number of days with mean temperature above the 90th percentile. With additional attributes: description: {freq} number of days with mean temperature above the 90th percentile. A {tas_per_window} day(s) window, centered on each calendar day in the {tas_per_period} period, is used to compute the 90th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 90th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

xclim.indicators.atmos.tg_days_above(tas='tas', *, condition='>', thresh='10 °C', freq='YS', ds=None, **indexer)

Number of days with mean temperature above a given threshold

The number of days with mean temperature above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘>’, ‘>=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘10 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, The number of days with mean temperature above {thresh}. With additional attributes: description: {freq} number of days where daily mean temperature exceeds {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tg_days_below(tas='tas', *, condition='<', thresh='10 °C', freq='YS', ds=None, **indexer)

Number of days with mean temperature below a given threshold

The number of days with mean temperature below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘<’, ‘<=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘10 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_below_threshold, The number of days with mean temperature below {thresh}. With additional attributes: description: {freq} number of days where daily mean temperature is below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tg_max(tas='tas', *, freq='YS', ds=None, **indexer)

Maximum of mean temperature

Maximum of daily mean temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Maximum daily mean temperature. With additional attributes: description: {freq} maximum of daily mean temperature., cell_methods: time: maximum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tg_mean(tas='tas', *, freq='YS', ds=None, **indexer)

Mean temperature

Mean of daily mean temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Mean daily mean temperature. With additional attributes: description: {freq} mean of daily mean temperature., cell_methods: time: mean over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tg_min(tas='tas', *, freq='YS', ds=None, **indexer)

Minimum of mean temperature

Minimum of daily mean temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Minimum daily mean temperature. With additional attributes: description: {freq} minimum of daily mean temperature., cell_methods: time: minimum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.thawing_degree_days(tas='tas', *, thresh='0 degC', freq='YS', ds=None, **indexer)

Thawing degree days

The cumulative degree days for days when the average temperature is above a given threshold, typically 0°C.

This indicator will check for missing values according to the method “from_context”. Based on function integrated_difference(). With injected parameters: condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – The value threshold. Default: ‘0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_excess_wrt_time, Cumulative sum of temperature degrees for mean daily temperature above {thresh}. With additional attributes: description: {freq} thawing degree days (mean temperature above {thresh})., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tn10p(tasmin='tasmin', tasmin_per='tasmin_per', *, freq='YS', bootstrap=False, condition='<', ds=None, **indexer)

Days with minimum temperature below the 10th percentile

Number of days with minimum temperature below the 10th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tn10p().

Parameters:
  • tasmin (str or DataArray) – Mean daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmin_per (str or DataArray) – 10th percentile of daily minimum temperature. Default: ‘tasmin_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘<’, ‘lt’, ‘<=’, ‘le’}) – Comparison operation. Default: “<”. Default: ‘<’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Number of days with minimum temperature below the 10th percentile. With additional attributes: description: {freq} number of days with minimum temperature below the 10th percentile. A {tasmin_per_window} day(s) window, centered on each calendar day in the {tasmin_per_period} period, is used to compute the 10th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 10th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

xclim.indicators.atmos.tn90p(tasmin='tasmin', tasmin_per='tasmin_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Days with minimum temperature above the 90th percentile

Number of days with minimum temperature above the 90th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tn90p().

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmin_per (str or DataArray) – 90th percentile of daily minimum temperature. Default: ‘tasmin_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_above_threshold, Number of days with minimum temperature above the 90th percentile. With additional attributes: description: {freq} number of days with minimum temperature above the 90th percentile. A {tasmin_per_window} day(s) window, centered on each calendar day in the {tasmin_per_period} period, is used to compute the 90th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 90th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

xclim.indicators.atmos.tn_days_above(tasmin='tasmin', *, condition='>', thresh='20 °C', freq='YS', ds=None, **indexer)

Number of days with minimum temperature above a given threshold

The number of days with minimum temperature above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘20 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, The number of days with minimum temperature above {thresh}. With additional attributes: description: {freq} number of days where daily minimum temperature exceeds {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tn_days_below(tasmin='tasmin', *, condition='<', thresh='-10 °C', freq='YS', ds=None, **indexer)

Number of days with minimum temperature below a given threshold

The number of days with minimum temperature below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘<’, ‘<=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘-10 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_below_threshold, The number of days with minimum temperature below {thresh}. With additional attributes: description: {freq} number of days where daily minimum temperature is below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tn_max(tasmin='tasmin', *, freq='YS', ds=None, **indexer)

Maximum of minimum temperature

Maximum of daily minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Maximum daily minimum temperature. With additional attributes: description: {freq} maximum of daily minimum temperature., cell_methods: time: maximum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tn_mean(tasmin='tasmin', *, freq='YS', ds=None, **indexer)

Mean of minimum temperature

Mean of daily minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Mean daily minimum temperature. With additional attributes: description: {freq} mean of daily minimum temperature., cell_methods: time: mean over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tn_min(tasmin='tasmin', *, freq='YS', ds=None, **indexer)

Minimum temperature

Minimum of daily minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Minimum daily minimum temperature. With additional attributes: description: {freq} minimum of daily minimum temperature., cell_methods: time: minimum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tropical_nights(tasmin='tasmin', *, condition='>', thresh='20.0 degC', freq='YS', ds=None, **indexer)

Tropical nights

Number of days where minimum temperature is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘20.0 degC’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, Number of days with minimum daily temperature above {thresh}. With additional attributes: description: {freq} number of Tropical Nights, defined as days with minimum daily temperature above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tx10p(tasmax='tasmax', tasmax_per='tasmax_per', *, freq='YS', bootstrap=False, condition='<', ds=None, **indexer)

Days with maximum temperature below the 10th percentile

Number of days with maximum temperature below the 10th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tx10p().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmax_per (str or DataArray) – 10th percentile of daily maximum temperature. Default: ‘tasmax_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘<’, ‘lt’, ‘<=’, ‘le’}) – Comparison operation. Default: “<”. Default: ‘<’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Number of days with maximum temperature below the 10th percentile. With additional attributes: description: {freq} number of days with maximum temperature below the 10th percentile. A {tasmax_per_window} day(s) window, centered on each calendar day in the {tasmax_per_period} period, is used to compute the 10th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 10th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

xclim.indicators.atmos.tx90p(tasmax='tasmax', tasmax_per='tasmax_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Days with maximum temperature above the 90th percentile

Number of days with maximum temperature above the 90th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tx90p().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmax_per (str or DataArray) – 90th percentile of daily maximum temperature. Default: ‘tasmax_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_above_threshold, Number of days with maximum temperature above the 90th percentile. With additional attributes: description: {freq} number of days with maximum temperature above the 90th percentile. A {tasmax_per_window} day(s) window, centered on each calendar day in the {tasmax_per_period} period, is used to compute the 90th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 90th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

xclim.indicators.atmos.tx_days_above(tasmax='tasmax', *, condition='>', thresh='25 °C', freq='YS', ds=None, **indexer)

Number of days with maximum temperature above a given threshold

The number of days with maximum temperature above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘>’, ‘>=’).

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘25 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, The number of days with maximum temperature above {thresh}. With additional attributes: description: {freq} number of days where daily maximum temperature exceeds {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tx_days_below(tasmax='tasmax', *, condition='<', thresh='25 °C', freq='YS', ds=None, **indexer)

Number of days with maximum temperature below a given threshold

The number of days with maximum temperature below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘<’, ‘<=’).

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘<’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘25 °C’. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_below_threshold, The number of days with maximum temperature below {thresh}. With additional attributes: description: {freq} number of days where daily max temperature is below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tx_max(tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Maximum temperature

Maximum of daily maximum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Maximum daily maximum temperature. With additional attributes: description: {freq} maximum of daily maximum temperature., cell_methods: time: maximum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tx_mean(tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Mean of maximum temperature

Mean of daily maximum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Mean daily maximum temperature. With additional attributes: description: {freq} mean of daily maximum temperature., cell_methods: time: mean over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tx_min(tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Minimum of maximum temperature

Minimum of daily maximum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Minimum daily maximum temperature. With additional attributes: description: {freq} minimum of daily maximum temperature., cell_methods: time: minimum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.tx_tn_days_above(tasmin='tasmin', tasmax='tasmax', *, freq='YS', ds=None, condition='>', thresh_tasmin='22 °C', thresh_tasmax='30 °C', **indexer)

Number of days with daily minimum and maximum temperatures exceeding thresholds

Number of days with daily maximum and minimum temperatures above given thresholds.

This indicator will check for missing values according to the method “from_context”. Based on function bivariate_count_occurrences(). With injected parameters: condition2=None, var_reducer=all, constrain1=(‘>’, ‘>=’), constrain2=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator for data variable 1. Default: ‘>’.

  • thresh_tasmin (quantity (string or DataArray, with units)) – Threshold for data variable 1. Default: ‘22 °C’. [Required units : ([temperature])]

  • thresh_tasmax (quantity (string or DataArray, with units)) – Threshold for data variable 2. If None, thresh1 is used. Default: ‘30 °C’. [Required units : ([temperature])]

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, Number of days with daily minimum above {thresh_tasmin} and daily maximum temperatures above {thresh_tasmax}. With additional attributes: description: {freq} number of days where daily maximum temperature exceeds {thresh_tasmax} and minimum temperature exceeds {thresh_tasmin}.

Return type:

xarray.DataArray

Notes

Sampling length is derived from data1.

xclim.indicators.atmos.usda_hardiness_zones(tasmin='tasmin', *, window=30, freq='YS', ds=None)

USDA hardiness zones

A climate indice based on a multi-year rolling average of the annual minimum temperature. Developed specifically to aid in determining plant suitability of geographic regions. The USDA classificationscheme divides categories into 10 degree Fahrenheit zones, with 5-degree Fahrenheit half-zones, starting from -65 degrees Fahrenheit and ending at 65 degrees Fahrenheit.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function hardiness_zones(). With injected parameters: method=usda.

Parameters:
  • tasmin (str or DataArray) – Minimum temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • window (number) – The length of the averaging window, in years. Default: 30.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [dimensionless] – Hardiness zones. With additional attributes: description: A climate indice based on a {window}-year rolling average of the annual minimum temperature. Developed specifically to aid in determining plant suitability of geographic regions. The USDA classificationscheme divides categories into 10 degree Fahrenheit zones, with 5-degree Fahrenheit half-zones, starting from -65 degrees Fahrenheit and ending at 65 degrees Fahrenheit.

Return type:

xarray.DataArray

References

Dawson [1991], USDA Agricultural Research Service [2012]

xclim.indicators.atmos.warm_and_dry_days(tas='tas', pr='pr', tas_per='tas_per', pr_per='pr_per', *, freq='YS', ds=None, **indexer)

Warm and dry days

Number of days with temperature above a given percentile and precipitation below a given percentile.

This indicator will check for missing values according to the method “from_context”. Based on function warm_and_dry_days().

Parameters:
  • tas (str or DataArray) – Mean daily temperature values. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tas_per (str or DataArray) – Third quartile of daily mean temperature computed by month. Default: ‘tas_per’. [Required units : [temperature]]

  • pr_per (str or DataArray) – First quartile of daily total precipitation computed by month. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Number of days where temperature is above {tas_per_thresh}th percentile and precipitation is below {pr_per_thresh}th percentile. With additional attributes: description: {freq} number of days where temperature is above {tas_per_thresh}th percentile and precipitation is below {pr_per_thresh}th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Bootstrapping is not available for quartiles because it would make no significant difference to bootstrap percentiles so far from the extremes.

Formula to be written (Beniston [2009]).

References

Beniston [2009]

xclim.indicators.atmos.warm_and_wet_days(tas='tas', pr='pr', tas_per='tas_per', pr_per='pr_per', *, freq='YS', ds=None, **indexer)

Warm and wet days

Number of days with temperature above a given percentile and precipitation above a given percentile.

This indicator will check for missing values according to the method “from_context”. Based on function warm_and_wet_days().

Parameters:
  • tas (str or DataArray) – Mean daily temperature values. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tas_per (str or DataArray) – Third quartile of daily mean temperature computed by month. Default: ‘tas_per’. [Required units : [temperature]]

  • pr_per (str or DataArray) – Third quartile of daily total precipitation computed by month. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Number of days where temperature above {tas_per_thresh}th percentile and precipitation above {pr_per_thresh}th percentile. With additional attributes: description: {freq} number of days where temperature is above {tas_per_thresh}th percentile and precipitation is above {pr_per_thresh}th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Bootstrapping is not available for quartiles because it would make no significant difference to bootstrap percentiles so far from the extremes.

Formula to be written (Beniston [2009]).

References

Beniston [2009]

xclim.indicators.atmos.warm_spell_duration_index(tasmax='tasmax', tasmax_per='tasmax_per', *, window=6, freq='YS', resample_before_rl=True, bootstrap=False, condition='>', ds=None)

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.

This indicator will check for missing values according to the method “from_context”. Based on function warm_spell_duration_index().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmax_per (str or DataArray) – Percentile(s) of daily maximum temperature. Default: ‘tasmax_per’. [Required units : [temperature]]

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

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, Number of days with at least {window} consecutive days where the maximum daily temperature is above the {tasmax_per_thresh}th percentile(s). With additional attributes: description: {freq} number of days with at least {window} consecutive days where the maximum daily temperature is above the {tasmax_per_thresh}th percentile(s). A {tasmax_per_window} day(s) window, centred on each calendar day in the {tasmax_per_period} period, is used to compute the {tasmax_per_thresh}th percentile(s)., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

From the Expert Team on Climate Change Detection, Monitoring and Indices (ETCCDMI; [Zhang et al., 2011]). Used in Alexander, Zhang, Peterson, Caesar, Gleason, Klein Tank, Haylock, Collins, Trewin, Rahimzadeh, Tagipour, Rupa Kumar, Revadekar, Griffiths, Vincent, Stephenson, Burn, Aguilar, Brunet, Taylor, New, Zhai, Rusticucci, and Vazquez-Aguirre [2006]

xclim.indicators.atmos.water_cycle_intensity(pr='pr', evspsbl='evspsbl', *, freq='YS', ds=None, **indexer)

Water cycle intensity

The sum of precipitation and actual evapotranspiration.

This indicator will check for missing values according to the method “from_context”. Based on function water_cycle_intensity().

Parameters:
  • pr (str or DataArray) – Precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • evspsbl (str or DataArray) – Actual evapotranspiration flux. Default: ‘evspsbl’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm] – Water cycle intensity. With additional attributes: description: The {freq} water cycle intensity, defined as the sum of precipitation and actual evapotranspiration., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

Huntington, Weiskel, Wolock, and McCabe [2018]

xclim.indicators.atmos.wet_precip_accumulation(pr='pr', *, thresh='1 mm/day', freq='YS', ds=None, **indexer)

Total accumulated precipitation (solid and liquid) during wet days

Total accumulated precipitation on days with precipitation. A day is considered to have precipitation if the precipitation is greater than or equal to a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: condition=>=, statistic=integral, constrain=None, out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Threshold, should have the same dimensionality as data. Default: ‘1 mm/day’. [Required units : ([precipitation])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Total accumulated precipitation over days where precipitation exceeds {thresh}. With additional attributes: description: {freq} total precipitation over wet days, defined as days where precipitation exceeds {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.wet_spell_frequency(pr='pr', *, window=3, window_statistic='sum', thresh='1 mm', freq='YS', resample_before_rl=True, ds=None, **indexer)

Wet spell frequency

The frequency of wet periods of N days or more, during which the accumulated or maximum precipitation over a given time window of days is equal or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: condition=>=, statistic=count, min_gap=1, constrain=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Minimum length of a spell. Default: 3.

  • window_statistic ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘sum’.

  • thresh (quantity (string or DataArray, with units)) – A threshold amount of precipitation (not a flux or rate). Default: ‘1 mm’. [Required units : ([mass]/[area])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray – Number of wet periods of at least {window} days.. With additional attributes: description: The {freq} number of wet periods of at least {window} days, during which the {window_statistic} precipitation on a window of {window} days is equal or over {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.wet_spell_max_length(pr='pr', *, window=3, window_statistic='sum', thresh='1 mm', freq='YS', resample_before_rl=True, ds=None, **indexer)

Wet spell maximum length

The maximum length of a wet period of N days or more, during which the accumulated or maximum precipitation over a given time window of days is equal or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: condition=>=, statistic=max, min_gap=1, constrain=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Minimum length of a spell. Default: 3.

  • window_statistic ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘sum’.

  • thresh (quantity (string or DataArray, with units)) – A threshold amount of precipitation (not a flux or rate). Default: ‘1 mm’. [Required units : ([mass]/[area])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Maximum consecutive number of days in a wet period of at least {window} days.. With additional attributes: description: The maximum {freq} number of consecutive days in a wet period of at least {window} days, during which the {window_statistic} precipitation within windows of {window} days is equal or over {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.wet_spell_total_length(pr='pr', *, window=3, window_statistic='sum', thresh='1 mm', freq='YS', resample_before_rl=True, ds=None, **indexer)

Wet spell total length

The total length of wet periods of N days or more, during which the accumulated or maximum precipitation over a given time window of days is equal or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: condition=>=, statistic=sum, min_gap=1, constrain=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window (number) – Minimum length of a spell. Default: 3.

  • window_statistic ({‘min’, ‘integral’, ‘sum’, ‘max’, ‘mean’}) – Reduction along the window length to compute running statistic. Note that this does not matter when window is 1, in which case any occurrence of data {condition} thresh is considered a valid “spell”. Default: ‘sum’.

  • thresh (quantity (string or DataArray, with units)) – A threshold amount of precipitation (not a flux or rate). Default: ‘1 mm’. [Required units : ([mass]/[area])]

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – Number of days in wet periods of at least {window} days. With additional attributes: description: The {freq} number of days in wet periods of at least {window} days, during which the {window_statistic} precipitation within windows of {window} days is equal or over {thresh}.

Return type:

xarray.DataArray

xclim.indicators.atmos.wetdays(pr='pr', *, condition='>=', thresh='1 mm/d', freq='YS', ds=None, **indexer)

Number of wet days

The number of days with daily precipitation at or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘>=’, ‘>’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘1 mm/d’. [Required units : ([precipitation])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of days with daily precipitation at or above {thresh}. With additional attributes: description: {freq} number of days with daily precipitation at or above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.wetdays_prop(pr='pr', *, thresh='1.0 mm/day', freq='YS', condition='>=', ds=None, **indexer)

Proportion of wet days

The proportion of days with daily precipitation at or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function wetdays_prop().

Parameters:
  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Precipitation value over which a day is considered wet. Default: ‘1.0 mm/day’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>=”. Default: ‘>=’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [1] – Proportion of days with precipitation at or above {thresh}. With additional attributes: description: {freq} proportion of days with precipitation at or above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

xclim.indicators.atmos.windy_days(sfcWind='sfcWind', *, thresh='10.8 m s-1', freq='MS', ds=None, **indexer)

Windy days

Number of days with surface wind speed at or above threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>=, constrain=None.

Parameters:
  • sfcWind (str or DataArray) – Surface wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘10.8 m s-1’. [Required units : ([speed])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_wind_speed_above_threshold, Number of days with surface wind speed at or above {thresh}. With additional attributes: description: {freq} number of days with surface wind speed at or above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

Land Indicators

xclim.indicators.land.base_flow_index(rivo='rivo', *, freq='YS', ds=None)

Base flow index

Minimum of the 7-day moving average flow divided by the mean flow.

This indicator will check for missing values according to the method “from_context”. Based on function base_flow_index().

Parameters:
  • rivo (str or DataArray) – Rate of river discharge. Default: ‘rivo’. [Required units : [discharge]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [dimensionless] – Base flow index. With additional attributes: description: Minimum of the 7-day moving average flow divided by the mean flow.

Return type:

xarray.DataArray

Notes

Let \(\mathbf{q}=q_0, q_1, \ldots, q_n\) be the sequence of daily discharge and \(\overline{\mathbf{q}}\) the mean flow over the period. The base flow index is given by:

\[\frac{\min(\mathrm{CMA}_7(\mathbf{q}))}{\overline{\mathbf{q}}}\]

where \(\mathrm{CMA}_7\) is the seven days moving average of the daily flow:

\[\mathrm{CMA}_7(q_i) = \frac{\sum_{j=i-3}^{i+3} q_j}{7}\]
xclim.indicators.land.base_flow_index_seasonal_ratio(rivo='rivo', *, freq='QS-DEC', numerator='DJF', denominator='JJA', ds=None)

Seasonal Base flow index (bfi) and {numerator} to {denominator} bfi ratio

Yearly base flow index per season, defined as the minimum 7-day average flow divided by the mean flowas well as yearly {numerator} to {denominator} bfi ratio.

This indicator will check for missing values according to the method “skip”. Based on function base_flow_index_seasonal_ratio().

Parameters:
  • rivo (str or DataArray) – Rate of river discharge. Default: ‘rivo’. [Required units : [discharge]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘QS-DEC’.

  • numerator (str) – String indicating the season in the numerator of the ratio. Default: ‘DJF’.

  • denominator (str) – String indicating the season in the denominator of the ratio. Default: ‘JJA’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

  • bfi (xarray.DataArray, [dimensionless]) – Seasonal baseflow index. With additional attributes: description: Yearly base flow index per season, defined as the minimum 7-day average flow divided by the mean flow.

  • bfi_ratio (xarray.DataArray, [dimensionless]) – Baseflow index season ratio. With additional attributes: description: Yearly baseflow index {numerator} to {denominator} ratio, defined as the minimum 7-day average flow divided by the mean flow as well.

Return type:

tuple[xarray.DataArray, xarray.DataArray]

Notes

It is recommended to have at least 70% of valid data per month in order to compute significant values. The default arguments compute the bfi ratio of the winter (“DJF”) to summer (“JJA”) ratio.

References

Singh, Pahlow, Booker, Shankar, and Chamorro [2019] Jaffrés, Cuff, Cuff, Faichney, Knott, and Rasmussen [2021]

xclim.indicators.land.blowing_snow(snd='snd', sfcWind='sfcWind', *, snd_thresh='5 cm', sfcWind_thresh='15 km/h', window=3, freq='YS-JUL', ds=None, **indexer)

Blowing snow days

The number of days with snowfall, snow depth, and windspeed over given thresholds for a period of days.

This indicator will check for missing values according to the method “from_context”. Based on function blowing_snow().

Parameters:
  • snd (str or DataArray) – Surface snow depth. Default: ‘snd’. [Required units : [length]]

  • sfcWind (str or DataArray) – Wind velocity. Default: ‘sfcWind’. [Required units : [speed]]

  • snd_thresh (quantity (string or DataArray, with units)) – Threshold on net snowfall accumulation over the last window days. Default: ‘5 cm’. [Required units : [length]]

  • sfcWind_thresh (quantity (string or DataArray, with units)) – Wind speed threshold. Default: ‘15 km/h’. [Required units : [speed]]

  • window (number) – Period over which snow is accumulated before comparing against threshold. Default: 3.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. The subset is taken after summing the snowfall over the window. It accepts the same arguments as xclim.compute.generic.select_time().

Returns:

xarray.DataArray, [days] – Days with snowfall and wind speed at or above given thresholds. With additional attributes: description: The {freq} number of days with snowfall over last {window} days above {snd_thresh} and wind speed above {sfcWind_thresh}.

Return type:

xarray.DataArray

xclim.indicators.land.flow_index(rivo='rivo', *, q=0.95, ds=None)

Flow index

Calculate the qth quantile of daily streamflow normalized by the median flow.

This indicator will check for missing values according to the method “from_context”. Based on function flow_index().

Parameters:
  • rivo (str or DataArray) – Daily streamflow data. Default: ‘rivo’. [Required units : [discharge]]

  • q (number) – Quantile for calculating the flow index, between 0 and 1. Default of 0.95 is for high flows. Default: 0.95.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – Flow index. With additional attributes: description: {q}th quantile normalized by the median flow.

Return type:

xarray.DataArray

References

Clausen and Biggs [2000]

xclim.indicators.land.high_flow_frequency(rivo='rivo', *, threshold_factor=9, freq='YS-OCT', ds=None)

High flow frequency

Calculate the number of days in a given period with flows greater than a specified threshold, given as a multiple of the median flow. By default, the period is the water year starting on 1st October and ending on 30th September, as commonly defined in North America.

This indicator will check for missing values according to the method “from_context”. Based on function high_flow_frequency().

Parameters:
  • rivo (str or DataArray) – Daily streamflow data. Default: ‘rivo’. [Required units : [discharge]]

  • threshold_factor (number) – Factor by which the median flow is multiplied to set the high flow threshold, default is 9. Default: 9.

  • freq (offset alias (string)) – Resampling frequency, default is ‘YS-OCT’ for water year starting in October and ending in September. Default: ‘YS-OCT’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – High flow frequency. With additional attributes: description: {freq} frequency of flows greater than {threshold_factor} times the median flow.

Return type:

xarray.DataArray

References

Addor, Nearing, Prieto, Newman, Le Vine, and Clark [2018], Clausen and Biggs [2000]

xclim.indicators.land.holiday_snow_and_snowfall_days(snd='snd', prsn=None, *, snd_thresh='20 mm', prsn_thresh='1 mm', snd_condition='>=', prsn_condition='>=', date_start='12-25', date_end=None, freq='YS-JUL', ds=None)

Perfect Christmas snow days

The total number of days where there is a significant amount of snow on the ground and a measurable snowfall occurring on December 25th.

This indicator will check for missing values according to the method “from_context”. Based on function holiday_snow_and_snowfall_days().

Parameters:
  • snd (str or DataArray) – Surface snow depth. Default: ‘snd’. [Required units : [length]]

  • prsn (str or DataArray, optional) – Snowfall flux. Default: None. [Required units : [precipitation]]

  • snd_thresh (quantity (string or DataArray, with units)) – Threshold snow amount. Default: 20 mm. Default: ‘20 mm’. [Required units : [length]]

  • prsn_thresh (quantity (string or DataArray, with units)) – Threshold daily snowfall liquid-water equivalent thickness. Default: 1 mm. Default: ‘1 mm’. [Required units : [length]]

  • snd_condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation for snow depth. Default: “>=”. Default: ‘>=’.

  • prsn_condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation for snowfall flux. Default: “>=”. Default: ‘>=’.

  • date_start (str) – Beginning of analysis period. Default: “12-25” (December 25th). Default: ‘12-25’.

  • date_end (str) – End of analysis period. If not provided, date_start is used. Default: None. Default: None.

  • freq (offset alias (string)) – Resampling frequency. Default: “YS-JUL”. The default value is chosen for the northern hemisphere. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – Number of holiday days with snow and snowfall. With additional attributes: description: The total number of days where snow on the ground was greater than or equal to {snd_thresh} and snowfall was greater than or equal to {prsn_thresh} occurring on {date_start} and ending on {date_end}.

Return type:

xarray.DataArray

References

https://www.canada.ca/en/environment-climate-change/services/weather-general-tools-resources/historical-christmas-snowfall-data.html

xclim.indicators.land.holiday_snow_days(snd='snd', *, snd_thresh='20 mm', condition='>=', date_start='12-25', date_end=None, freq='YS', ds=None)

Christmas snow days

The total number of days where there is a significant amount of snow on the ground on December 25th.

This indicator will check for missing values according to the method “from_context”. Based on function holiday_snow_days().

Parameters:
  • snd (str or DataArray) – Surface snow depth. Default: ‘snd’. [Required units : [length]]

  • snd_thresh (quantity (string or DataArray, with units)) – Threshold snow amount. Default: 20 mm. Default: ‘20 mm’. [Required units : [length]]

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>=”. Default: ‘>=’.

  • date_start (str) – Beginning of the analysis period. Default: “12-25” (December 25th). Default: ‘12-25’.

  • date_end (str) – End of analysis period. If not provided, date_start is used. Default: None. Default: None.

  • freq (offset alias (string)) – Resampling frequency. Default: “YS”. The default value is chosen for the northern hemisphere. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – Number of holiday days with snow. With additional attributes: description: The total number of days where snow on the ground was greater than or equal to {snd_thresh} occurring on {date_start} and ending on {date_end}.

Return type:

xarray.DataArray

References

https://www.canada.ca/en/environment-climate-change/services/weather-general-tools-resources/historical-christmas-snowfall-data.html

xclim.indicators.land.lag_snowpack_flow_peaks(snw='snw', rivo='rivo', *, freq='YS-OCT', q=0.9, ds=None)

Time lag between maximum snowpack and river high flows

Number of days between the annual maximum snowpack, measured by the surface snow amount, and the mean date when river flow exceeds a quantile threshold during a given year. If the time lag between maximum snowpack and river high flows is ≤ 50 days, the watershed is likely in a nival regime.

This indicator will check for missing values according to the method “from_context”. Based on function lag_snowpack_flow_peaks().

Parameters:
  • snw (str or DataArray) – Surface snow amount. Default: ‘snw’. [Required units : [snowamount]]

  • rivo (str or DataArray) – Daily streamflow data. Default: ‘rivo’. [Required units : [discharge]]

  • freq (offset alias (string)) – Resampling frequency. Defaults to the water year starting on the 1st of October. Default: ‘YS-OCT’.

  • q (number) – Quantile for calculating the flow index, between 0 and 1. Default of 0.9 is for high flows. Default: 0.9.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – Time lag between maximum snowpack and river high flows. With additional attributes: description: Number of days between the annual maximum snowpack, measured by the snow waterequivalent, and the mean date when river flow exceeds a quantile thresholdduring a given year.

Return type:

xarray.DataArray

Notes

  • The default freq is the water year used in the Northern Hemisphere, from October to September.

  • It is recommended to have at least 70% of valid data per water year in order to compute significant values.

  • Nival regime is characterized by a hydrological response dominated by snowmelt, where maximum flows occur shortly after peak snow cover (Burn et al., 2010).

  • The 50-day threshold is approximate and depends on the specific responsiveness of each watershed.

  • A negative value means the high flows occur before the peak snow cover.

References

Burn, Sharif, and Zhang [2010]

xclim.indicators.land.low_flow_frequency(rivo='rivo', *, threshold_factor=0.2, freq='YS-OCT', ds=None)

Low flow frequency

Calculate the number of days in a given period with flows lower than a specified threshold, given by a fraction of the mean flow. By default, the period is the water year starting on 1st October and ending on 30th September, as commonly defined in North America.

This indicator will check for missing values according to the method “from_context”. Based on function low_flow_frequency().

Parameters:
  • rivo (str or DataArray) – Daily streamflow data. Default: ‘rivo’. [Required units : [discharge]]

  • threshold_factor (number) – Factor by which the mean flow is multiplied to set the low flow threshold, default is 0.2. Default: 0.2.

  • freq (offset alias (string)) – Resampling frequency, default is ‘YS-OCT’ for water year starting in October and ending in September. Default: ‘YS-OCT’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – Low flow frequency. With additional attributes: description: {freq} frequency of flows smaller than a fraction ({threshold_factor}) of the mean flow.

Return type:

xarray.DataArray

References

Olden and Poff [2003]

xclim.indicators.land.rb_flashiness_index(rivo='rivo', *, freq='YS', ds=None)

Richards-Baker Flashiness Index

Measurement of flow oscillations relative to average flow, quantifying the frequency and speed of flow changes.

This indicator will check for missing values according to the method “from_context”. Based on function rb_flashiness_index().

Parameters:
  • rivo (str or DataArray) – Rate of river discharge. Default: ‘rivo’. [Required units : [discharge]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [dimensionless] – Richards-Baker Flashiness Index. With additional attributes: description: {freq} of Richards-Baker Index, an index measuring the flashiness of flow.

Return type:

xarray.DataArray

Notes

Let \(\mathbf{q}=q_0, q_1, \ldots, q_n\) be the sequence of daily discharge, the R-B Index is given by:

\[\frac{\sum_{i=1}^n |q_i - q_{i-1}|}{\sum_{i=1}^n q_i}\]

References

Baker, Richards, Loftus, and Kramer [2004]

xclim.indicators.land.rivo_max_doy(discharge='discharge', *, freq='YS', ds=None, **indexer)

Day of year of the maximum streamflow

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=doymax, out_units=None.

Parameters:
  • discharge (str or DataArray) – The amount of water, in all phases, flowing in the river channel and flood plain. Default: ‘discharge’. [Required units : [length]**3/[time]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray – Day of the year of the maximum streamflow over {indexer}. With additional attributes: description: Day of the year of the maximum streamflow over {indexer}.

Return type:

xarray.DataArray

xclim.indicators.land.rivo_min_doy(discharge='discharge', *, freq='YS', ds=None, **indexer)

Day of year of the minimum streamflow

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=doymin, out_units=None.

Parameters:
  • discharge (str or DataArray) – The amount of water, in all phases, flowing in the river channel and flood plain. Default: ‘discharge’. [Required units : [length]**3/[time]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray – Day of the year of the minimum streamflow over {indexer}. With additional attributes: description: Day of the year of the minimum streamflow over {indexer}.

Return type:

xarray.DataArray

xclim.indicators.land.runoff_ratio(rivo='rivo', pr='pr', *, area, freq='YS', ds=None)

Runoff ratio

Ratio of runoff volume measured at the stream to the total precipitation volume over the watershed.

This indicator will check for missing values according to the method “from_context”. Based on function runoff_ratio().

Parameters:
  • rivo (str or DataArray) – Daily streamflow data. Default: ‘rivo’. [Required units : [discharge]]

  • pr (str or DataArray) – Mean daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • area (quantity (string or DataArray, with units)) – Watershed area. Required. [Required units : [area]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – Runoff ratio. With additional attributes: description: Ratio of runoff volume measured at the stream to the total precipitation volume over the watershed.Temporal analysis: Yearly values computed from seasonal daily data and yearly data, depending on chosen frequency.

Return type:

xarray.DataArray

Notes

  • Runoff ratio values are comparable to runoff coefficients.

  • Values near 0 mean most precipitation infiltrates watershed soil or is lost to evapotranspiration.

  • Values near 1 mean most precipitation leaves the watershed as runoff. Possible causes are impervious surfaces from urban sprawl, thin soils, steep slopes, etc.

  • Annual runoff ratios are typically ≤ 1.

  • Annual runoff ratios are typically higher than summer runoff ratios due to higher levels of evapotranspiration in summer months.

  • For snow-driven watersheds, spring runoff ratios are typically higher than annual runoff ratios, as snowmelt generates concentrated runoff events.

  • Temporal analysis: Yearly values computed from seasonal daily data and yearly data, depending on chosen frequency. (e.g., ‘YS’ for yearly starting Jan, or ‘QS-DEC’ for seasons, ‘30YS’ to compute the value over slices of 30 years from the start of the time series).

References

:cite:cts:’knoben_2024’

xclim.indicators.land.sen_slope(rivo='rivo', *, freq='YS', ds=None)

Sen Slope : Temporal robustness analysis of streamflow.

Computes Theil-Sen slope estimators and performs the Mann-Kendall test for trend evaluation.

Based on function sen_slope().

Parameters:
  • rivo (str or DataArray) – Daily streamflow data. Default: ‘rivo’. [Required units : [discharge]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

  • sen_slope (xarray.DataArray, [dimensionless]) – Sen Slope from observed data. With additional attributes: description: Compute annual and seasonal Theil-Sen slope estimators and perform the Mann-Kendall test for trend evaluation.

  • p_value (xarray.DataArray, [dimensionless]) – p_value from observed data. With additional attributes: description: Statistical analysis value.

Return type:

tuple[xarray.DataArray, xarray.DataArray]

Notes

  • If p-value <= 0.05, the trend is statistically significant at the 5% level.

  • The ratio of observed Sen_slope over simulated Sen_slope is considered acceptable within the range 0.5-2 and is optimal when equal to 1 (Sauquet et al., 2025).

References

Sauquet, Evin, Siauve, Aissat, Arnaud, Bérel, Bonneau, Branger, Caballero, Colléoni, Ducharne, Gailhard, Habets, Hendrickx, Héraut, Hingray, Huang, Jaouen, Jeantet, Lanini, Le Lay, Magand, Mimeau, Monteil, Munier, Perrin, Robelin, Rousset, Soubeyroux, Strohmenger, Thirel, Tocquer, Tramblay, Vergnes, and Vidal [2025]

xclim.indicators.land.snd_days_above(snd='snd', *, condition='>=', thresh='2 cm', freq='YS-JUL', ds=None, **indexer)

Days with snow (depth)

Number of days when the snow depth is greater than or equal to a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘>’, ‘>=’).

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘2 cm’. [Required units : ([length])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Number of days with snow. With additional attributes: description: The {freq} number of days with snow depth greater than or equal to {thresh}.

Return type:

xarray.DataArray

xclim.indicators.land.snd_max(snd='snd', *, freq='YS-JUL', ds=None, **indexer)

Maximum snow depth

The maximum snow depth on the surface.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm] – snow_depth, Maximum snow depth. With additional attributes: description: The {freq} maximum snow depth on the surface.

Return type:

xarray.DataArray

xclim.indicators.land.snd_max_doy(snd='snd', *, freq='YS-JUL', ds=None)

Day of year of maximum snow depth

Day of the year when snow depth reaches its maximum value.

This indicator will check for missing values according to the method “from_context”. Based on function snd_max_doy().

Parameters:
  • snd (str or DataArray) – Surface snow depth. Default: ‘snd’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – day_of_year, Day of the year when snow depth reaches its maximum value. With additional attributes: description: The {freq} day of the year when snow depth reaches its maximum value.

Return type:

xarray.DataArray

xclim.indicators.land.snd_season_end(snd='snd', *, thresh='2 cm', window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover end date (depth).

The first date on which snow depth is below a given threshold for a given number of consecutive days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: condition=>=, aspect=end, mid_date=None, constrain=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘2 cm’. [Required units : ([length])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] or [time] – day_of_year, End date of continuous snow depth cover. With additional attributes: description: Day of year when snow depth is below {thresh} for {window} consecutive days.

Return type:

xarray.DataArray

xclim.indicators.land.snd_season_length(snd='snd', *, thresh='2 cm', window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover duration (depth).

The season starts when snow depth is above a threshold for at least N consecutive daysand stops when it drops below the same threshold for the same number of days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: condition=>=, aspect=length, mid_date=None, constrain=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘2 cm’. [Required units : ([length])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Snow cover duration. With additional attributes: description: The duration of the snow season, starting with at least {window} days with snow depth above {thresh} and ending with at least {window} days with snow depth under {thresh}.

Return type:

xarray.DataArray

xclim.indicators.land.snd_season_start(snd='snd', *, thresh='2 cm', window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover start date (depth).

The first date on which snow depth is greater than or equal to a given threshold for a given number of consecutive days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: condition=>=, aspect=start, mid_date=None, constrain=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘2 cm’. [Required units : ([length])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] or [time] – day_of_year, Start date of continuous snow depth cover. With additional attributes: description: Day of year when snow depth is above or equal to {thresh} for {window} consecutive days.

Return type:

xarray.DataArray

xclim.indicators.land.snd_storm_days(snd='snd', *, thresh='25 cm', freq='YS-JUL', ds=None, **indexer)

Winter storm days

Number of days with snowfall depth accumulation greater or equal to threshold (default: 25 cm).

This indicator will check for missing values according to the method “from_context”. Based on function snd_storm_days().

Parameters:
  • snd (str or DataArray) – Surface snow depth. Default: ‘snd’. [Required units : [length]]

  • thresh (quantity (string or DataArray, with units)) – Threshold on snowfall depth accumulation require to label an event a snd storm. Default: ‘25 cm’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Days with snowfall depth at or above a given threshold. With additional attributes: description: The {freq} number of days with snowfall depth accumulation above {thresh}.

Return type:

xarray.DataArray

Notes

Snowfall accumulation is estimated by the change in snow depth.

xclim.indicators.land.snow_depth(snd='snd', *, freq='YS', ds=None, **indexer)

Mean snow depth

Mean of daily snow depth.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [cm] – surface_snow_thickness, Mean of daily snow depth. With additional attributes: description: The {freq} mean of daily mean snow depth., cell_methods: time: mean over days

Return type:

xarray.DataArray

xclim.indicators.land.snow_melt_we_max(snw='snw', *, window=3, freq='YS-JUL', ds=None)

Maximum snow melt

The water equivalent of the maximum snow melt.

This indicator will check for missing values according to the method “from_context”. Based on function snow_melt_we_max().

Parameters:
  • snw (str or DataArray) – Snow amount (mass per area). Default: ‘snw’. [Required units : [snowamount]]

  • window (number) – Number of days during which the melt is accumulated. Default: 3.

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [kg m-2] – change_over_time_in_surface_snow_amount, Maximum snow melt. With additional attributes: description: The {freq} maximum negative change in melt amount over {window} days.

Return type:

xarray.DataArray

xclim.indicators.land.snw_days_above(snw='snw', *, condition='>=', thresh='4 kg m-2', freq='YS-JUL', ds=None, **indexer)

Days with snow (amount)

Number of days when the snow amount is greater than or equal to a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: constrain=(‘>’, ‘>=’).

Parameters:
  • snw (str or DataArray) – Surface snow amount. Default: ‘snw’. [Required units : [mass]/[area]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>=’.

  • thresh (quantity (string or DataArray, with units)) – Threshold value. Should have the same dimensionality as data. Default: ‘4 kg m-2’. [Required units : ([mass]/[area])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Number of days with snow. With additional attributes: description: The {freq} number of days with snow amount greater than or equal to {thresh}.

Return type:

xarray.DataArray

xclim.indicators.land.snw_max(snw='snw', *, freq='YS-JUL', ds=None, **indexer)

Maximum snow amount

The maximum snow amount equivalent on the surface.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • snw (str or DataArray) – Surface snow amount. Default: ‘snw’. [Required units : [mass]/[area]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [kg m-2] – surface_snow_amount, Maximum snow amount equivalent. With additional attributes: description: The {freq} maximum snow amount equivalent on the surface.

Return type:

xarray.DataArray

xclim.indicators.land.snw_max_doy(snw='snw', *, freq='YS-JUL', ds=None)

Day of year of maximum snow amount

The day of year when snow amount equivalent on the surface reaches its maximum.

This indicator will check for missing values according to the method “from_context”. Based on function snw_max_doy().

Parameters:
  • snw (str or DataArray) – Surface snow amount. Default: ‘snw’. [Required units : [snowamount]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – day_of_year, Day of year of maximum daily snow amount equivalent. With additional attributes: description: The {freq} day of year when snow amount equivalent on the surface reaches its maximum.

Return type:

xarray.DataArray

xclim.indicators.land.snw_season_end(snw='snw', *, thresh='4 kg m-2', window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover end date (amount).

The first date on which snow amount is below a given threshold for a given number of consecutive days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: condition=>=, aspect=end, mid_date=None, constrain=None.

Parameters:
  • snw (str or DataArray) – Surface snow amount. Default: ‘snw’. [Required units : [mass]/[area]]

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘4 kg m-2’. [Required units : ([mass]/[area])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] or [time] – day_of_year, End date of continuous snow amount cover. With additional attributes: description: Day of year when snow amount is below {thresh} for {window} consecutive days.

Return type:

xarray.DataArray

xclim.indicators.land.snw_season_length(snw='snw', *, thresh='4 kg m-2', window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover duration (amount).

The season starts when the snow amount is above a threshold for at least N consecutive daysand stops when it drops below the same threshold for the same number of days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: condition=>=, aspect=length, mid_date=None, constrain=None.

Parameters:
  • snw (str or DataArray) – Surface snow amount. Default: ‘snw’. [Required units : [mass]/[area]]

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘4 kg m-2’. [Required units : ([mass]/[area])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Snow cover duration. With additional attributes: description: The duration of the snow season, starting with at least {window} days with snow amount above {thresh} and ending with at least {window} days with snow amount under {thresh}.

Return type:

xarray.DataArray

xclim.indicators.land.snw_season_start(snw='snw', *, thresh='4 kg m-2', window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover start date (amount).

The first date on which snow amount is greater than or equal to a given threshold for a given number of consecutive days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: condition=>=, aspect=start, mid_date=None, constrain=None.

Parameters:
  • snw (str or DataArray) – Surface snow amount. Default: ‘snw’. [Required units : [mass]/[area]]

  • thresh (quantity (string or DataArray, with units)) – Threshold for the condition. Default: ‘4 kg m-2’. [Required units : ([mass]/[area])]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] or [time] – day_of_year, Start date of continuous snow amount cover. With additional attributes: description: Day of year when snow amount is above or equal to {thresh} for {window} consecutive days.

Return type:

xarray.DataArray

xclim.indicators.land.snw_storm_days(snw='snw', *, thresh='10 kg m-2', freq='YS-JUL', ds=None, **indexer)

Winter storm days

Number of days with snowfall amount accumulation greater or equal to threshold (default: 10 kg m-2).

This indicator will check for missing values according to the method “from_context”. Based on function snw_storm_days().

Parameters:
  • snw (str or DataArray) – Surface snow amount. Default: ‘snw’. [Required units : [snowamount]]

  • thresh (quantity (string or DataArray, with units)) – Threshold on snowfall amount accumulation require to label an event a snw storm. Default: ‘10 kg m-2’. [Required units : [snowamount]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Days with snowfall amount at or above a given threshold. With additional attributes: description: The {freq} number of days with snowfall amount accumulation above {thresh}.

Return type:

xarray.DataArray

Notes

Snowfall accumulation is estimated by the change in snow amount.

xclim.indicators.land.standardized_groundwater_index(gwl='gwl', *, freq='MS', window=1, dist='genextreme', method='ML', fitkwargs=None, cal_start=None, cal_end=None, params=None, ds=None, **indexer)

Standardized Groundwater Index (SGI)

Groundwater over a moving window, normalized such that SGI averages to 0 for the calibration data. The window unit X is the minimal time period defined by the resampling frequency.

This indicator will check for missing values according to the method “from_context”. Based on function standardized_groundwater_index().

Parameters:
  • gwl (str or DataArray) – Groundwater head level. Default: ‘gwl’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency. A monthly or daily frequency is expected. Option None assumes that the desired resampling has already been applied input dataset and will skip the resampling step. Default: ‘MS’.

  • window (number) – Averaging window length relative to the resampling frequency. For example, if freq=”MS”, i.e. a monthly resampling, the window is an integer number of months. Default: 1.

  • dist ({‘genextreme’, ‘lognorm’, ‘gamma’}) – Name of the univariate distribution, or a callable rv_continuous (see scipy.stats). Default: ‘genextreme’.

  • method ({‘APP’, ‘ML’, ‘PWM’}) – Name of the fitting method, such as ML (maximum likelihood), APP (approximate). The approximate method uses a deterministic function that does not involve any optimization. PWM should be used with a lmoments3 distribution. Default: ‘ML’.

  • fitkwargs (dict) – Kwargs passed to xclim.compute.stats.fit used to impose values of certain parameters (floc, fscale). Default: None.

  • cal_start (date (string, YYYY-MM-DD)) – Start date of the calibration period. A DateStr is expected, that is a str in format “YYYY-MM-DD”. Default option None means that the calibration period begins at the start of the input dataset. Default: None.

  • cal_end (date (string, YYYY-MM-DD)) – End date of the calibration period. A DateStr is expected, that is a str in format “YYYY-MM-DD”. Default option None means that the calibration period finishes at the end of the input dataset. Default: None.

  • params (quantity (string or DataArray, with units)) – Fit parameters. The params can be computed using xclim.compute.stats.standardized_index_fit_params in advance. The output can be given here as input, and it overrides other options. Default: None. [Required units : []]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.compute.generic.select_time().

Returns:

xarray.DataArray, [unitless] – sgi, Standardized Groundwater Index (SGI). With additional attributes: description: Groundwater over a moving {window}-X window, normalized such that SGI averages to 0 for calibration data. The window unit `X` is the minimal time period defined by resampling frequency {freq}.

Return type:

xarray.DataArray

Notes

  • N-month SGI / N-day SGI is determined by choosing the window = N and the appropriate frequency freq.

  • Supported statistical distributions are: [“gamma”, “genextreme”, “lognorm”].

  • If params is provided, it overrides the cal_start, cal_end, freq, window, dist, method options.

  • “APP” method only supports two-parameter distributions. Parameter loc needs to be fixed to use method “APP”.

References

Bloomfield and Marchant [2013]

xclim.indicators.land.standardized_streamflow_index(rivo='rivo', *, freq='MS', window=1, dist='genextreme', method='ML', fitkwargs=None, cal_start=None, cal_end=None, params=None, ds=None, **indexer)

Standardized Streamflow Index (SSI)

Streamflow over a moving window, normalized such that SSI averages to 0 for the calibration data. The window unit X is the minimal time period defined by the resampling frequency.

This indicator will check for missing values according to the method “from_context”. Based on function standardized_streamflow_index().

Parameters:
  • rivo (str or DataArray) – Rate of river discharge. Default: ‘rivo’. [Required units : [discharge]]

  • freq (offset alias (string)) – Resampling frequency. A monthly or daily frequency is expected. Option None assumes that the desired resampling has already been applied input dataset and will skip the resampling step. Default: ‘MS’.

  • window (number) – Averaging window length relative to the resampling frequency. For example, if freq=”MS”, i.e. a monthly resampling, the window is an integer number of months. Default: 1.

  • dist ({‘genextreme’, ‘fisk’}) – Name of the univariate distribution, or a callable rv_continuous (see scipy.stats). Default: ‘genextreme’.

  • method ({‘APP’, ‘ML’, ‘PWM’}) – Name of the fitting method, such as ML (maximum likelihood), APP (approximate). The approximate method uses a deterministic function that does not involve any optimization. PWM should be used with a lmoments3 distribution. Default: ‘ML’.

  • fitkwargs (dict) – Kwargs passed to xclim.compute.stats.fit used to impose values of certain parameters (floc, fscale). Default: None.

  • cal_start (date (string, YYYY-MM-DD)) – Start date of the calibration period. A DateStr is expected, that is a str in format “YYYY-MM-DD”. Default option None means that the calibration period begins at the start of the input dataset. Default: None.

  • cal_end (date (string, YYYY-MM-DD)) – End date of the calibration period. A DateStr is expected, that is a str in format “YYYY-MM-DD”. Default option None means that the calibration period finishes at the end of the input dataset. Default: None.

  • params (quantity (string or DataArray, with units)) – Fit parameters. The params can be computed using xclim.compute.stats.standardized_index_fit_params in advance. The output can be given here as input, and it overrides other options. Default: None. [Required units : []]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.compute.generic.select_time().

Returns:

xarray.DataArray, [unitless] – ssi, Standardized Streamflow Index (SSI). With additional attributes: description: Streamflow over a moving {window}-X window, normalized such that SSI averages to 0 for calibration data. The window unit `X` is the minimal time period defined by resampling frequency {freq}.

Return type:

xarray.DataArray

Notes

  • N-month SSI / N-day SSI is determined by choosing the window = N and the appropriate frequency freq.

  • Supported statistical distributions are: [“genextreme”, “fisk”], where “fisk” is scipy’s implementation of

    a log-logistic distribution.

  • If params is provided, it overrides the cal_start, cal_end, freq, window, dist, and method options.

  • “APP” method only supports two-parameter distributions. Parameter loc needs to be fixed to use method “APP”.

  • The standardized index is bounded by ±8.21. 8.21 is the largest standardized index as constrained by the float64 precision in the inversion to the normal distribution.

References

Vicente-Serrano, López-Moreno, Beguer\'ıa, Lorenzo-Lacruz, Azorin-Molina, and Morán-Tejeda [2012]

xclim.indicators.seaIce.sea_ice_area(siconc='siconc', areacello='areacello', *, thresh='15 %', ds=None)

Sea ice area

A measure of total ocean surface covered by sea ice.

Based on function sea_ice_area().

Parameters:
  • siconc (str or DataArray) – Sea ice concentration (area fraction). Default: ‘siconc’. [Required units : []]

  • areacello (str or DataArray) – Grid cell area (usually over the ocean). Default: ‘areacello’. [Required units : [area]]

  • thresh (quantity (string or DataArray, with units)) – Minimum sea ice concentration for a grid cell to contribute to the sea ice extent. Default: ‘15 %’. [Required units : []]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [m2] – sea_ice_area, Sum of ice-covered areas where sea ice concentration exceeds {thresh}. With additional attributes: description: The sum of ice-covered areas where sea ice concentration exceeds {thresh}., cell_methods: lon: sum lat: sum

Return type:

xarray.DataArray

Notes

To compute sea ice area over a subregion, first mask or subset the input sea ice concentration data.

References

“What is the difference between sea ice area and extent?” - NSIDC [2008]

xclim.indicators.seaIce.sea_ice_extent(siconc='siconc', areacello='areacello', *, thresh='15 %', ds=None)

Sea ice extent

A measure of the extent of all areas where sea ice concentration exceeds a threshold.

Based on function sea_ice_extent().

Parameters:
  • siconc (str or DataArray) – Sea ice concentration (area fraction). Default: ‘siconc’. [Required units : []]

  • areacello (str or DataArray) – Grid cell area. Default: ‘areacello’. [Required units : [area]]

  • thresh (quantity (string or DataArray, with units)) – Minimum sea ice concentration for a grid cell to contribute to the sea ice extent. Default: ‘15 %’. [Required units : []]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [m2] – sea_ice_extent, Sum of ocean areas where sea ice concentration exceeds {thresh}. With additional attributes: description: The sum of ocean areas where sea ice concentration exceeds {thresh}., cell_methods: lon: sum lat: sum

Return type:

xarray.DataArray

Notes

To compute sea ice area over a subregion, first mask or subset the input sea ice concentration data.

References

“What is the difference between sea ice area and extent?” - NSIDC [2008]

Generic Indicators

xclim.indicators.generic.fit(da='da', *, dist='norm', method='ML', dim='time', ds=None, **fitkwargs)

Distribution parameters fitted over the time dimension.

This indicator will check for missing values according to the method “from_context”. Based on function fit().

Parameters:
  • da (str or DataArray) – Time series to be fitted along the time dimension. Default: ‘da’.

  • dist (str) – Name of the univariate distribution, such as beta, expon, genextreme, gamma, gumbel_r, lognorm, norm (see :py:mod:scipy.stats for full list) or the distribution object itself. Default: ‘norm’.

  • method ({‘APP’, ‘MLE’, ‘MSE’, ‘MPS’, ‘ML’, ‘PWM’, ‘MM’}) – Fitting method, either maximum likelihood (ML or MLE), method of moments (MM), maximum product of spacings (MSE or MPS) or approximate method (APP). If dist is an instance from the lmoments3 library, accepts probability weighted moments (PWM; “L-Moments”). The PWM method is usually more robust to outliers. The MSE method is more consistent than the MLE method, although it can be more sensitive to repeated data. For the MSE method, each variable parameter must be given finite bounds (provided with keyword argument bounds={‘param_name’:(min,max),…}). Default: ‘ML’.

  • dim (str) – The dimension upon which to perform the indexing (default: “time”). Default: ‘time’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • fitkwargs – Other arguments passed directly to _fitstart() and to the distribution’s fit.

Returns:

xarray.DataArray – {dist} parameters, {dist} distribution parameters. With additional attributes: description: Parameters of the {dist} distribution., cell_methods: time: fit

Return type:

xarray.DataArray

Notes

Coordinates for which all values are NaNs will be dropped before fitting the distribution. If the array still contains NaNs, the distribution parameters will be returned as NaNs.

xclim.indicators.generic.return_level(da='da', *, mode, t, dist, window=1, freq=None, method='ML', ds=None, **indexer)

Return level from frequency analysis

Frequency analysis on the basis of a given mode and distribution.

This indicator will check for missing values according to the method “from_context”. Based on function frequency_analysis().

Parameters:
  • da (str or DataArray) – Input data. Default: ‘da’.

  • mode ({‘max’, ‘min’}) – Whether we are looking for a probability of exceedance (high) or a probability of non-exceedance (low). Required.

  • t (number or sequence of numbers) – Return period. The period depends on the resolution of the input data. If the input array’s resolution is yearly, then the return period is in years. Required.

  • dist (str) – Name of the univariate distribution, e.g. beta, expon, genextreme, gamma, gumbel_r, lognorm, norm. Or an instance of the distribution. Required.

  • window (number) – Averaging window length (days). Default: 1.

  • freq (offset alias (string)) – Resampling frequency. If None, the frequency is assumed to be ‘YS’ unless the indexer is season=’DJF’, in which case freq would be set to YS-DEC. Default: None.

  • method ({‘MOM’, ‘APP’, ‘MLE’, ‘ML’, ‘PWM’}) – Fitting method, either maximum likelihood (ML or MLE), method of moments (MOM) or approximate method (APP). If dist is an instance from the lmoments3 library, accepts probability weighted moments (PWM; “L-Moments”). The PWM method is usually more robust to outliers. Default: ‘ML’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. For example, use season=’DJF’ to select winter values, month=1 to select January, or month=[6,7,8] to select summer months. If indexer is not provided, all values are considered.

Returns:

xarray.DataArray – N-year return level. With additional attributes: description: Frequency analysis for the {mode} {indexer} {window}-day value estimated using the {dist} distribution.

Return type:

xarray.DataArray

xclim.indicators.generic.statistics(data='data', *, statistic, freq='YS', ds=None, **indexer)

Simple resampled statistic of the values.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: out_units=None.

Parameters:
  • data (str or DataArray) – Input data. Default: ‘data’.

  • statistic ({‘min’, ‘count’, ‘integral’, ‘sum’, ‘max’, ‘std’, ‘var’, ‘doymax’, ‘doymin’, ‘mean’}) – Reducing operation. It can either be a DataArray method or a function that can be applied to a DataArray. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray – {statistic:noun} of variable. With additional attributes: description: {freq} {statistic:noun} of variable ({indexer}).

Return type:

xarray.DataArray

Conversion Indicators

This submodule contains indicators that converts CF-compliant variables from one to another. For example, converting wind speed in cardinal directions to a vector magnitude and direction, or converting snow depth to snow water equivalent. It also includes indicators that approximate variables from multiple variables, such as calculating the mean temperature from daily maximum and minimum temperatures.

xclim.indicators.convert.clearness_index(rsds='rsds', *, ds=None)

Clearness index

The clearness index is the ratio between the shortwave downwelling radiation and the total extraterrestrial radiation on a given day.

Based on function clearness_index().

Parameters:
  • rsds (str or DataArray) – Surface downwelling solar radiation. Default: ‘rsds’. [Required units : [radiation]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [unitless] – Clear index. With additional attributes: description: The ratio of shortwave downwelling radiation to extraterrestrial radiation.

Return type:

xarray.DataArray

Notes

Clearness Index (ci) is defined as:

References

Lauret, Alonso-Suárez, Le Gal La Salle, and David [2022]

xclim.indicators.convert.dewpoint_from_specific_humidity(huss='huss', ps='ps', *, method='buck81', variant='water', ds=None)

Dewpoint temperature computed from specific humidity and pressure.

The temperature at which the current vapour pressure would be the saturation vapour pressure. Only a subset of the saturation_vapor_pressure() methods are supported.

Based on function dewpoint_from_specific_humidity().

Parameters:
  • huss (str or DataArray) – Specific humidity [kg/kg]. Default: ‘huss’. [Required units : []]

  • ps (str or DataArray) – Pressure. Default: ‘ps’. [Required units : [pressure]]

  • method ({‘wmo08’, ‘buck81’, ‘tetens30’, ‘aerk96’}) – The formula to use for saturation vapour pressure. Only the formulas using the easily invertible August-Roche-Magnus form are available. Default: ‘buck81’.

  • variant ({‘water’, ‘ice’}) – Which variant of the saturation vapour pressure formula to take. Default: ‘water’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K] – Dewpoint temperature.. With additional attributes: description: Temperature at which the current water vapour reaches saturation. Equation from {method} is used for saturation vapour pressure.

Return type:

xarray.DataArray

Notes

The calculation is based on the following, using the August-Roche-Magnus form for the saturation vapour pressure formula :

\[ \begin{align}\begin{aligned}e(q, p) = e_{sat}(T_d) = A \mathrm{e}^{B * \frac{T_d - T_0}{T_d + C}}\\T_d = \frac{-T_0 - C\frac{1}{B}\mathrm{ln}\frac{e}{A}}{\frac{1}{B}\mathrm{ln}\frac{e}{A} - 1}\end{aligned}\end{align} \]

Where \(e\) is the vapor_pressure(), \(q\) is the specific humidiy, \(p\) is the pressure, \(e_{sat}\) is the saturation_vapor_pressure(), \(T_0\) is the freezing temperature 273.16 K and \(T_d\) is the dewpoint temperature. \(A\), \(B\) and \(C\) are method-specific and variant-specific coefficients.

To imitate the calculations of ECMWF’s IFS (ERA5, ERA5-Land), use method='buck81' and reference='water' (the defaults).

xclim.indicators.convert.heat_index(tas='tas', hurs='hurs', *, ds=None)

Heat index

The heat index is an estimate of the temperature felt by a person in the shade when relative humidity is taken into account.

Based on function heat_index().

Parameters:
  • tas (str or DataArray) – Mean Temperature. The equation assumes an instantaneous value. Default: ‘tas’. [Required units : [temperature]]

  • hurs (str or DataArray) – Relative Humidity. The equation assumes an instantaneous value. Default: ‘hurs’. [Required units : []]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [C] – air_temperature, Heat index. With additional attributes: description: Perceived temperature after relative humidity is taken into account.

Return type:

xarray.DataArray

Notes

While both the Humidex and the heat index are calculated using dew point the Humidex uses a dew point of 7 °C (45 °F) as a base, whereas the heat index uses a dew point base of 14 °C (57 °F). Further, the heat index uses heat balance equations which account for many variables other than vapour pressure, which is used exclusively in the Humidex calculation.

References

Blazejczyk, Epstein, Jendritzky, Staiger, and Tinz [2012]

xclim.indicators.convert.humidex(tas='tas', tdps=None, hurs=None, *, ds=None)

Humidex

The humidex describes the temperature felt by a person when relative humidity is taken into account. It can be interpreted as the equivalent temperature felt when the air is dry.

Based on function humidex().

Parameters:
  • tas (str or DataArray) – Mean Temperature. Default: ‘tas’. [Required units : [temperature]]

  • tdps (str or DataArray, optional) – Dewpoint Temperature, used to compute the vapour pressure. Default: None. [Required units : [temperature]]

  • hurs (str or DataArray, optional) – Relative Humidity, used as an alternative way to compute the vapour pressure if the dewpoint temperature is not available. Default: None. [Required units : []]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [C] – air_temperature, Humidex index. With additional attributes: description: Humidex index describing the temperature felt by the average person in response to relative humidity.

Return type:

xarray.DataArray

Notes

The humidex is usually computed using hourly observations of dry bulb and dewpoint temperatures. It is computed using the formula based on Masterton and Richardson [1979]:

\[T + {\frac {5}{9}}\left[e - 10\right]\]

where \(T\) is the dry bulb air temperature (°C). The term \(e\) can be computed from the dewpoint temperature \(T_{dewpoint}\) in °K:

\[e = 6.112 \times \exp(5417.7530\left({\frac {1}{273.16}}-{\frac {1}{T_{\text{dewpoint}}}}\right)\]

where the constant 5417.753 reflects the molecular weight of water, latent heat of vaporization, and the universal gas constant [Mekis et al., 2015]. Alternatively, the term \(e\) can also be computed from the relative humidity h expressed in percent using Sirangelo et al. [2020]:

\[e = \frac{h}{100} \times 6.112 * 10^{7.5 T/(T + 237.7)}.\]

The humidex comfort scale [Canada, 2011] can be interpreted as follows:

  • 20 to 29 : no discomfort;

  • 30 to 39 : some discomfort;

  • 40 to 45 : great discomfort, avoid exertion;

  • 46 and over : dangerous, possible heat stroke;

Please note that while both the humidex and the heat index are calculated using dew point, the humidex uses a dew point of 7 °C (45 °F) as a base, whereas the heat index uses a dew point base of 14 °C (57 °F). Further, the heat index uses heat balance equations which account for many variables other than vapour pressure, which is used exclusively in the humidex calculation.

References

Canada [2011], Masterton and Richardson [1979], Mekis, Vincent, Shephard, and Zhang [2015], Sirangelo, Caloiero, Coscarelli, Ferrari, and Fusto [2020]

xclim.indicators.convert.longwave_upwelling_radiation_from_net_downwelling(rls='rls', rlds='rlds', *, ds=None)

Upwelling longwave radiation

Based on function longwave_upwelling_radiation_from_net_downwelling().

Parameters:
  • rls (str or DataArray) – Surface net thermal radiation. Default: ‘rls’. [Required units : [radiation]]

  • rlds (str or DataArray) – Surface downwelling thermal radiation. Default: ‘rlds’. [Required units : [radiation]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [W m-2] – surface_upwelling_longwave_flux, Upwelling longwave flux. With additional attributes: description: The calculation of upwelling longwave radiative flux from net surface longwave and downwelling surface longwave fluxes.

Return type:

xarray.DataArray

xclim.indicators.convert.mean_radiant_temperature(rsds='rsds', rsus='rsus', rlds='rlds', rlus='rlus', *, stat='sunlit', ds=None)

Mean radiant temperature

The average temperature of solar and thermal radiation incident on the body’s exterior.

Based on function mean_radiant_temperature().

Parameters:
  • rsds (str or DataArray) – Surface Downwelling Shortwave Radiation. Default: ‘rsds’. [Required units : [radiation]]

  • rsus (str or DataArray) – Surface Upwelling Shortwave Radiation. Default: ‘rsus’. [Required units : [radiation]]

  • rlds (str or DataArray) – Surface Downwelling Longwave Radiation. Default: ‘rlds’. [Required units : [radiation]]

  • rlus (str or DataArray) – Surface Upwelling Longwave Radiation. Default: ‘rlus’. [Required units : [radiation]]

  • stat ({‘instant’, ‘sunlit’}) – Which statistic to apply. If “instant”, the instantaneous cosine of the solar zenith angle is calculated. If “sunlit”, the cosine of the solar zenith angle is calculated during the sunlit period of each interval. Default: ‘sunlit’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K] – Mean radiant temperature. With additional attributes: description: The incidence of radiation on the body from all directions.

Return type:

xarray.DataArray

Notes

This code was inspired by the thermofeel package [Brimicombe et al., 2021].

References

Di Napoli, Hogan, and Pappenberger [2020]

xclim.indicators.convert.mean_temperature_from_max_and_min(tasmin='tasmin', tasmax='tasmax', *, ds=None)

Mean temperature

The average daily temperature assuming a symmetrical temperature distribution (Tg = (Tx + Tn) / 2).

Based on function tas_from_tasmin_tasmax().

Parameters:
  • tasmin (str or DataArray) – Minimum (daily) Temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum (daily) Temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K] – air_temperature, Daily mean temperature. With additional attributes: description: Estimated mean temperature from maximum and minimum temperatures., cell_methods: time: mean within days

Return type:

xarray.DataArray

xclim.indicators.convert.potential_evapotranspiration(tasmin=None, tasmax=None, tas=None, lat=None, hurs=None, rsds=None, rsus=None, rlds=None, rlus=None, sfcWind=None, pr=None, *, method='BR65', peta=0.00516409319477, petb=0.0874972822289, ds=None)

Potential evapotranspiration

The potential for water evaporation from soil and transpiration by plants if the water supply is sufficient, calculated with a given method.

Based on function potential_evapotranspiration().

Parameters:
  • tasmin (str or DataArray, optional) – Minimum daily Temperature. Default: None. [Required units : [temperature]]

  • tasmax (str or DataArray, optional) – Maximum daily Temperature. Default: None. [Required units : [temperature]]

  • tas (str or DataArray, optional) – Mean daily Temperature. Default: None. [Required units : [temperature]]

  • lat (str or DataArray, optional) – Latitude. If not provided, it is sought on tasmin or tas using cf-xarray accessors. Default: None. [Required units : []]

  • hurs (str or DataArray, optional) – Relative Humidity. Default: None. [Required units : []]

  • rsds (str or DataArray, optional) – Surface Downwelling Shortwave Radiation. Default: None. [Required units : [radiation]]

  • rsus (str or DataArray, optional) – Surface Upwelling Shortwave Radiation. Default: None. [Required units : [radiation]]

  • rlds (str or DataArray, optional) – Surface Downwelling Longwave Radiation. Default: None. [Required units : [radiation]]

  • rlus (str or DataArray, optional) – Surface Upwelling Longwave Radiation. Default: None. [Required units : [radiation]]

  • sfcWind (str or DataArray, optional) – Surface Wind Velocity (at 10 m). Default: None. [Required units : [speed]]

  • pr (str or DataArray, optional) – Mean daily Precipitation Flux. Default: None. [Required units : [precipitation]]

  • method ({‘TW48’, ‘HG85’, ‘DA02’, ‘thornthwaite48’, ‘BR65’, ‘allen98’, ‘FAO_PM98’, ‘droogersallen02’, ‘baierrobertson65’, ‘hargreaves85’, ‘mcguinnessbordne05’, ‘MB05’}) – Which method to use, see Notes. Default: ‘BR65’.

  • peta (number) – Used only with method MB05 as \(a\) for calculation of PET, see Notes section. Default value resulted from calibration of PET over the UK. Default: 0.00516409319477.

  • petb (number) – Used only with method MB05 as \(b\) for calculation of PET, see Notes section. Default value resulted from calibration of PET over the UK. Default: 0.0874972822289.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [kg m-2 s-1] – water_potential_evapotranspiration_flux, Potential evapotranspiration (“{method}” method). With additional attributes: description: The potential for water evaporation from soil and transpiration by plants if the water supply is sufficient, calculated with the {method} method.

Return type:

xarray.DataArray

Notes

Available methods are:

  • “baierrobertson65” or “BR65”, based on Baier and Robertson [1965]. Requires tasmin and tasmax, daily [D] freq.

  • “hargreaves85” or “HG85”, based on George H. Hargreaves and Zohrab A. Samani [1985]. Requires tasmin and tasmax, daily [D] freq. (optional: tas can be given in addition of tasmin and tasmax).

  • “mcguinnessbordne05” or “MB05”, based on Tanguy et al. [2018]. Requires tas, daily [D] freq, with latitudes ‘lat’.

  • “thornthwaite48” or “TW48”, based on Thornthwaite [1948]. Requires tasmin and tasmax, monthly [MS] or daily [D] freq. (optional: tas can be given instead of tasmin and tasmax).

  • “allen98” or “FAO_PM98”, based on Allen et al. [1998]. Modification of Penman-Monteith method. Requires tasmin and tasmax, relative humidity, radiation flux and wind speed (10 m wind will be converted to 2 m).

  • “droogersallen02” or “DA02”, based on Droogers and Allen [2002]. Requires tasmin, tasmax and precipitation, monthly [MS] or daily [D] freq. (optional: tas can be given in addition of tasmin and tasmax).

The McGuinness-Bordne [McGuinness and Borone, 1972] equation is:

\[PET[mm day^{-1}] = a * \frac{S_0}{\lambda}T_a + b * \frac{S_0}{\lambda}\]

where \(a\) and \(b\) are empirical parameters; \(S_0\) is the extraterrestrial radiation [MJ m-2 day-1], assuming a solar constant of 1367 W m-2; \(\\lambda\) is the latent heat of vaporisation [MJ kg-1] and \(T_a\) is the air temperature [°C]. The equation was originally derived for the USA, with \(a=0.0147\) and \(b=0.07353\). The default parameters used here are calibrated for the UK, using the method described in Tanguy et al. [2018].

Methods “BR65”, “HG85”, “MB05” and “DA02” use an approximation of the extraterrestrial radiation. See extraterrestrial_solar_radiation().

References

Allen, Pereira, Raes, and Smith [1998], Baier and Robertson [1965], Droogers and Allen [2002], McGuinness and Borone [1972], Tanguy, Prudhomme, Smith, and Hannaford [2018], Thornthwaite [1948], George H. Hargreaves and Zohrab A. Samani [1985]

xclim.indicators.convert.rain_approximation(pr='pr', tas='tas', *, thresh='0 degC', method='binary', clip_temp=None, landmask=True, ds=None)

Rainfall approximation

Liquid precipitation estimated from total precipitation and temperature with a given method and temperature threshold.

Based on function rain_approximation().

Parameters:
  • pr (str or DataArray) – Mean daily Precipitation Flux. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean, Maximum, or Minimum daily Temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Freezing point temperature. Non-scalar values are not allowed with method ‘brown’. Ignored for the 'dai_*' methods. Default: ‘0 degC’. [Required units : [temperature]]

  • method ({‘dai_annual’, ‘auer’, ‘brown’, ‘dai_seasonal’, ‘binary’}) – Which method to use when approximating snowfall from total precipitation. See notes. Default: ‘binary’.

  • clip_temp (quantity (string or DataArray, with units)) – For methods “dai_annual” and “dai_seasonal”, this is an optional temperature delta at which the snowfall fraction function rescaled to 0 or 1. See notes. Default: None. [Required units : [temperature]]

  • landmask (DataArray or scalar) – For methods “dai_annual” and “dai_seasonal”, this is the land mask, a DataArray without a time dimension that is True on land grid points and False on ocean grid points. Can also be True or False to use one or the other coefficients set for all points. Default is to consider all points as land. Default: True.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [kg m-2 s-1] – precipitation_flux, Liquid precipitation (“{method}” method with temperature at or above {thresh}). With additional attributes: description: Liquid precipitation estimated from total precipitation and temperature with method {method} and threshold temperature {thresh}.

Return type:

xarray.DataArray

Notes

For methods “binary”, “brown” and “auer”, this method computes the snowfall approximation and subtracts it from the total precipitation to estimate the liquid rain precipitation. See snowfall_approximation`().

For the “dai_*”, methods, the rain fraction evolves according to an hyperbolic tangent function that has different parameters for precipitation over land or ocean. The snow and rain fraction do not add to 1. Rather, the remainder can be associated to a “sleet” fraction.

If clip_temp is given, its value $$T_c$$ (in °C) is used to rescale (and then clip) the rain fraction function $$f(T)$$ as $$(f(T) - f(-T_c))/(f(T_c) - f(-T_c))$$, so that it is 0 when $$T < -T_c$$ and 1 when $$T > T_c$$.

The “dai_seasonal” method has different parameters for each season. The “annual” coefficients are taken over ocean in summer. These methods are implemented from [Dai, 2008] (clip_temp is an addition from the xclim team).

References

Dai [2008], Melton [2019], Verseghy [2009]

xclim.indicators.convert.relative_humidity(tas='tas', huss='huss', ps='ps', *, ice_thresh=None, method='sonntag90', interp_power=None, water_thresh='0 °C', invalid_values='mask', ds=None)

Relative humidity from temperature, specific humidity, and pressure

Calculation of relative humidity from temperature, specific humidity, and pressure using the saturation vapour pressure.

Based on function relative_humidity(). With injected parameters: tdps=None.

Parameters:
  • tas (str or DataArray) – Mean Temperature. Default: ‘tas’. [Required units : [temperature]]

  • huss (str or DataArray) – Specific Humidity. Must be given if tdps is not given. Default: ‘huss’. [Required units : []]

  • ps (str or DataArray) – Air Pressure. Must be given if tdps is not given. Default: ‘ps’. [Required units : [pressure]]

  • ice_thresh (quantity (string or DataArray, with units)) – Threshold temperature under which to switch to equations in reference to ice instead of water. If None (default) everything is computed with reference to water. Does nothing if ‘method’ is “bohren98”. Default: None. [Required units : [temperature]]

  • method ({‘goffgratch46’, ‘ecmwf’, ‘bohren98’, ‘sonntag90’, ‘wmo08’, ‘tetens30’}) – Which method to use, see notes of this function and of saturation_vapor_pressure(). Default: ‘sonntag90’.

  • interp_power (number) – Optional interpolation for mixing saturation vapour pressures computed over water and ice. See saturation_vapor_pressure(). Default: None.

  • water_thresh (quantity (string or DataArray, with units)) – When interp_power is given, this is the threshold temperature above which the formulas with reference to water are used. Default: ‘0 °C’. [Required units : [temperature]]

  • invalid_values ({None, ‘clip’, ‘mask’}) – What to do with values outside the 0-100 range. If “clip” (default), clips everything to 0 - 100, if “mask”, replaces values outside the range by np.nan, and if None, does nothing. Default: ‘mask’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – relative_humidity, Relative Humidity (“{method}” method). With additional attributes: description: <function <lambda> at 0x718e955c9760>

Return type:

xarray.DataArray

Notes

In the following, let \(T\), \(T_d\), \(q\) and \(p\) be the temperature, the dew point temperature, the specific humidity and the air pressure.

For the “bohren98” method : This method does not use the saturation vapour pressure directly, but rather uses an approximation of the ratio of \(\frac{e_{sat}(T_d)}{e_{sat}(T)}\). With \(L\) the enthalpy of vaporization of water and \(R_w\) the gas constant for water vapour, the relative humidity is computed as:

\[RH = e^{\frac{-L (T - T_d)}{R_wTT_d}}\]

From Bohren and Albrecht [1998], formula taken from Lawrence [2005]. \(L = 2.5\times 10^{-6}\) J kg-1, exact for \(T = 273.15\) K, is used.

Other methods: With \(w\), \(w_{sat}\), \(e_{sat}\) the mixing ratio, the saturation mixing ratio and the saturation vapour pressure. If the dewpoint temperature is given, relative humidity is computed as:

\[RH = 100\frac{e_{sat}(T_d)}{e_{sat}(T)}\]

Otherwise, the specific humidity and the air pressure must be given so relative humidity can be computed as the ratio of actual vapor pressure to saturation vapor pressure:

\[RH = 100\frac{P_w}{P_{wsat}} P_w = \frac{pq}{\epsilon\left(1 + q\left(\frac{1}{\epsilon} - 1\right)\right)} \epsilon = 0.62198\]

The methods differ by how \(P_{wsat}\) is computed. See the doc of saturation_vapor_pressure() and vapor_pressure(). This equation for RH is the same as eq. 4.A.15 of [World Meteorological Organization, 2008] and differs very slightly from MetPy which uses 4.A.16 by computing the mixing ratios first.

References

Bohren and Albrecht [1998], Lawrence [2005]

xclim.indicators.convert.relative_humidity_from_dewpoint(tas='tas', tdps='tdps', *, ice_thresh=None, method='sonntag90', interp_power=None, water_thresh='0 °C', invalid_values='mask', ds=None)

Relative humidity from temperature and dewpoint temperature

Calculation of relative humidity from temperature and dew point using the saturation vapour pressure.

Based on function relative_humidity(). With injected parameters: huss=None, ps=None.

Parameters:
  • tas (str or DataArray) – Mean Temperature. Default: ‘tas’. [Required units : [temperature]]

  • tdps (str or DataArray) – Dewpoint Temperature. If specified, overrides huss and ps. Default: ‘tdps’. [Required units : [temperature]]

  • ice_thresh (quantity (string or DataArray, with units)) – Threshold temperature under which to switch to equations in reference to ice instead of water. If None (default) everything is computed with reference to water. Does nothing if ‘method’ is “bohren98”. Default: None. [Required units : [temperature]]

  • method ({‘goffgratch46’, ‘ecmwf’, ‘bohren98’, ‘sonntag90’, ‘wmo08’, ‘tetens30’}) – Which method to use, see notes of this function and of saturation_vapor_pressure(). Default: ‘sonntag90’.

  • interp_power (number) – Optional interpolation for mixing saturation vapour pressures computed over water and ice. See saturation_vapor_pressure(). Default: None.

  • water_thresh (quantity (string or DataArray, with units)) – When interp_power is given, this is the threshold temperature above which the formulas with reference to water are used. Default: ‘0 °C’. [Required units : [temperature]]

  • invalid_values ({None, ‘clip’, ‘mask’}) – What to do with values outside the 0-100 range. If “clip” (default), clips everything to 0 - 100, if “mask”, replaces values outside the range by np.nan, and if None, does nothing. Default: ‘mask’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – relative_humidity, Relative humidity (“{method}” method). With additional attributes: description: <function <lambda> at 0x718e955c8d60>

Return type:

xarray.DataArray

Notes

In the following, let \(T\), \(T_d\), \(q\) and \(p\) be the temperature, the dew point temperature, the specific humidity and the air pressure.

For the “bohren98” method : This method does not use the saturation vapour pressure directly, but rather uses an approximation of the ratio of \(\frac{e_{sat}(T_d)}{e_{sat}(T)}\). With \(L\) the enthalpy of vaporization of water and \(R_w\) the gas constant for water vapour, the relative humidity is computed as:

\[RH = e^{\frac{-L (T - T_d)}{R_wTT_d}}\]

From Bohren and Albrecht [1998], formula taken from Lawrence [2005]. \(L = 2.5\times 10^{-6}\) J kg-1, exact for \(T = 273.15\) K, is used.

Other methods: With \(w\), \(w_{sat}\), \(e_{sat}\) the mixing ratio, the saturation mixing ratio and the saturation vapour pressure. If the dewpoint temperature is given, relative humidity is computed as:

\[RH = 100\frac{e_{sat}(T_d)}{e_{sat}(T)}\]

Otherwise, the specific humidity and the air pressure must be given so relative humidity can be computed as the ratio of actual vapor pressure to saturation vapor pressure:

\[RH = 100\frac{P_w}{P_{wsat}} P_w = \frac{pq}{\epsilon\left(1 + q\left(\frac{1}{\epsilon} - 1\right)\right)} \epsilon = 0.62198\]

The methods differ by how \(P_{wsat}\) is computed. See the doc of saturation_vapor_pressure() and vapor_pressure(). This equation for RH is the same as eq. 4.A.15 of [World Meteorological Organization, 2008] and differs very slightly from MetPy which uses 4.A.16 by computing the mixing ratios first.

References

Bohren and Albrecht [1998], Lawrence [2005]

xclim.indicators.convert.saturation_vapor_pressure(tas='tas', *, ice_thresh=None, method='sonntag90', interp_power=None, water_thresh='0 °C', ds=None)

Saturation vapour pressure (e_sat)

Calculation of the saturation vapour pressure from the temperature, according to a given method. If ice_thresh is given, the calculation is done with reference to ice for temperatures below this threshold.

Based on function saturation_vapor_pressure().

Parameters:
  • tas (str or DataArray) – Mean Temperature. Default: ‘tas’. [Required units : [temperature]]

  • ice_thresh (quantity (string or DataArray, with units)) – Threshold temperature under which to switch to equations in reference to ice instead of water. If None (default) everything is computed with reference to water. If given, see interp_power for more options. Default: None. [Required units : [temperature]]

  • method ({‘goffgratch46’, ‘ecmwf’, ‘aerk96’, ‘buck81’, ‘sonntag90’, ‘wmo08’, ‘its90’, ‘tetens30’}) – Which saturation vapour pressure formula to use, see notes. Default: ‘sonntag90’.

  • interp_power (number) – Interpolation options for mixing saturation over water and over ice. See notes. Default: None.

  • water_thresh (quantity (string or DataArray, with units)) – When interp_power is given, this is the threshold temperature above which the formulas with reference to water are used. Default: ‘0 °C’. [Required units : [temperature]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [Pa] – Saturation vapour pressure (“{method}” method). With additional attributes: description: <function <lambda> at 0x718e955c8900>

Return type:

xarray.DataArray

Notes

In all cases implemented here \(log(e_{sat})\) is an empirically fitted function (usually a polynomial) where coefficients can be different when ice is taken as reference instead of water. Available methods are:

  • “goffgratch46”, based on Goff and Gratch [1946], values and equation taken from Vömel [2016].

  • “sonntag90””, taken from SONNTAG [1990].

  • “tetens30”, based on Tetens [1930], values and equation taken from Vömel [2016].

  • “wmo08”, taken from World Meteorological Organization [2008].

  • “its90”, taken from Hardy [1998].

  • “buck81”, taken from Buck [1981].

  • “aerk96”, corresponds to formulas AERK and AERKi of Alduchov and Eskridge [1996]

  • “ecmwf”, taken from ECMWF [2016]. This uses “buck91” for saturation over water and “aerk96” for saturation over ice.

Water vs ice

This function implements 3 cases:

  • All water. When interp_power is None (default) and ice_thresh is None (default). Formulas use water as a reference. This might lead to relative humidities above 100 % for cold temperatures. This is usually what observational products use (World Meteorological Organization [2008]), and also how the dew point of ERA5 is computed.

  • Binary water-ice transition. When interp_power is None (default) and ``ice_thresh is given. The formulas with reference to water are used for temperatures above ice_thresh and the ones with reference to ice are used for temperatures equal to or under ice_thresh. Often used in models, this is what MetPy does.

  • Interpolation between water and ice. When interp_power, ice_thresh and water_thresh are all given, formulas with reference to water are used for temperatures above water_thresh, the formulas with reference to ice are used for temperatures below ice_thresh and an interpolation is used in between.

\[ \begin{align}\begin{aligned}e_{sat} = \alpha e_{sat(water)}(T) + (1 - \alpha) e_{sat(ice)}(T)\\\alpha = \left(\frac{T - T_i}{T_w - T_i}\right)^{\beta}\end{aligned}\end{align} \]

Where \(T_{ice}\) is ice_thresh, \(T_{w}\) is water_thresh and \(\beta\) is interp_power.

As a note, a computation resembling what ECMWF’s IFS does to compute relative humidity would use: method = 'ecmwf', ice_thresh = 250.16 K, water_thresh = 273.16 K (default) and interp_power = 2 (ECMWF [2016]). Take note, however, that the 2m dew point temperature given by the IFS (ERA5, ERA5-Land) is computed with reference to water only.

References

ECMWF [2016], Goff and Gratch [1946], Hardy [1998], SONNTAG [1990], Tetens [1930] Alduchov and Eskridge [1996], Buck [1981], Vömel [2016], World Meteorological Organization [2008]

xclim.indicators.convert.shortwave_upwelling_radiation_from_net_downwelling(rss='rss', rsds='rsds', *, ds=None)

Upwelling shortwave radiation

Based on function shortwave_upwelling_radiation_from_net_downwelling().

Parameters:
  • rss (str or DataArray) – Surface net solar radiation. Default: ‘rss’. [Required units : [radiation]]

  • rsds (str or DataArray) – Surface downwelling solar radiation. Default: ‘rsds’. [Required units : [radiation]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [W m-2] – surface_upwelling_shortwave_flux, Upwelling shortwave flux. With additional attributes: description: The calculation of upwelling shortwave radiative flux from net surface shortwave and downwelling surface shortwave fluxes.

Return type:

xarray.DataArray

xclim.indicators.convert.snd_to_snw(snd='snd', *, snr=None, const='312 kg m-3', ds=None)

Surface snow amount

Based on function snd_to_snw(). With injected parameters: out_units=None.

Parameters:
  • snd (str or DataArray) – Snow Depth. Default: ‘snd’. [Required units : [length]]

  • snr (quantity (string or DataArray, with units)) – Snow Density. Default: None. [Required units : [mass]/[volume]]

  • const (quantity (string or DataArray, with units)) – Constant snow density. const is only used if snr is None. Default: ‘312 kg m-3’. [Required units : [mass]/[volume]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [kg m-2] – surface_snow_amount, Approximation of daily snow amount from snow depth and density. With additional attributes: description: The approximation of daily snow amount from snow depth and density.

Return type:

xarray.DataArray

Notes

The estimated mean snow density value of 312 kg m-3 is taken from Sturm et al. [2010].

References

Sturm, Taras, Liston, Derksen, Jonas, and Lea [2010]

xclim.indicators.convert.snowfall_approximation(pr='pr', tas='tas', *, thresh='0 degC', method='binary', clip_temp=None, landmask=True, ds=None)

Snowfall approximation

Solid precipitation estimated from total precipitation and temperature with a given method and temperature threshold.

Based on function snowfall_approximation().

Parameters:
  • pr (str or DataArray) – Mean daily Precipitation Flux. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean, Maximum, or Minimum daily Temperature. Default: ‘tas’. [Required units : [temperature]]

  • thresh (quantity (string or DataArray, with units)) – Freezing point temperature. Non-scalar values are not allowed with method “brown”. Ignored for the 'dai_*' methods. Default: ‘0 degC’. [Required units : [temperature]]

  • method ({‘dai_annual’, ‘auer’, ‘brown’, ‘dai_seasonal’, ‘binary’}) – Which method to use when approximating snowfall from total precipitation. See notes. Default: ‘binary’.

  • clip_temp (quantity (string or DataArray, with units)) – For methods “dai_annual” and “dai_seasonal”, this is an optional temperature delta at which the snowfall fraction is rescaled to 0 or 1. See notes. Default: None. [Required units : [temperature]]

  • landmask (DataArray or scalar) – For methods “dai_annual” and “dai_seasonal”, this is the land mask, a DataArray without a time dimension that is True on land grid points and False on ocean grid points. Can also be True or False to use one or the other coefficients set for all points. Default is to consider all points as land. Default: True.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [kg m-2 s-1] – solid_precipitation_flux, Solid precipitation (“{method}” method with temperature at or below {thresh}). With additional attributes: description: Solid precipitation estimated from total precipitation and temperature with method {method} and threshold temperature {thresh}.

Return type:

xarray.DataArray

Notes

The following methods are available to approximate snowfall. 'brown' and 'auer' are drawn from the Canadian Land Surface Scheme [Melton, 2019, Verseghy, 2009]. The two 'dai_*' methods are implemented from [Dai, 2008] (clip_temp is an addition from the xclim team).

  • 'binary' : When the temperature is under the freezing threshold, precipitation is assumed to be solid. The method is agnostic to the type of temperature used (mean, maximum or minimum).

  • 'brown' : The phase between the freezing threshold goes from solid to liquid linearly over a range of 2°C over the freezing point.

  • 'auer' : The phase between the freezing threshold goes from solid to liquid as a degree six polynomial over a range of 6°C over the freezing point.

  • 'dai_annual' : The snow fraction evolves according to an hyperbolic tangent function that has different parameters for precipitation over land or ocean. The snow and rain fractions do not add to 1, rather the remainder is denoted as a “sleet” fraction. If clip_temp is given, its value $$T_c$$ (in °C) is used to rescale (and then clip) the snowfall fraction function $$f(T)$$ as $$(f(T) - f(T_c))/(f(-T_c) - f(T_c))$$, so that it is 0 when $$T > T_c$$ and 1 when $$T < -T_c$$.

  • 'dai_seasonal' : Same as 'dai_annual', but parameters are different for each season. The “annual” coefficients are taken over ocean in summer (JJA).

References

Dai [2008], Melton [2019], Verseghy [2009]

xclim.indicators.convert.snw_to_snd(snw='snw', *, snr=None, const='312 kg m-3', ds=None)

Surface snow depth

Based on function snw_to_snd(). With injected parameters: out_units=None.

Parameters:
  • snw (str or DataArray) – Snow amount. Default: ‘snw’. [Required units : [mass]/[area]]

  • snr (quantity (string or DataArray, with units)) – Snow density. Default: None. [Required units : [mass]/[volume]]

  • const (quantity (string or DataArray, with units)) – Constant snow density. const is only used if snr is None. Default: ‘312 kg m-3’. [Required units : [mass]/[volume]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [m] – surface_snow_thickness, Approximation of daily snow depth from snow amount and density. With additional attributes: description: The approximation of daily snow depth from snow amount and density.

Return type:

xarray.DataArray

Notes

The estimated mean snow density value of 312 kg m-3 is taken from Sturm et al. [2010].

References

Sturm, Taras, Liston, Derksen, Jonas, and Lea [2010]

xclim.indicators.convert.specific_humidity(tas='tas', hurs='hurs', ps='ps', *, ice_thresh=None, method='sonntag90', interp_power=None, water_thresh='0 °C', ds=None)

Specific humidity from temperature, relative humidity, and pressure

Calculation of specific humidity from temperature, relative humidity, and pressure using the saturation vapour pressure.

Based on function specific_humidity(). With injected parameters: invalid_values=mask.

Parameters:
  • tas (str or DataArray) – Mean Temperature. Default: ‘tas’. [Required units : [temperature]]

  • hurs (str or DataArray) – Relative Humidity. Default: ‘hurs’. [Required units : []]

  • ps (str or DataArray) – Air Pressure. Default: ‘ps’. [Required units : [pressure]]

  • ice_thresh (quantity (string or DataArray, with units)) – Threshold temperature under which to switch to equations in reference to ice instead of water. If None (default) everything is computed with reference to water. Default: None. [Required units : [temperature]]

  • method ({‘goffgratch46’, ‘ecmwf’, ‘sonntag90’, ‘wmo08’, ‘tetens30’}) – Which method to use, see notes of this function and of saturation_vapor_pressure(). Default: ‘sonntag90’.

  • interp_power (number) – Optional interpolation for mixing saturation vapour pressures computed over water and ice. See saturation_vapor_pressure(). Default: None.

  • water_thresh (quantity (string or DataArray, with units)) – When interp_power is given, this is the threshold temperature above which the formulas with reference to water are used. Default: ‘0 °C’. [Required units : [temperature]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [dimensionless] – specific_humidity, Specific Humidity (“{method}” method). With additional attributes: description: <function <lambda> at 0x718e955c9ee0>

Return type:

xarray.DataArray

Notes

In the following, let \(T\), \(hurs\) (in %) and \(p\) be the temperature, the relative humidity and the air pressure. With \(w\), \(w_{sat}\), \(e_{sat}\) the mixing ratio, the saturation mixing ratio and the saturation vapour pressure, specific humidity \(q\) is computed as:

\[w_{sat} = 0.622\frac{e_{sat}}{P - e_{sat}} w = w_{sat} * hurs / 100 q = w / (1 + w)\]

The methods differ by how \(e_{sat}\) is computed. See xclim.core.utils.saturation_vapor_pressure().

If invalid_values is not None, the saturation specific humidity \(q_{sat}\) is computed as:

\[q_{sat} = w_{sat} / (1 + w_{sat})\]

References

World Meteorological Organization [2008]

xclim.indicators.convert.specific_humidity_from_dewpoint(tdps='tdps', ps='ps', *, ice_thresh=None, method='sonntag90', interp_power=None, water_thresh='0 °C', ds=None)

Specific humidity from dew point temperature and pressure

Calculation of the specific humidity from dew point temperature and pressure using the saturation vapour pressure.

Based on function specific_humidity_from_dewpoint().

Parameters:
  • tdps (str or DataArray) – Dewpoint Temperature. Default: ‘tdps’. [Required units : [temperature]]

  • ps (str or DataArray) – Air Pressure. Default: ‘ps’. [Required units : [pressure]]

  • ice_thresh (quantity (string or DataArray, with units)) – Threshold temperature under which to switch to saturated vapour pressure equations in reference to ice instead of water. See saturation_vapor_pressure(). Default: None. [Required units : [temperature]]

  • method ({‘goffgratch46’, ‘ecmwf’, ‘aerk96’, ‘buck81’, ‘sonntag90’, ‘wmo08’, ‘tetens30’}) – Method to compute the saturation vapour pressure. Default: ‘sonntag90’.

  • interp_power (number) – Optional interpolation for mixing saturation vapour pressures computed over water and ice. See saturation_vapor_pressure(). Default: None.

  • water_thresh (quantity (string or DataArray, with units)) – When interp_power is given, this is the threshold temperature above which the formulas with reference to water are used. Default: ‘0 °C’. [Required units : [temperature]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [dimensionless] – specific_humidity, Specific humidity. With additional attributes: description: Computed from dewpoint temperature and pressure through the saturation vapor pressure, which was calculated according to the {method} method.

Return type:

xarray.DataArray

Notes

If \(e\) is the water vapour pressure, and \(p\) the total air pressure, then specific humidity is given by

\[q = m_w e / ( m_a (p - e) + m_w e )\]

where \(m_w\) and \(m_a\) are the molecular weights of water and dry air respectively. This formula is often written with \(ε = m_w / m_a\), which simplifies to \(q = ε e / (p - e (1 - ε))\).

References

World Meteorological Organization [2008]

xclim.indicators.convert.universal_thermal_climate_index(tas='tas', hurs='hurs', sfcWind='sfcWind', mrt=None, rsds=None, rsus=None, rlds=None, rlus=None, *, stat='sunlit', mask_invalid=True, wind_cap_min=False, ds=None)

Universal Thermal Climate Index (UTCI)

UTCI is the equivalent temperature for the environment derived from a reference environment and is used to evaluate heat stress in outdoor spaces.

Based on function universal_thermal_climate_index().

Parameters:
  • tas (str or DataArray) – Mean Temperature. Default: ‘tas’. [Required units : [temperature]]

  • hurs (str or DataArray) – Relative Humidity. Default: ‘hurs’. [Required units : []]

  • sfcWind (str or DataArray) – Wind Velocity. Default: ‘sfcWind’. [Required units : [speed]]

  • mrt (str or DataArray, optional) – Mean Radiant Temperature. Default: None. [Required units : [temperature]]

  • rsds (str or DataArray, optional) – Surface Downwelling Shortwave Radiation. This is necessary if mrt is not None. Default: None. [Required units : [radiation]]

  • rsus (str or DataArray, optional) – Surface Upwelling Shortwave Radiation. This is necessary if mrt is not None. Default: None. [Required units : [radiation]]

  • rlds (str or DataArray, optional) – Surface Downwelling Longwave Radiation. This is necessary if mrt is not None. Default: None. [Required units : [radiation]]

  • rlus (str or DataArray, optional) – Surface Upwelling Longwave Radiation. This is necessary if mrt is not None. Default: None. [Required units : [radiation]]

  • stat ({‘instant’, ‘sunlit’}) – Which statistic to apply. If “instant”, the instantaneous cosine of the solar zenith angle is calculated. If “sunlit”, the cosine of the solar zenith angle is calculated during the sunlit period of each interval. This is necessary if mrt is not None. Default: ‘sunlit’.

  • mask_invalid (boolean) – If True (default), UTCI values are NaN where any of the inputs are outside their validity ranges: - -50°C < tas < 50°C. - -30°C < tas - mrt < 30°C. - 0.5 m/s < sfcWind < 17.0 m/s. Default: True.

  • wind_cap_min (boolean) – If True, wind velocities are capped to a minimum of 0.5 m/s following Bröde et al. [2012] usage guidelines. This ensures UTCI calculation for low winds. Default value False. Default: False.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K] – Universal Thermal Climate Index (UTCI). With additional attributes: description: UTCI is the equivalent temperature for the environment derived from a reference environment and is used to evaluate heat stress in outdoor spaces.

Return type:

xarray.DataArray

Notes

The calculation uses water vapour partial pressure, which is derived from relative humidity and saturation vapour pressure computed according to the ITS-90 equation.

This code was inspired by the pythermalcomfort and thermofeel packages.

For more information: https://www.utci.org/

References

Błażejczyk, Jendritzky, Bröde, Fiala, Havenith, Epstein, Psikuta, and Kampmann [2013], Bröde [2009], Bröde, Fiala, Błażejczyk, Holmér, Jendritzky, Kampmann, Tinz, and Havenith [2012]

xclim.indicators.convert.vapor_pressure(huss='huss', ps='ps', *, ds=None)

Vapour pressure.

Computes the water vapour partial pressure in Pa from the specific humidity and the total pressure.

Based on function vapor_pressure().

Parameters:
  • huss (str or DataArray) – Specific humidity [kg/kg]. Default: ‘huss’. [Required units : []]

  • ps (str or DataArray) – Pressure. Default: ‘ps’. [Required units : [pressure]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [Pa] – water_vapor_partial_pressure_in_air, Water vapour partial pressure.. With additional attributes: description: Water vapour partial pressure computed from specific humidity and total pressure.

Return type:

xarray.DataArray

Notes

The vapour pressure \(\epsilon\) is computed with:

\[e = \frac{pq}{\epsilon + (1 - \epsilon)q}\]

Where \(p\) is the pressure, \(q\) is the specific humidity and \(\epsilon\) us the ratio of the dry air gas constant to the water vapor gas constant : \(\frac{R_{dry}}{R_{vapor}} = 0.62198\).

xclim.indicators.convert.vapor_pressure_deficit(tas='tas', hurs='hurs', *, ice_thresh=None, method='sonntag90', interp_power=None, water_thresh='0 °C', ds=None)

Water vapour pressure deficit

Difference between the saturation vapour pressure and the actual vapour pressure.

Based on function vapor_pressure_deficit().

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • hurs (str or DataArray) – Relative humidity. Default: ‘hurs’. [Required units : []]

  • ice_thresh (quantity (string or DataArray, with units)) – Threshold temperature under which to switch to equations in reference to ice instead of water. If None (default) everything is computed with reference to water. Default: None. [Required units : [temperature]]

  • method ({‘goffgratch46’, ‘ecmwf’, ‘sonntag90’, ‘wmo08’, ‘its90’, ‘tetens30’}) – Method used to calculate saturation vapour pressure, see notes of saturation_vapor_pressure(). Default is “sonntag90”. Default: ‘sonntag90’.

  • interp_power (number) – Optional interpolation for mixing saturation vapour pressures computed over water and ice. See saturation_vapor_pressure(). Default: None.

  • water_thresh (quantity (string or DataArray, with units)) – When interp_power is given, this is the threshold temperature above which the formulas with reference to water are used. Default: ‘0 °C’. [Required units : [temperature]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [Pa] – water_vapor_saturation_deficit_in_air, Vapour pressure deficit (“{method}” method). With additional attributes: description: <function <lambda> at 0x718e955ca480>

Return type:

xarray.DataArray

xclim.indicators.convert.water_budget(pr='pr', evspsblpot='evspsblpot', *, ds=None)

Water budget

Precipitation minus potential evapotranspiration as a measure of an approximated surface water budget.

Based on function water_budget(). With injected parameters: tasmin=None, tasmax=None, tas=None, lat=None, hurs=None, rsds=None, rsus=None, rlds=None, rlus=None, sfcWind=None, method=None.

Parameters:
  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • evspsblpot (str or DataArray) – Potential evapotranspiration. Default: ‘evspsblpot’. [Required units : [precipitation]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [kg m-2 s-1] – Water budget. With additional attributes: description: Precipitation minus potential evapotranspiration as a measure of an approximated surface water budget.

Return type:

xarray.DataArray

xclim.indicators.convert.water_budget_from_tas(pr='pr', tasmin=None, tasmax=None, tas=None, lat=None, hurs=None, rsds=None, rsus=None, rlds=None, rlus=None, sfcWind=None, *, method='BR65', ds=None)

Water budget

Precipitation minus potential evapotranspiration as a measure of an approximated surface water budget, where the potential evapotranspiration is calculated with a given method.

Based on function water_budget(). With injected parameters: evspsblpot=None.

Parameters:
  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tasmin (str or DataArray, optional) – Minimum daily temperature. Default: None. [Required units : [temperature]]

  • tasmax (str or DataArray, optional) – Maximum daily temperature. Default: None. [Required units : [temperature]]

  • tas (str or DataArray, optional) – Mean daily temperature. Default: None. [Required units : [temperature]]

  • lat (str or DataArray, optional) – Latitude coordinate, needed if evspsblpot is not given. If None, a CF-conformant “latitude” field must be available within the pr DataArray. Default: None. [Required units : []]

  • hurs (str or DataArray, optional) – Relative humidity. Default: None. [Required units : []]

  • rsds (str or DataArray, optional) – Surface Downwelling Shortwave Radiation. Default: None. [Required units : [radiation]]

  • rsus (str or DataArray, optional) – Surface Upwelling Shortwave Radiation. Default: None. [Required units : [radiation]]

  • rlds (str or DataArray, optional) – Surface Downwelling Longwave Radiation. Default: None. [Required units : [radiation]]

  • rlus (str or DataArray, optional) – Surface Upwelling Longwave Radiation. Default: None. [Required units : [radiation]]

  • sfcWind (str or DataArray, optional) – Surface wind velocity (at 10 m). Default: None. [Required units : [speed]]

  • method (str) – Method to use to calculate the potential evapotranspiration. Default: ‘BR65’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [kg m-2 s-1] – Water budget (“{method}” method). With additional attributes: description: Precipitation minus potential evapotranspiration as a measure of an approximated surface water budget, where the potential evapotranspiration is calculated with the {method} method.

Return type:

xarray.DataArray

xclim.indicators.convert.wind_chill_index(tas='tas', sfcWind='sfcWind', *, method='CAN', ds=None)

Wind chill

Wind chill factor is an index that equates to how cold an average person feels. It is calculated from the temperature and the wind speed at 10 m. As defined by Environment and Climate Change Canada, a second formula is used for light winds. The standard formula is otherwise the same as used in the United States.

Based on function wind_chill_index(). With injected parameters: mask_invalid=True.

Parameters:
  • tas (str or DataArray) – Surface air temperature. Default: ‘tas’. [Required units : [temperature]]

  • sfcWind (str or DataArray) – Surface wind speed (10 m). Default: ‘sfcWind’. [Required units : [speed]]

  • method ({‘US’, ‘CAN’}) – If “CAN” (default), a “slow wind” equation is used where winds are slower than 5 km/h, see Notes. Default: ‘CAN’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degC] – Wind chill factor. With additional attributes: description: <function <lambda> at 0x718e955cb740>

Return type:

xarray.DataArray

Notes

Following the calculations of Environment and Climate Change Canada, this function switches from the standardized index to another one for slow winds. The standard index is the same as used by the National Weather Service of the USA [US Department of Commerce, n.d.]. Given a temperature at surface \(T\) (in °C) and 10-m wind speed \(V\) (in km/h), the Wind Chill Index \(W\) (dimensionless) is computed as:

\[W = 13.12 + 0.6125*T - 11.37*V^0.16 + 0.3965*T*V^0.16\]

Under slow winds (\(V < 5\) km/h), and using the canadian method, it becomes:

\[W = T + \frac{-1.59 + 0.1345 * T}{5} * V\]

Both equations are invalid for temperature over 0°C in the canadian method.

The american Wind Chill Temperature index (WCT), as defined by USA’s National Weather Service, is computed when method=’US’. In that case, the maximal valid temperature is 50°F (10 °C) and minimal wind speed is 3 mph (4.8 km/h).

For more information, see:

References

Mekis, Vincent, Shephard, and Zhang [2015], US Department of Commerce [n.d.]

xclim.indicators.convert.wind_power_potential(wind_speed='wind_speed', air_density=None, *, cut_in='3.5 m/s', rated='13 m/s', cut_out='25 m/s', ds=None)

Wind power potential

Calculation of the wind power potential using a semi-idealized turbine power curve.

Based on function wind_power_potential().

Parameters:
  • wind_speed (str or DataArray) – Wind Speed at the hub height. Use the wind_profile function to estimate from the surface wind speed. Default: ‘wind_speed’. [Required units : [speed]]

  • air_density (str or DataArray, optional) – Air Density at the hub height. Defaults to 1.225 kg/m³. This is worth changing if applying in cold or mountainous regions with non-standard air density. Default: None. [Required units : [air_density]]

  • cut_in (quantity (string or DataArray, with units)) – Cut-in wind speed. Default is 3.5 m/s. Default: ‘3.5 m/s’. [Required units : [speed]]

  • rated (quantity (string or DataArray, with units)) – Rated wind speed. Default is 13 m/s. Default: ‘13 m/s’. [Required units : [speed]]

  • cut_out (quantity (string or DataArray, with units)) – Cut-out wind speed. Default is 25 m/s. Default: ‘25 m/s’. [Required units : [speed]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – Wind power potential. With additional attributes: description: Wind power potential using a semi-idealized turbine power curve using a cut_in speed of {cut_in}, a rated speed of {rated}, and a cut_out speed of {cut_out}.

Return type:

xarray.DataArray

Notes

This estimate of wind power production is based on an idealized power curve with four wind regimes specified by the cut-in wind speed (\(u_i\)), the rated speed (\(u_r\)) and the cut-out speed (\(u_o\)). Power production is zero for wind speeds below the cut-in speed, increases cubically between the cut-in and rated speed, is constant between the rated and cut-out speed, and is zero for wind speeds above the cut-out speed to avoid damage to the turbine [Tobin et al., 2018]:

\[\begin{split}\begin{cases} 0, & v < u_i \\ (v^3 - u_i^3) / (u_r^3 - u_i^3), & u_i ≤ v < u_r \\ 1, & u_r ≤ v < u_o \\ 0, & v ≥ u_o \end{cases}\end{split}\]

For non-standard air density (\(\rho\)), the wind speed is scaled using \(v_n = v \left( \frac{\rho}{\rho_0} \right)^{1/3}\).

The temporal resolution of wind time series has a significant influence on the results: mean daily wind speeds yield lower values than hourly wind speeds. Note however that percent changes in the wind power potential climate projections are similar across resolutions [Chen, 2020].

To compute the power production, multiply the power production factor by the nominal turbine capacity (e.g. 100), set the units attribute (e.g. “MW”), resample and sum with xclim.compute.generic.statistics(power, statistic=”sum”, freq=”D”), then convert to the desired units (e.g. “MWh”) using xclim.core.units.convert_units_to.

References

Chen [2020], Tobin, Greuell, Jerez, Ludwig, Vautard, van Vliet, and Bréon [2018].

xclim.indicators.convert.wind_profile(wind_speed='wind_speed', *, h, h_r, method='power_law', ds=None, **kwds)

Wind profile

Calculation of the wind speed at a given height from the wind speed at a reference height.

Based on function wind_profile().

Parameters:
  • wind_speed (str or DataArray) – Wind Speed at the reference height. Default: ‘wind_speed’. [Required units : [speed]]

  • h (quantity (string or DataArray, with units)) – Height at which to compute the Wind Speed. Required. [Required units : [length]]

  • h_r (quantity (string or DataArray, with units)) – Reference height. Required. [Required units : [length]]

  • method ({‘power_law’}) – Method to use. Currently only “power_law” is implemented. Default: ‘power_law’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • kwds – Additional keyword arguments to pass to the method.For power_law, this is alpha, which takes a default value of 1/7, but is highly variable based on topography, surface cover and atmospheric stability.

Returns:

xarray.DataArray, [m s-1] – wind_speed, Wind speed at height {h}. With additional attributes: description: Wind speed at a height of {h} computed from the wind speed at {h_r} using a power law profile.

Return type:

xarray.DataArray

Notes

The power law profile is given by:

\[v = v_r \left( \frac{h}{h_r} \right)^{\alpha},\]

where \(v_r\) is the wind speed at the reference height, \(h\) is the height at which the wind speed is desired, and \(h_r\) is the reference height.

xclim.indicators.convert.wind_speed_from_vector(uas='uas', vas='vas', *, calm_wind_thresh='0.5 m/s', ds=None)

Wind speed and direction from vector

Calculation of the magnitude and direction of the wind speed from the two components west-east and south-north.

Based on function uas_vas_to_sfcwind().

Parameters:
  • uas (str or DataArray) – Eastward Wind Velocity. Default: ‘uas’. [Required units : [speed]]

  • vas (str or DataArray) – Northward Wind Velocity. Default: ‘vas’. [Required units : [speed]]

  • calm_wind_thresh (quantity (string or DataArray, with units)) – The threshold under which winds are considered “calm” and for which the direction is set to 0. On the Beaufort scale, calm winds are defined as < 0.5 m/s. Default: ‘0.5 m/s’. [Required units : [speed]]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

  • sfcWind (xarray.DataArray, [m s-1]) – wind_speed, Near-surface wind speed. With additional attributes: description: Wind speed computed as the magnitude of the (uas, vas) vector.

  • sfcWindfromdir (xarray.DataArray, [degree]) – wind_from_direction, Near-surface wind from direction. With additional attributes: description: Wind direction computed as the angle of the (uas, vas) vector. A direction of 0° is attributed to winds with a speed under {calm_wind_thresh}.

Return type:

tuple[xarray.DataArray, xarray.DataArray]

Notes

Winds with a velocity less than calm_wind_thresh are given a wind direction of 0°, while stronger northerly winds are set to 360°.

xclim.indicators.convert.wind_vector_from_speed(sfcWind='sfcWind', sfcWindfromdir='sfcWindfromdir', *, ds=None)

Wind vector from speed and direction

Calculation of the two components (west-east and north-south) of the wind from the magnitude of its speed and direction of origin.

Based on function sfcwind_to_uas_vas().

Parameters:
  • sfcWind (str or DataArray) – Wind Velocity. Default: ‘sfcWind’. [Required units : [speed]]

  • sfcWindfromdir (str or DataArray) – Direction from which the wind blows, following the meteorological convention, where “360” denotes “North”. Default: ‘sfcWindfromdir’. [Required units : []]

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

  • uas (xarray.DataArray, [m s-1]) – eastward_wind, Near-surface eastward wind. With additional attributes: description: Eastward wind speed computed from the magnitude of its speed and direction of origin.

  • vas (xarray.DataArray, [m s-1]) – northward_wind, Near-surface northward wind. With additional attributes: description: Northward wind speed computed from magnitude of its speed and direction of origin.

Return type:

tuple[xarray.DataArray, xarray.DataArray]

Built-in Indicator Collections

Module holding all indicators instances.

xclim.indicators.anuclim

ANUCLIM indices

The ANUCLIM (v6.1) software package BIOCLIM sub-module produces a set of bioclimatic parameters derived values of temperature and precipitation. The methods in this module are wrappers around a subset of corresponding methods of xclim.compute.

Furthermore, according to the ANUCLIM user-guide [Xu and Hutchinson, 2010], input values should be at a weekly or monthly frequency. However, the implementation here expands these definitions and can calculate the result with daily input data.

anuclim.P10_MeanTempWarmestQuarter(tas='tas', *, freq='YS', ds=None)

Mean temperature of warmest/coldest quarter.

The warmest (or coldest) quarter of the year is determined, and the mean temperature of this period is calculated. If the input data frequency is daily (“D”) or weekly (“W”), quarters are defined as 13-week periods, otherwise as three (3) months.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function tg_mean_warmcold_quarter(). With injected parameters: op=warmest.

Parameters:
  • tas (str or DataArray) – Mean temperature at daily, weekly, or monthly frequency. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K] – air_temperature, Mean temperature of {op} quarter.. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such weekly or monthly input values, if desired, should be calculated prior to calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P11_MeanTempColdestQuarter(tas='tas', *, freq='YS', ds=None)

Mean temperature of warmest/coldest quarter.

The warmest (or coldest) quarter of the year is determined, and the mean temperature of this period is calculated. If the input data frequency is daily (“D”) or weekly (“W”), quarters are defined as 13-week periods, otherwise as three (3) months.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function tg_mean_warmcold_quarter(). With injected parameters: op=coldest.

Parameters:
  • tas (str or DataArray) – Mean temperature at daily, weekly, or monthly frequency. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K] – air_temperature, Mean temperature of {op} quarter.. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such weekly or monthly input values, if desired, should be calculated prior to calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P12_AnnualPrecip(pr='pr', *, thresh='0 mm/d', freq='YS', ds=None)

Accumulated total precipitation.

The total accumulated precipitation from days where precipitation exceeds a given amount. A threshold is provided to allow the option of reducing the impact of days with trace precipitation amounts on period totals.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function prcptot().

Parameters:
  • pr (str or DataArray) – Total precipitation flux [mm d-1], [mm week-1], [mm month-1] or similar. Default: ‘pr’. [Required units : [precipitation]]

  • thresh (quantity (string or DataArray, with units)) – Threshold over which precipitation starts being cumulated. Default: ‘0 mm/d’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Annual Precipitation. With additional attributes: cell_methods: time: sum

Return type:

xarray.DataArray

References

ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P13_PrecipWettestPeriod(pr='pr', *, freq='YS', ds=None)

Precipitation of the wettest/driest day, week, or month, depending on the time step.

The wettest (or driest) period is determined, and the total precipitation of this period is calculated.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function prcptot_wetdry_period(). With injected parameters: op=wettest.

Parameters:
  • pr (str or DataArray) – Total precipitation flux [mm d-1], [mm week-1], [mm month-1] or similar. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation of {op} period.. With additional attributes: cell_methods: time: sum

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such, weekly or monthly input values, if desired, should be calculated prior to calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P14_PrecipDriestPeriod(pr='pr', *, freq='YS', ds=None)

Precipitation of the wettest/driest day, week, or month, depending on the time step.

The wettest (or driest) period is determined, and the total precipitation of this period is calculated.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function prcptot_wetdry_period(). With injected parameters: op=driest.

Parameters:
  • pr (str or DataArray) – Total precipitation flux [mm d-1], [mm week-1], [mm month-1] or similar. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation of {op} period.. With additional attributes: cell_methods: time: sum

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such, weekly or monthly input values, if desired, should be calculated prior to calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P15_PrecipSeasonality(pr='pr', *, freq='YS', ds=None)

Precipitation Seasonality (C of V).

The annual precipitation Coefficient of Variation (C of V) expressed in percent. Calculated as the standard deviation of precipitation values for a given year expressed as a percentage of the mean of those values.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function precip_seasonality().

Parameters:
  • pr (str or DataArray) – Total precipitation rate at daily, weekly, or monthly frequency. Units need to be defined as a rate (e.g. mm d-1, mm week-1). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Precipitation coefficient of variation.. With additional attributes: description: The standard deviation of the precipitation estimates expressed as a percentage of the mean of those estimates., cell_methods: time: standard_deviation

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such weekly or monthly input values, if desired, should be calculated prior to calling the function.

If input units are in mm s-1 (or equivalent), values are converted to mm/day to avoid potentially small denominator values.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P16_PrecipWettestQuarter(pr='pr', *, freq='YS', ds=None)

Total precipitation of wettest/driest quarter.

The wettest (or driest) quarter of the year is determined, and the total precipitation of this period is calculated. If the input data frequency is daily (“D”) or weekly (“W”) quarters are defined as 13-week periods, otherwise as three (3) months.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function prcptot_wetdry_quarter(). With injected parameters: op=wettest.

Parameters:
  • pr (str or DataArray) – Total precipitation rate at daily, weekly, or monthly frequency. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation of {op} quarter.. With additional attributes: cell_methods: time: sum

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such, weekly or monthly input values, if desired, should be calculated before calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P17_PrecipDriestQuarter(pr='pr', *, freq='YS', ds=None)

Total precipitation of wettest/driest quarter.

The wettest (or driest) quarter of the year is determined, and the total precipitation of this period is calculated. If the input data frequency is daily (“D”) or weekly (“W”) quarters are defined as 13-week periods, otherwise as three (3) months.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function prcptot_wetdry_quarter(). With injected parameters: op=driest.

Parameters:
  • pr (str or DataArray) – Total precipitation rate at daily, weekly, or monthly frequency. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation of {op} quarter.. With additional attributes: cell_methods: time: sum

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such, weekly or monthly input values, if desired, should be calculated before calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P18_PrecipWarmestQuarter(pr='pr', tas='tas', *, freq='YS', ds=None)

Total precipitation of warmest/coldest quarter.

The warmest (or coldest) quarter of the year is determined, and the total precipitation of this period is calculated. If the input data frequency is daily (“D”) or weekly (“W”), quarters are defined as 13-week periods, otherwise as three (3) months.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function prcptot_warmcold_quarter(). With injected parameters: op=warmest.

Parameters:
  • pr (str or DataArray) – Total precipitation rate at daily, weekly, or monthly frequency. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean temperature at daily, weekly, or monthly frequency. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation of {op} quarter.. With additional attributes: cell_methods: time: sum

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such, weekly or monthly input values, if desired, should be calculated prior to calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P19_PrecipColdestQuarter(pr='pr', tas='tas', *, freq='YS', ds=None)

Total precipitation of warmest/coldest quarter.

The warmest (or coldest) quarter of the year is determined, and the total precipitation of this period is calculated. If the input data frequency is daily (“D”) or weekly (“W”), quarters are defined as 13-week periods, otherwise as three (3) months.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function prcptot_warmcold_quarter(). With injected parameters: op=coldest.

Parameters:
  • pr (str or DataArray) – Total precipitation rate at daily, weekly, or monthly frequency. Default: ‘pr’. [Required units : [precipitation]]

  • tas (str or DataArray) – Mean temperature at daily, weekly, or monthly frequency. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation of {op} quarter.. With additional attributes: cell_methods: time: sum

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such, weekly or monthly input values, if desired, should be calculated prior to calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P1_AnnMeanTemp(tas='tas', *, freq='YS', ds=None, **indexer)

Calculate a statistic over the data for each requested period.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Annual Mean Temperature. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

References

ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P2_MeanDiurnalRange(tasmin='tasmin', tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Calculate a statistic over the difference between two variables.

The difference is taken as data2 - data1.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function difference_statistics(). With injected parameters: statistic=mean, absolute=False.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – Mean Diurnal Range. With additional attributes: cell_methods: time: range

Return type:

xarray.DataArray

References

ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P3_Isothermality(tasmin='tasmin', tasmax='tasmax', *, freq='YS', ds=None)

Isothermality.

The mean diurnal temperature range divided by the annual temperature range.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function isothermality().

Parameters:
  • tasmin (str or DataArray) – Average daily minimum temperature at daily, weekly, or monthly frequency. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Average daily maximum temperature at daily, weekly, or monthly frequency. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Isothermality.. With additional attributes: description: The mean diurnal range (P2) divided by the Annual Temperature Range (P7)., cell_methods: time: range

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the output with input data with daily frequency as well. As such weekly or monthly input values, if desired, should be calculated prior to calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P4_TempSeasonality(tas='tas', *, freq='YS', ds=None)

Temperature seasonality (coefficient of variation).

The annual temperature coefficient of variation expressed in percent. Calculated as the standard deviation of temperature values for a given year expressed as a percentage of the mean of those temperatures.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function temperature_seasonality().

Parameters:
  • tas (str or DataArray) – Mean temperature at daily, weekly, or monthly frequency. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Mean temperature coefficient of variation.. With additional attributes: description: The standard deviation of the mean temperatures expressed as a percentage of the mean of those temperatures. For this calculation, the mean in degrees Kelvin is used. This avoids the possibility of having to divide by zero, but it does mean that the values are usually quite small., cell_methods: time: standard_deviation

Return type:

xarray.DataArray

Notes

For this calculation, the mean in degrees Kelvin is used. This avoids the possibility of having to divide by zero, but it does mean that the values are usually quite small.

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such weekly or monthly input values, if desired, should be calculated prior to calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P5_MaxTempWarmestPeriod(tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Calculate a statistic over the data for each requested period.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Max Temperature of Warmest Period. With additional attributes: description: The highest maximum temperature in all periods of the year., cell_methods: time: maximum

Return type:

xarray.DataArray

References

ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P6_MinTempColdestPeriod(tasmin='tasmin', *, freq='YS', ds=None, **indexer)

Calculate a statistic over the data for each requested period.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Min Temperature of Coldest Period. With additional attributes: description: The lowest minimum temperature in all periods of the year., cell_methods: time: minimum

Return type:

xarray.DataArray

References

ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P7_TempAnnualRange(tasmin='tasmin', tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Calculate the range between extreme values.

The maximum of data2 minus the minimum of data1, for each period.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function extreme_range().

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – Temperature Annual Range. With additional attributes: cell_methods: time: range

Return type:

xarray.DataArray

References

ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P8_MeanTempWettestQuarter(tas='tas', pr='pr', *, freq='YS', ds=None)

Mean temperature of wettest/driest quarter.

The wettest (or driest) quarter of the year is determined, and the mean temperature of this period is calculated. If the input data frequency is daily (“D”) or weekly (“W”), quarters are defined as 13-week periods, otherwise as three (3) months.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function tg_mean_wetdry_quarter(). With injected parameters: op=wettest.

Parameters:
  • tas (str or DataArray) – Mean temperature at daily, weekly, or monthly frequency. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Total precipitation rate at daily, weekly, or monthly frequency. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K] – air_temperature, Mean temperature of {op} quarter.. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such, weekly or monthly input values, if desired, should be calculated before calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

anuclim.P9_MeanTempDriestQuarter(tas='tas', pr='pr', *, freq='YS', ds=None)

Mean temperature of wettest/driest quarter.

The wettest (or driest) quarter of the year is determined, and the mean temperature of this period is calculated. If the input data frequency is daily (“D”) or weekly (“W”), quarters are defined as 13-week periods, otherwise as three (3) months.

This indicator will check for missing values according to the method “from_context”. Requested resampling periods are restricted to Y Based on function tg_mean_wetdry_quarter(). With injected parameters: op=driest.

Parameters:
  • tas (str or DataArray) – Mean temperature at daily, weekly, or monthly frequency. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Total precipitation rate at daily, weekly, or monthly frequency. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [K] – air_temperature, Mean temperature of {op} quarter.. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

Notes

According to the ANUCLIM user-guide (Xu and Hutchinson [2010], ch. 6), input values should be at a weekly (or monthly) frequency. However, the xclim.compute implementation here will calculate the result with input data with daily frequency as well. As such, weekly or monthly input values, if desired, should be calculated before calling the function.

References

Xu and Hutchinson [2010] ANUCLIM https://fennerschool.anu.edu.au/files/anuclim61.pdf (ch. 6)

xclim.indicators.cf

CF Standard indices

Indicators found here are defined by the clix-meta project. Adapted documentation from that repository follows:

This repository aims to provide a platform for thinking about, and developing, a unified view of metadata elements required to describe climate indices (aka climate indicators).

All indicators defined here use generic functions defined in xclim.compute.clix. This module tries to follow the clix-meta definitions as closely, which meansit can have meaningful differences with the rest of xclim.

For example, indicators where a number of occurrences (usually days) is counted will use units “1”, instead of having temporal dimensions (i.e. “days”) like xclim does elsewhere.

However, indicators calculating a date will have no units in this module. “clix-meta” suggests “day”, but that already means something else.

cf.cdd(pr='pr', *, freq='YS', ds=None)

Maximum consecutive dry days (Precip < 1mm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: threshold=1 mm day-1, condition=<, statistic=max.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_lwe_thickness_of_precipitation_amount_below_threshold, Maximum consecutive dry days (Precip < 1mm). With additional attributes: proposed_standard_name: spell_length_with_lwe_thickness_of_precipitation_amount_below_threshold

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.cddcoldTT(tas='tas', *, threshold, freq='YS', ds=None)

Cooling Degree Days (sum of Tmean – {threshold}C, for days when Tmean > {threshold}C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, for those data values that fulfil the condition the sum is calculated after subtraction of the threshold value. If the sum is for values below the threshold the result is multiplied by -1.

This indicator will check for missing values according to the method “from_context”. Based on function temperature_sum(). With injected parameters: condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius day] – integral_wrt_time_of_air_temperature_excess, Cooling Degree Days (sum of Tmean – {threshold}C, for days when Tmean > {threshold}C). With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.cfd(tasmin='tasmin', *, freq='YS', ds=None)

Maximum number of consecutive frost days (Tmin < 0 C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: threshold=0 degree_Celsius, condition=<, statistic=max.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive frost days (Tmin < 0 C). With additional attributes: proposed_standard_name: spell_length_with_air_temperature_below_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.csu(tasmax='tasmax', *, freq='YS', ds=None)

Maximum number of consecutive summer days (Tmax >25 C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: threshold=25 degree_Celsius, condition=>, statistic=max.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive summer days (Tmax >25 C). With additional attributes: proposed_standard_name: spell_length_with_air_temperature_above_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.ctmgeTT(tas='tas', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmean >= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=>=, statistic=max.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive days with Tmean >= {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_at_or_above_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctmgtTT(tas='tas', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmean > {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=>, statistic=max.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive days with Tmean > {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_above_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctmleTT(tas='tas', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmean <= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=<=, statistic=max.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive days with Tmean <= {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_at_or_below_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctmltTT(tas='tas', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmean < {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=<, statistic=max.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive days with Tmean < {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_below_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctngeTT(tasmin='tasmin', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmin >= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=>=, statistic=max.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive days with Tmin >= {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_at_or_above_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctngtTT(tasmin='tasmin', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmin > {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=>, statistic=max.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive days with Tmin > {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_above_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctnleTT(tasmin='tasmin', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmin <= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=<=, statistic=max.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive days with Tmin <= {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_at_or_below_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctnltTT(tasmin='tasmin', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmin < {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=<, statistic=max.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive days with Tmin < {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_below_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctxgeTT(tasmax='tasmax', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmax >= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=>=, statistic=max.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive days with Tmax >= {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_at_or_above_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctxgtTT(tasmax='tasmax', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmax > {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=>, statistic=max.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive days with Tmax > {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_above_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctxleTT(tasmax='tasmax', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmax <= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=<=, statistic=max.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive days with Tmax <= {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_at_or_below_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ctxltTT(tasmax='tasmax', *, threshold, freq='YS', ds=None)

Maximum number of consecutive days with Tmax < {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: condition=<, statistic=max.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive days with Tmax < {threshold}C. With additional attributes: proposed_standard_name: spell_length_with_air_temperature_below_threshold, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.cwd(pr='pr', *, freq='YS', ds=None)

Maximum consecutive wet days (Precip >= 1mm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the``condition`` is applied, i.e. if condition is “<””, the comparison data < threshold has to be fulfilled, and spell lengths are calculated from the resulting data. Finally the statistic over spell lengths is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length(). With injected parameters: threshold=1 mm day-1, condition=>=, statistic=max.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray – spell_length_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Maximum consecutive wet days (Precip >= 1mm). With additional attributes: proposed_standard_name: spell_length_with_lwe_thickness_of_precipitation_amount_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.ddgtTT(tas='tas', *, threshold, freq='YS', ds=None)

Degree Days above threshold {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, for those data values that fulfil the condition the sum is calculated after subtraction of the threshold value. If the sum is for values below the threshold the result is multiplied by -1.

This indicator will check for missing values according to the method “from_context”. Based on function temperature_sum(). With injected parameters: condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius day] – integral_wrt_time_of_air_temperature_excess, Degree Days above threshold {threshold}C. With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.ddltTT(tas='tas', *, threshold, freq='YS', ds=None)

Degree Days below threshold {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, for those data values that fulfil the condition the sum is calculated after subtraction of the threshold value. If the sum is for values below the threshold the result is multiplied by -1.

This indicator will check for missing values according to the method “from_context”. Based on function temperature_sum(). With injected parameters: condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius day] – integral_wrt_time_of_air_temperature_deficit, Degree Days below threshold {threshold}C. With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.dtr(tasmax='tasmax', tasmin='tasmin', *, freq='MS', ds=None)

Mean Diurnal Temperature Range

It takes two inputs, low_data and high_data, i.e. daily minimum and maximum temperature. The diurnal temperature range is first calculated, and then the statistic is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function diurnal_temperature_range(). With injected parameters: statistic=mean.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – Mean Diurnal Temperature Range. With additional attributes: proposed_standard_name: air_temperature_range, cell_methods: time: range within days time: mean over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.etr(tasmax='tasmax', tasmin='tasmin', *, freq='MS', ds=None)

Intra-period extreme temperature range

It takes two inputs, low_data and high_data, i.e. daily minimum and maximum temperature. From this it calculates the extreme temperature range as the maximum of daily maximum temperature minus the minimum of daily minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function extreme_temperature_range().

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – Intra-period extreme temperature range. With additional attributes: proposed_standard_name: air_temperature_range, cell_methods: time: range

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.faf(tasmin='tasmin', *, freq='YS', ds=None)

First Autumn Frost (day-of-year during Jul-Dec when Tmin < 0 degC)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the first occurrence when this comparison is met is located.

This indicator will check for missing values according to the method “from_context”. Based on function first_occurrence(). With injected parameters: threshold=0 degree_Celsius, condition=<, after_date=07-01.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [day of year] – First Autumn Frost (day-of-year during Jul-Dec when Tmin < 0 degC). With additional attributes: proposed_standard_name: first_occurrence_of_air_temperature_below_threshold

Return type:

xarray.DataArray

References

B4EST clix-meta https://github.com/clix-meta/clix-meta

cf.fd(tasmin='tasmin', *, freq='YS', ds=None)

Number of Frost Days (Tmin < 0C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=0 degree_Celsius, condition=<.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of Frost Days (Tmin < 0C). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.fg(sfcWind='sfcWind', *, freq='MS', ds=None)

Mean of daily mean wind strength

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • sfcWind (str or DataArray) – Surface wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [meter second-1] – wind_speed, Mean of daily mean wind strength. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.fg6bft(sfcWind='sfcWind', *, freq='MS', ds=None)

Days with daily averaged wind strength >= 6 Bft (>=10.8 m/s)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=10.8 meter second-1, condition=>=.

Parameters:
  • sfcWind (str or DataArray) – Surface wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_wind_speed_above_threshold, Days with daily averaged wind strength >= 6 Bft (>=10.8 m/s). With additional attributes: proposed_standard_name: number_of_occurrences_with_wind_speed_at_or_above_threshold, cell_methods: time: mean within days time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.fgcalm(sfcWind='sfcWind', *, freq='MS', ds=None)

Calm days (daily mean wind strength <= 2 m/s)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=2 meter second-1, condition=<=.

Parameters:
  • sfcWind (str or DataArray) – Surface wind speed. Default: ‘sfcWind’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_wind_speed_below_threshold, Calm days (daily mean wind strength <= 2 m/s). With additional attributes: proposed_standard_name: number_of_occurrences_with_wind_speed_at_or_below_threshold, cell_methods: time: mean within days time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.fxx(wsgsmax='wsgsmax', *, freq='MS', ds=None)

Maximum value of daily maximum wind gust strength

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max.

Parameters:
  • wsgsmax (str or DataArray) – Maximum surface wind speed. Default: ‘wsgsmax’. [Required units : [speed]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [meter second-1] – wind_speed_of_gust, Maximum value of daily maximum wind gust strength. With additional attributes: cell_methods: time: maximum

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.gd4(tas='tas', *, freq='YS', ds=None)

Growing degree days (sum of Tmean – 4C, for days when Tmean > 4C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, for those data values that fulfil the condition the sum is calculated after subtraction of the threshold value. If the sum is for values below the threshold the result is multiplied by -1.

This indicator will check for missing values according to the method “from_context”. Based on function temperature_sum(). With injected parameters: threshold=4 degree_Celsius, condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius day] – integral_wrt_time_of_air_temperature_excess, Growing degree days (sum of Tmean – 4C, for days when Tmean > 4C). With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.gddgrowTT(tas='tas', *, threshold, freq='YS', ds=None)

Annual Growing Degree Days (sum of Tmean – {threshold}C, for days when Tmean > {threshold}C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, for those data values that fulfil the condition the sum is calculated after subtraction of the threshold value. If the sum is for values below the threshold the result is multiplied by -1.

This indicator will check for missing values according to the method “from_context”. Based on function temperature_sum(). With injected parameters: condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius day] – integral_wrt_time_of_air_temperature_excess, Annual Growing Degree Days (sum of Tmean – {threshold}C, for days when Tmean > {threshold}C). With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.hd17(tas='tas', *, freq='YS', ds=None)

Heating degree days (sum of 17C – Tmean, for days when Tmean < 17C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, for those data values that fulfil the condition the sum is calculated after subtraction of the threshold value. If the sum is for values below the threshold the result is multiplied by -1.

This indicator will check for missing values according to the method “from_context”. Based on function temperature_sum(). With injected parameters: threshold=17 degree_Celsius, condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius day] – integral_wrt_time_of_air_temperature_deficit, Heating degree days (sum of 17C – Tmean, for days when Tmean < 17C). With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.hddheatTT(tas='tas', *, threshold, freq='YS', ds=None)

Heating Degree Days (sum of {threshold}C - Tmean, for days when Tmean < {threshold}C )

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, for those data values that fulfil the condition the sum is calculated after subtraction of the threshold value. If the sum is for values below the threshold the result is multiplied by -1.

This indicator will check for missing values according to the method “from_context”. Based on function temperature_sum(). With injected parameters: condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius day] – integral_wrt_time_of_air_temperature_deficit, Heating Degree Days (sum of {threshold}C - Tmean, for days when Tmean < {threshold}C ). With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.id(tasmax='tasmax', *, freq='YS', ds=None)

Number of sharp Ice Days (Tmax < 0C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=0 degree_Celsius, condition=<.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of sharp Ice Days (Tmax < 0C). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.lsf(tasmin='tasmin', *, freq='YS', ds=None)

Last Spring Frost (day-of-year during Jan-Jun when Tmin < 0 degC)

First, the threshold is transformed to the same standard_name and units as the input data, then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the last occurrence when this comparison is met is located.

This indicator will check for missing values according to the method “from_context”. Based on function last_occurrence(). With injected parameters: threshold=0 degree_Celsius, condition=<, before_date=07-01.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [dimensionless] – Last Spring Frost (day-of-year during Jan-Jun when Tmin < 0 degC). With additional attributes: proposed_standard_name: last_occurrence_of_air_temperature_below_threshold

Return type:

xarray.DataArray

References

B4EST clix-meta https://github.com/clix-meta/clix-meta

cf.maxdtr(tasmax='tasmax', tasmin='tasmin', *, freq='MS', ds=None)

Maximum Diurnal Temperature Range

It takes two inputs, low_data and high_data, i.e. daily minimum and maximum temperature. The diurnal temperature range is first calculated, and then the statistic is calculated.

This indicator will check for missing values according to the method “from_context”. Based on function diurnal_temperature_range(). With injected parameters: statistic=max.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – Maximum Diurnal Temperature Range. With additional attributes: proposed_standard_name: air_temperature_range, cell_methods: time: range within days time: maximum over days

Return type:

xarray.DataArray

References

SMHI clix-meta https://github.com/clix-meta/clix-meta

cf.nzero(tasmax='tasmax', tasmin='tasmin', *, freq='YS', ds=None)

Number of zero-crossing days (days when Tmin < 0 degC < Tmax)

The number of times the maximum data is above the threshold and the minimum data is below the threshold. The function takes two inputs, low_data and high_data, together with one parameter, the threshold. First, the threshold is transformed to the same standard_name and units as the input data. Then the comparison is done as low_data < threshold < high_data, and finally the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_level_crossings(). With injected parameters: threshold=0 degree_Celsius.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – Number of zero-crossing days (days when Tmin < 0 degC < Tmax). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_level_crossings, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

SMHI clix-meta https://github.com/clix-meta/clix-meta

cf.pp(psl='psl', *, freq='MS', ds=None)

Mean of daily sea level pressure

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • psl (str or DataArray) – Air pressure at sea level. Default: ‘psl’. [Required units : [pressure]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [hPa] – air_pressure_at_sea_level, Mean of daily sea level pressure. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.prcptot(pr='pr', *, freq='YS', ds=None)

Total precipitation during Wet Days

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, the statistic is calculated for those data values that fulfil the condition.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: threshold=1 mm day-1, condition=>=, statistic=sum.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Total precipitation during Wet Days. With additional attributes: cell_methods: time: mean over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.r10mm(pr='pr', *, freq='YS', ds=None)

Number of heavy precipitation days (Precip >=10mm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=10 mm day-1, condition=>=.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of heavy precipitation days (Precip >=10mm). With additional attributes: proposed_standard_name: number_of_occurrences_with_lwe_thickness_of_precipitation_amount_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.r20mm(pr='pr', *, freq='YS', ds=None)

Number of very heavy precipitation days (Precip >= 20mm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=20 mm day-1, condition=>=.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of very heavy precipitation days (Precip >= 20mm). With additional attributes: proposed_standard_name: number_of_occurrences_with_lwe_thickness_of_precipitation_amount_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.rPRCpDAYS(pr='pr', *, per, freq='YS', ds=None)

Number of days when precipitation is above the {per}th percentile

First the data_threshold is transformed to the same standard name and units as the input data. Then the given percentile value is used to calculate the climatological percentile-based threshold for the specified reference period. This constant percentile level is then used when applying the per_condition, i.e. if the percentile condition is <, the comparison is done as data < percentile_level, and finally the number of times when the percentile condition is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_thresholded_percentile_occurrences(). With injected parameters: data_threshold=1 mm day-1, data_condition=>=, per_condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of days when precipitation is above the {per}th percentile. With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

2022 Ad hoc group clix-meta https://github.com/clix-meta/clix-meta

cf.rPRCpPCT(pr='pr', *, per, freq='YS', ds=None)

Percentage of total precipitation amount from days above the {per}th percentile

First the data_threshold is transformed to the same standard name and units as the input data. Then the given percentile value is used to calculate the climatological percentile-based threshold for the specified reference period. This constant percentile level is then used when applying the per_condition, i.e. if the percentile condition is <, the comparison is done as data < percentile_level, and finally the number of times when the percentile condition is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_thresholded_percentile_occurrences(). With injected parameters: data_threshold=1 mm day-1, data_condition=>=, per_condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of total precipitation amount from days above the {per}th percentile. With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

2022 Ad hoc group clix-meta https://github.com/clix-meta/clix-meta

cf.rPRCpSUM(pr='pr', *, per, freq='YS', ds=None)

Total precipitation amount from days above the {per}th percentile

First the data_threshold is transformed to the same standard name and units as the input data. Then the given percentile value is used to calculate the climatological percentile-based threshold for the specified reference period. This constant percentile level is then used when applying the per_condition, i.e. if the percentile condition is <, the comparison is done as data < percentile_level, and finally the number of times when the percentile condition is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_thresholded_percentile_occurrences(). With injected parameters: data_threshold=1 mm day-1, data_condition=>=, per_condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Total precipitation amount from days above the {per}th percentile. With additional attributes: cell_methods: time: sum over days

Return type:

xarray.DataArray

References

2022 Ad hoc group clix-meta https://github.com/clix-meta/clix-meta

cf.rPRCpctl(pr='pr', *, per, freq='YS', ds=None)

{percentiles}th percentile of precipitation during wet days (Precip >= 1mm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, the percentile is calculated over the data that fulfil the condition.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_percentile(). With injected parameters: threshold=1 mm day-1, condition=>=.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • per (number) – A percentile (0, 100). Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, {percentiles}th percentile of precipitation during wet days (Precip >= 1mm).

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.rRTmm(pr='pr', *, threshold, freq='YS', ds=None)

Number of days with daily Precip >= {threshold}mm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>=.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([precipitation])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of days with daily Precip >= {threshold}mm). With additional attributes: proposed_standard_name: number_of_occurrences_with_lwe_thickness_of_precipitation_amount_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.rh(hurs='hurs', *, freq='MS', ds=None)

Mean of daily relative humidity

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • hurs (str or DataArray) – Relative humidity. Default: ‘hurs’. [Required units : []]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – relative_humidity, Mean of daily relative humidity. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.rr(pr='pr', *, freq='MS', ds=None)

Precipitation sum

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, the statistic is calculated for those data values that fulfil the condition.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: threshold=1 mm day-1, condition=>=, statistic=sum.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation sum. With additional attributes: cell_methods: time: mean within days time: mean over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.rr1(pr='pr', *, freq='YS', ds=None)

Number of Wet Days (precip >= 1 mm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=1 mm day-1, condition=>=.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of Wet Days (precip >= 1 mm). With additional attributes: proposed_standard_name: number_of_occurrences_with_lwe_thickness_of_precipitation_amount_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.rx1day(pr='pr', *, freq='YS', ds=None)

Maximum 1-day precipitation

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, the statistic is calculated for those data values that fulfil the condition.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: threshold=1 mm day-1, condition=>=, statistic=max.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Maximum 1-day precipitation. With additional attributes: cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.rx5day(pr='pr', *, freq='YS', ds=None)

Maximum 5-day precipitation

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Then the rolling_aggregator is calculated on the data that fulfil the condition, and finally the overall_statistic is calculated over the resulting data.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_running_statistics(). With injected parameters: threshold=1 mm day-1, condition=>=, rolling_aggregator=sum, window_size=5, overall_statistic=max.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Applied after the rolling window. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Maximum 5-day precipitation.

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.rxNDday(pr='pr', *, window_size, freq='YS', ds=None)

Maximum {window_size}-day precipitation

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Then the rolling_aggregator is calculated on the data that fulfil the condition, and finally the overall_statistic is calculated over the resulting data.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_running_statistics(). With injected parameters: threshold=1 mm day-1, condition=>=, rolling_aggregator=sum, overall_statistic=max.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • window_size (number) – Size of the rolling window (centered). Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Applied after the rolling window. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Maximum {window_size}-day precipitation.

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.sd(snd='snd', *, freq='MS', ds=None)

Mean of daily snow depth

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [cm] – surface_snow_thickness, Mean of daily snow depth. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.sd1(snd='snd', *, freq='MS', ds=None)

Snow days (SD >= 1 cm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=1 cm, condition=>=.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_surface_snow_thickness_above_threshold, Snow days (SD >= 1 cm). With additional attributes: proposed_standard_name: number_of_occurrences_with_surface_snow_thickness_at_or_above_threshold, cell_methods: time: mean within days time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.sd50cm(snd='snd', *, freq='MS', ds=None)

Number of days with snow depth >= 50 cm

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=50 cm, condition=>=.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_surface_snow_thickness_above_threshold, Number of days with snow depth >= 50 cm. With additional attributes: proposed_standard_name: number_of_occurrences_with_surface_snow_thickness_at_or_above_threshold, cell_methods: time: mean within days time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.sd5cm(snd='snd', *, freq='MS', ds=None)

Number of days with snow depth >= 5 cm

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=5 cm, condition=>=.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_surface_snow_thickness_above_threshold, Number of days with snow depth >= 5 cm. With additional attributes: proposed_standard_name: number_of_occurrences_with_surface_snow_thickness_at_or_above_threshold, cell_methods: time: mean within days time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.sdDcm(snd='snd', *, threshold, freq='MS', ds=None)

Number of days with snow depth >= {threshold} cm

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>=.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([length])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_surface_snow_thickness_above_threshold, Number of days with snow depth >= {threshold} cm. With additional attributes: proposed_standard_name: number_of_occurrences_with_surface_snow_thickness_at_or_above_threshold, cell_methods: time: mean within days time: sum over days

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.sdii(pr='pr', *, freq='YS', ds=None)

Average precipitation during Wet Days (SDII)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is “<”, the comparison data < threshold has to be fulfilled. Finally, the statistic is calculated for those data values that fulfil the condition.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: threshold=1 mm day-1, condition=>=, statistic=mean.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm day-1] – lwe_precipitation_rate, Average precipitation during Wet Days (SDII). With additional attributes: cell_methods: time: mean over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.ss(sund='sund', *, freq='MS', ds=None)

Sunshine duration, sum

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=sum.

Parameters:
  • sund (str or DataArray) – Duration of sunshine. Default: ‘sund’. [Required units : [time]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [hour] – duration_of_sunshine, Sunshine duration, sum.

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.su(tasmax='tasmax', *, freq='YS', ds=None)

Number of Summer Days (Tmax > 25C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=25 degree_Celsius, condition=>.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of Summer Days (Tmax > 25C). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.tg(tas='tas', *, freq='MS', ds=None)

Mean of daily mean temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean of daily mean temperature. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.tg10p(tas='tas', *, freq='YS', ds=None)

Percentage of days when Tmean < 10th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: per=10, condition=<, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmean < 10th percentile.

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.tg90p(tas='tas', *, freq='YS', ds=None)

Percentage of days when Tmean > 90th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: per=90, condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmean > 90th percentile.

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.tmPRCpctl(tas='tas', *, per, freq='YS', ds=None)

{percentiles}th percentile of Tmean

This indicator will check for missing values according to the method “from_context”. Based on function percentile().

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • per (number) – A percentile (0, 100). Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, {percentiles}th percentile of Tmean.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmge10(tas='tas', *, freq='YS', ds=None)

Number of days with Tmean >= 10C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=10 degree_Celsius, condition=>=.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of days with Tmean >= 10C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tmge5(tas='tas', *, freq='YS', ds=None)

Number of days with Tmean >= 5C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=5 degree_Celsius, condition=>=.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of days with Tmean >= 5C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tmgeTT(tas='tas', *, threshold, freq='YS', ds=None)

Number of days with Tmean >= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>=.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of days with Tmean >= {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmgtPRCp(tas='tas', *, per, freq='YS', ds=None)

Percentage of days when Tmean > {per}th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmean > {per}th percentile.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmgtTT(tas='tas', *, threshold, freq='YS', ds=None)

Number of days with Tmean > {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of days with Tmean > {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmleTT(tas='tas', *, threshold, freq='YS', ds=None)

Number of days with Tmean <= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<=.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of days with Tmean <= {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmlt10(tas='tas', *, freq='YS', ds=None)

Number of days with Tmean < 10C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=10 degree_Celsius, condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of days with Tmean < 10C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tmlt5(tas='tas', *, freq='YS', ds=None)

Number of days with Tmean < 5C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=5 degree_Celsius, condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of days with Tmean < 5C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tmltPRCp(tas='tas', *, per, freq='YS', ds=None)

Percentage of days when Tmean < {per}th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: condition=<, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmean < {per}th percentile.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmltTT(tas='tas', *, threshold, freq='YS', ds=None)

Number of days with Tmean < {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of days with Tmean < {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmm(tas='tas', *, freq='YS', ds=None)

Mean daily mean temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean daily mean temperature. With additional attributes: cell_methods: time: mean over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tmmax(tas='tas', *, freq='YS', ds=None)

Maximum daily mean temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Maximum daily mean temperature. With additional attributes: cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmmean(tas='tas', *, freq='YS', ds=None)

Mean daily mean temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean daily mean temperature. With additional attributes: cell_methods: time: mean over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmmin(tas='tas', *, freq='YS', ds=None)

Minimum daily mean temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Minimum daily mean temperature. With additional attributes: cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tmn(tas='tas', *, freq='YS', ds=None)

Minimum daily mean temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Minimum daily mean temperature. With additional attributes: cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tmx(tas='tas', *, freq='YS', ds=None)

Maximum daily mean temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Maximum daily mean temperature. With additional attributes: cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tn(tasmin='tasmin', *, freq='MS', ds=None)

Mean of daily minimum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean of daily minimum temperature. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.tn10p(tasmin='tasmin', *, freq='YS', ds=None)

Percentage of days when Tmin < 10th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: per=10, condition=<, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmin < 10th percentile.

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.tn90p(tasmin='tasmin', *, freq='YS', ds=None)

Percentage of days when Tmin > 90th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: per=90, condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmin > 90th percentile.

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.tnPRCpctl(tasmin='tasmin', *, per, freq='YS', ds=None)

{percentiles}th percentile of Tmin

This indicator will check for missing values according to the method “from_context”. Based on function percentile().

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • per (number) – A percentile (0, 100). Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, {percentiles}th percentile of Tmin.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tngeTT(tasmin='tasmin', *, threshold, freq='YS', ds=None)

Number of days with Tmin >= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>=.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of days with Tmin >= {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tngtPRCp(tasmin='tasmin', *, per, freq='YS', ds=None)

Percentage of days when Tmin > {per}th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmin > {per}th percentile.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tngtTT(tasmin='tasmin', *, threshold, freq='YS', ds=None)

Number of days with Tmin > {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of days with Tmin > {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tnleTT(tasmin='tasmin', *, threshold, freq='YS', ds=None)

Number of days with Tmin <= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<=.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of days with Tmin <= {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tnlt2(tasmin='tasmin', *, freq='YS', ds=None)

Number of weak Frost Days (Tmin < +2C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=2 degree_Celsius, condition=<.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of weak Frost Days (Tmin < +2C). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tnltPRCp(tasmin='tasmin', *, per, freq='YS', ds=None)

Percentage of days when Tmin < {per}th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: condition=<, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmin < {per}th percentile.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tnltTT(tasmin='tasmin', *, threshold, freq='YS', ds=None)

Number of days with Tmin < {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of days with Tmin < {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tnltm2(tasmin='tasmin', *, freq='YS', ds=None)

Number of sharp Frost Days (Tmin < -2C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=-2 degree_Celsius, condition=<.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of sharp Frost Days (Tmin < -2C). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tnltm20(tasmin='tasmin', *, freq='YS', ds=None)

Calculate the number of times the given threshold is exceeded during the specified time period.

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=-20 degree_Celsius, condition=<.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of times where data is {condition} {threshold}.. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tnm(tasmin='tasmin', *, freq='YS', ds=None)

Mean daily minimum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean daily minimum temperature. With additional attributes: cell_methods: time: mean over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.tnmax(tasmin='tasmin', *, freq='YS', ds=None)

Maximum daily minimum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Maximum daily minimum temperature. With additional attributes: cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tnmean(tasmin='tasmin', *, freq='YS', ds=None)

Mean daily minimum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean daily minimum temperature. With additional attributes: cell_methods: time: mean over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tnmin(tasmin='tasmin', *, freq='YS', ds=None)

Minimum daily minimum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Minimum daily minimum temperature. With additional attributes: cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.tnn(tasmin='tasmin', *, freq='YS', ds=None)

Minimum daily minimum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Minimum daily minimum temperature. With additional attributes: cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.tnx(tasmin='tasmin', *, freq='YS', ds=None)

Maximum daily minimum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Maximum daily minimum temperature. With additional attributes: cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.tr(tasmin='tasmin', *, freq='YS', ds=None)

Number of Tropical Nights (Tmin > 20C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=20 degree_Celsius, condition=>.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of Tropical Nights (Tmin > 20C). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.tx(tasmax='tasmax', *, freq='MS', ds=None)

Mean of daily maximum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean of daily maximum temperature. With additional attributes: cell_methods: time: mean

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.tx10p(tasmax='tasmax', *, freq='YS', ds=None)

Percentage of days when Tmax < 10th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: per=10, condition=<, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmax < 10th percentile.

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.tx90p(tasmax='tasmax', *, freq='YS', ds=None)

Percentage of days when Tmax > 90th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: per=90, condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmax > 90th percentile.

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.txPRCpctl(tasmax='tasmax', *, per, freq='YS', ds=None)

{percentiles}th percentile of Tmax

This indicator will check for missing values according to the method “from_context”. Based on function percentile().

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • per (number) – A percentile (0, 100). Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, {percentiles}th percentile of Tmax.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txge30(tasmax='tasmax', *, freq='YS', ds=None)

Number of Hot Days (Tmax >= 35C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=30 degree_Celsius, condition=>=.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of Hot Days (Tmax >= 35C). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.txge35(tasmax='tasmax', *, freq='YS', ds=None)

Number of Very Hot Days (Tmax >= 35C)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=35 degree_Celsius, condition=>=.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of Very Hot Days (Tmax >= 35C). With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.txgeTT(tasmax='tasmax', *, threshold, freq='YS', ds=None)

Number of days with Tmax >= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>=.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of days with Tmax >= {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txgt50p(tasmax='tasmax', *, freq='YS', ds=None)

Percentage of days when Tmax > 50th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: per=50, condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmax > 50th percentile.

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.txgtPRCp(tasmax='tasmax', *, per, freq='YS', ds=None)

Percentage of days when Tmax > {per}th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: condition=>, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmax > {per}th percentile.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txgtTT(tasmax='tasmax', *, threshold, freq='YS', ds=None)

Number of days with Tmax > {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=>.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_above_threshold, Number of days with Tmax > {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txleTT(tasmax='tasmax', *, threshold, freq='YS', ds=None)

Number of days with Tmax <= {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<=.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of days with Tmax <= {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_at_or_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txltPRCp(tasmax='tasmax', *, per, freq='YS', ds=None)

Percentage of days when Tmax < {per}th percentile

First, the given percentile value is used to calculate the climatology for the specified reference period of daily percentile levels over a 5-day window centred on each specific day. These seasonally varying percentile levels are used when applying the condition, i.e. if the condition is <, the comparison is done for each day (i) as data(i) < percentile_level(i). Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_percentile_occurrences(). With injected parameters: condition=<, reference_period=[‘1961’, ‘1990’].

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • per (number) – The percentile to compute on the reference period, between 0 and 100. Required.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. This function only makes sense with annual frequencies. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [%] – Percentage of days when Tmax < {per}th percentile.

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txltTT(tasmax='tasmax', *, threshold, freq='YS', ds=None)

Number of days with Tmax < {threshold}C

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: condition=<.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • threshold (quantity (string or DataArray, with units)) – Threshold. Required. [Required units : ([temperature])]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_air_temperature_below_threshold, Number of days with Tmax < {threshold}C. With additional attributes: proposed_standard_name: number_of_occurrences_with_air_temperature_below_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txm(tasmax='tasmax', *, freq='YS', ds=None)

Mean daily maximum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean daily maximum temperature. With additional attributes: cell_methods: time: mean over days

Return type:

xarray.DataArray

References

ET-SCI clix-meta https://github.com/clix-meta/clix-meta

cf.txmax(tasmax='tasmax', *, freq='YS', ds=None)

Maximum daily maximum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Maximum daily maximum temperature. With additional attributes: cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txmean(tasmax='tasmax', *, freq='YS', ds=None)

Mean daily maximum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Mean daily maximum temperature. With additional attributes: cell_methods: time: mean over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txmin(tasmax='tasmax', *, freq='YS', ds=None)

Minimum daily maximum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Minimum daily maximum temperature. With additional attributes: cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

cf.txn(tasmax='tasmax', *, freq='YS', ds=None)

Minimum daily maximum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Minimum daily maximum temperature. With additional attributes: cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.txx(tasmax='tasmax', *, freq='YS', ds=None)

Maximum daily maximum temperature

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – air_temperature, Maximum daily maximum temperature. With additional attributes: cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

ETCCDI clix-meta https://github.com/clix-meta/clix-meta

cf.vdtr(tasmax='tasmax', tasmin='tasmin', *, freq='MS', ds=None)

Mean day-to-day variation in Diurnal Temperature Range

It takes two inputs, low_data and high_data, i.e. daily minimum and maximum temperature and calculates the diurnal temperature range. Then the day-to-day absolute difference is calculated and the average is formed.

This indicator will check for missing values according to the method “from_context”. Based on function interday_diurnal_temperature_range().

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘MS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [degree_Celsius] – Mean day-to-day variation in Diurnal Temperature Range. With additional attributes: proposed_standard_name: air_temperature_difference

Return type:

xarray.DataArray

References

ECA&D clix-meta https://github.com/clix-meta/clix-meta

cf.wetdays(pr='pr', *, freq='YS', ds=None)

Number of Wet Days (precip >= 1 mm)

First, the threshold is transformed to the same standard_name and units as the input data. Then the condition is applied, i.e. if condition is <, the comparison data < threshold has to be fulfilled. Finally, the number of times when the comparison is fulfilled is counted.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: threshold=1 mm day-1, condition=>=.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [1] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of Wet Days (precip >= 1 mm). With additional attributes: proposed_standard_name: number_of_occurrences_with_lwe_thickness_of_precipitation_amount_at_or_above_threshold, cell_methods: time: sum over days

Return type:

xarray.DataArray

References

CLIPC clix-meta https://github.com/clix-meta/clix-meta

xclim.indicators.icclim

ICCLIM indices

The European Climate Assessment & Dataset project (ECAD) defines a set of 26 core climate indices. Those have been made accessible directly in xclim through their ECAD name for compatibility. However, the methods in this module are only wrappers around the corresponding methods of xclim.compute.

icclim.BEDD(tasmin='tasmin', tasmax='tasmax', *, cap_value=1.0, freq='YS', ds=None)

Biologically effective degree days

Considers daily minimum and maximum temperature with a given base threshold between 1 April and 31 October, with a maximum daily value for cumulative degree days (typically 9°C), and integrates modification coefficients for latitudes between 40°N and 50°N as well as for swings in daily temperature range. Metric originally published in Gladstones (1992).

This indicator will check for missing values according to the method “from_context”. Based on function biologically_effective_degree_days(). With injected parameters: lat=None, thresh_tasmin=10 degC, method=icclim, low_dtr=None, high_dtr=None, max_daily_degree_days=9 degC, start_date=04-01, end_date=10-01.

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • cap_value (number) – The value to use for the latitude coefficient for latitudes north of 50°N or south of 50°S. Only applicable for methods “huglin” and “interpolated”. Default: 1.0.

  • freq (offset alias (string)) – Resampling frequency (For Southern Hemisphere, should be “YS-JUL”). Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

  • xarray.DataArray, [K days] – Biologically effective growing degree days (Summation of min(max((Tmin + Tmax)/2 - 10°C, 0), 9°C), for days between 1 April and 30 September)

  • . With additional attributes (description: Heat-summation index for agroclimatic suitability estimation, developed specifically for viticulture. Computed with {method} formula (Summation of min((max((Tn + Tx)/2 - {thresh_tasmin}, 0) * k) + TR_adj, Dmax), where coefficient `k` is a latitude-based day-length for days between {start_date} and {end_date}), coefficient `TR_adj` is a modifier accounting for large temperature swings, and `Dmax` is the maximum possibleamount of degree days that can be gained within a day ({max_daily_degree_days}).)

Return type:

xarray.DataArray

Notes

Lat coordinate must be provided if method is “gladstones”, “gladstones_simple”, or “huglin”; The “icclim” method for BEDD here differs from the approach detailed in the Heliothermal Index of Huglin (HI) by not considering the latitude coefficient.

The tasmax ceiling of 19°C is assumed to be the maximum temperature beyond which no further gains from warmer daily temperatures occur. Index originally published in Gladstones [1992].

Let \(TX_{i}\) and \(TN_{i}\) be the daily maximum and minimum temperature at day \(i\), \(lat\) the latitude of the point of interest, \(degdays_{max}\) the maximum amount of degrees that can be summed per day (typically, 9). Then the sum of daily biologically effective growing degree day (BEDD) units between 1 April and 31 October is:

\[BEDD_i = \sum_{i=\text{April 1}}^{\text{October 31}} min\left( \left( max\left( \frac{TX_i + TN_i)}{2} - 10, 0 \right) * k \right) + TR_{adj}, degdays_{max} \right)\]
\[\begin{split}TR_{adj} = f(TX_{i}, TN_{i}) = \begin{cases} 0.25(TX_{i} - TN_{i} - 13), & \text{if } (TX_{i} - TN_{i}) > 13 \\ 0, & \text{if } 10 < (TX_{i} - TN_{i}) < 13\\ 0.25(TX_{i} - TN_{i} - 10), & \text{if } (TX_{i} - TN_{i}) < 10 \\ \end{cases}\end{split}\]
\[k = f(lat) = 1 + \left( \frac{\left| lat \right|}{50} * 0.06, \text{if }40 < |lat| <50, \text{else } 0\right)\]

An alternative version of the BEDD (method=”icclim”) does not consider \(TR_{adj}\) and \(k\) and employs a different end date (30 September) [Project team ECA&D and KNMI, 2013]. The simplified formula is as follows:

\[BEDD_i = \sum_{i=\text{April 1}}^{ \text{September 30} } min\left( max\left( \frac{TX_i + TN_i)}{2} - 10, 0 \right), degdays_{max} \right)\]

References

Gladstones [1992], Hall and Jones [2010], Huglin and Schneider [1998], Project team ECA&D and KNMI [2013] European Climate Assessment & Dataset https://www.ecad.eu/

icclim.CD(tas='tas', pr='pr', tas_per='tas_per', pr_per='pr_per', *, freq='YS', ds=None, **indexer)

Cold and dry days

Number of days with temperature below a given percentile and precipitation below a given percentile.

This indicator will check for missing values according to the method “from_context”. Based on function cold_and_dry_days().

Parameters:
  • tas (str or DataArray) – Mean daily temperature values. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tas_per (str or DataArray) – Daily 25th percentile of temperature. Default: ‘tas_per’. [Required units : [temperature]]

  • pr_per (str or DataArray) – Daily 25th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Cold and dry days. With additional attributes: description: {freq} number of days where temperature is below {tas_per_thresh}th percentile and precipitation is below {pr_per_thresh}th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Bootstrapping is not available for quartiles because it would make no significant difference to bootstrap percentiles so far from the extremes.

Formula to be written (Beniston [2009]).

References

Beniston [2009] European Climate Assessment & Dataset https://www.ecad.eu/

icclim.CDD(pr='pr', *, condition='<', freq='YS', min_gap=1, resample_before_rl=True, ds=None, **indexer)

Maximum consecutive dry days

The longest number of consecutive days where daily precipitation below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: thresh=1 mm/day, window=1, window_statistic=max, statistic=max, constrain=(‘<’, ‘<=’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘<’.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • min_gap (number) – The shortest possible gap between two spells. Spells closer than this are merged by assigning the gap steps to the merged spell. Default: 1.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_below_threshold, Maximum number of consecutive dry days (RR<1 mm). With additional attributes: description: {freq} maximum number of consecutive days with daily precipitation {condition} {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.CFD(tasmin='tasmin', *, condition='<', freq='YS-JUL', resample_before_rl=True, ds=None, **indexer)

Consecutive frost days

Maximum number of consecutive days where the daily minimum temperature is below a given threshold

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: thresh=0 degC, window=1, window_statistic=max, statistic=max, min_gap=1, constrain=(‘<’, ‘<=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘<’.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_below_threshold, Maximum number of consecutive frost days (TN<0°C). With additional attributes: description: {freq} maximum number of consecutive days where minimum daily temperature is {condition} {thresh}., cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.CSDI(tasmin='tasmin', tasmin_per='tasmin_per', *, freq='YS', resample_before_rl=True, bootstrap=False, condition='<', ds=None)

Cold Spell Duration Index (CSDI)

Number of days part of a percentile-defined cold spell. A cold spell occurs when the daily minimum temperature is below a given percentile for a given number of consecutive days.

This indicator will check for missing values according to the method “from_context”. Based on function cold_spell_duration_index(). With injected parameters: window=6.

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmin_per (str or DataArray) – The nth percentile of daily minimum temperature with dayofyear coordinate. Default: ‘tasmin_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • bootstrap (boolean) – 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. Keep bootstrap to False when there is no common period, as bootstrapping is computationally expensive, and it might provide the wrong results. Default: False.

  • condition ({‘le’, ‘lt’, ‘<=’, ‘<’}) – Comparison operation. Default: “<”. Default: ‘<’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – cold_spell_duration_index, Cold-spell duration index. With additional attributes: description: {freq} number of days with at least {window} consecutive days where the daily minimum temperature is below the {tasmin_per_thresh}th percentile. A {tasmin_per_window} day(s) window, centred on each calendar day in the {tasmin_per_period} period, is used to compute the {tasmin_per_thresh}th percentile(s).

Return type:

xarray.DataArray

Notes

Let \(TN_i\) be the minimum daily temperature for the day of the year \(i\) and \(TN10_i\) the 10th percentile of the minimum daily temperature over the 1961-1990 period for day of the year \(i\), the cold spell duration index over period \(\phi\) is defined as:

\[\sum_{i \in \phi} \prod_{j=i}^{i+6} \left[ TN_j < TN10_j \right]\]

where \([P]\) is 1 if \(P\) is true, and 0 if false.

References

From the Expert Team on Climate Change Detection, Monitoring and Indices (ETCCDMI; [Zhang et al., 2011]). European Climate Assessment & Dataset https://www.ecad.eu/

icclim.CSU(tasmax='tasmax', *, freq='YS', op='>', resample_before_rl=True, ds=None)

Maximum consecutive warm days

Maximum number of consecutive days where the maximum daily temperature exceeds a certain threshold.

This indicator will check for missing values according to the method “from_context”. Based on function hot_spell_max_length(). With injected parameters: thresh=25 degC, window=1.

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • op ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – spell_length_of_days_with_air_temperature_above_threshold, Maximum number of consecutive summer day. With additional attributes: description: {freq} longest spell of consecutive days with maximum daily temperature {op} {thresh}., cell_methods: time: maximum over days

Return type:

xarray.DataArray

Notes

The threshold on tasmax follows the one used in heat waves. A day temperature threshold between 30° and 35°C was selected by Health Canada professionals, following a temperature–mortality analysis. This absolute temperature threshold characterizes the occurrence of hot weather events that can result in adverse health outcomes for Canadian communities [Casati et al., 2013].

In Robinson [2001] where heat waves are also considered, the corresponding parameters would be thresh=39.44, window=2 (103F).

References

Casati, Yagouti, and Chaumont [2013], Robinson [2001] European Climate Assessment & Dataset https://www.ecad.eu/

icclim.CW(tas='tas', pr='pr', tas_per='tas_per', pr_per='pr_per', *, freq='YS', ds=None, **indexer)

Cold and wet days

Number of days with temperature below a given percentile and precipitation above a given percentile.

This indicator will check for missing values according to the method “from_context”. Based on function cold_and_wet_days().

Parameters:
  • tas (str or DataArray) – Mean daily temperature values. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tas_per (str or DataArray) – Daily 25th percentile of temperature. Default: ‘tas_per’. [Required units : [temperature]]

  • pr_per (str or DataArray) – Daily 75th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – cold and wet days. With additional attributes: description: {freq} number of days where temperature is below {tas_per_thresh}th percentile and precipitation is above {pr_per_thresh}th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Bootstrapping is not available for quartiles because it would make no significant difference to bootstrap percentiles so far from the extremes.

Formula to be written (Beniston [2009]).

References

Beniston [2009] European Climate Assessment & Dataset https://www.ecad.eu/

icclim.CWD(pr='pr', *, condition='>=', freq='YS', min_gap=1, resample_before_rl=True, ds=None, **indexer)

Maximum consecutive wet days

The longest number of consecutive days where daily precipitation is at or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function spell_length_statistics(). With injected parameters: thresh=1 mm/day, window=1, window_statistic=max, statistic=max, constrain=(‘>=’, ‘>’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Computed as rolling_stat {condition} thresh. Default: ‘>=’.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • min_gap (number) – The shortest possible gap between two spells. Spells closer than this are merged by assigning the gap steps to the merged spell. Default: 1.

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

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Indexing is done after finding the days part of a spell, but before taking the spell statistics.

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Maximum number of consecutive wet days (RR≥1 mm). With additional attributes: description: {freq} maximum number of consecutive days with daily precipitation {condition} {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.DTR(tasmin='tasmin', tasmax='tasmax', *, statistic='mean', freq='YS', ds=None, **indexer)

Mean of daily temperature range

The average difference between the daily maximum and minimum temperatures.

This indicator will check for missing values according to the method “from_context”. Based on function difference_statistics(). With injected parameters: absolute=False.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • statistic ({‘max’, ‘min’, ‘mean’, ‘sum’}) – The statistic to compute over the difference between the two variables. Default: ‘mean’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Mean of diurnal temperature range. With additional attributes: description: {freq} mean diurnal temperature range., cell_methods: time range within days time: mean over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.ETR(tasmin='tasmin', tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Extreme temperature range

The maximum of the maximum temperature minus the minimum of the minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function extreme_range().

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Intra-period extreme temperature range. With additional attributes: description: {freq} range between the maximum of daily maximum temperature and the minimum of dailyminimum temperature.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.FD(tasmin='tasmin', *, freq='YS', ds=None, **indexer)

Frost days

Number of days where the daily minimum temperature is below a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: thresh=0 degC, condition=<, constrain=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Frost days (TN<0°C). With additional attributes: description: {freq} number of days where the daily minimum temperature is below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.GD4(tas='tas', *, freq='YS', ds=None, **indexer)

Growing degree days

The cumulative degree days for days when the average temperature is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function integrated_difference(). With injected parameters: thresh=4 degC, condition=>.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_excess_wrt_time, Growing degree days (sum of TG>4°C). With additional attributes: description: {freq} growing degree days (mean temperature above {thresh})., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.GSL(tas='tas', *, condition='>=', freq='YS', mid_date='07-01', ds=None, **indexer)

Growing season length

Number of days between the first occurrence of a series of days with a daily average temperature above a threshold and the first occurrence of a series of days with a daily average temperature below that same threshold, occurring after a given calendar date.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: thresh=5 degC, window=6, aspect=length, constrain=(‘>’, ‘>=’).

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Comparison operation. Computed as data {condition} thresh. Default: ‘>=’.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS’.

  • mid_date (date (string, MM-DD)) – An optional middle date. The start must happen before and the end after for the season to be valid. Default: ‘07-01’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – growing_season_length, Growing season length. With additional attributes: description: {freq} number of days between the first occurrence of at least {window} consecutive days with mean daily temperature over {thresh} and the first occurrence of at least {window} consecutive days with mean daily temperature below {thresh}, occurring after {mid_date}.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.HD17(tas='tas', *, freq='YS', ds=None, **indexer)

Heating degree days

The cumulative degree days for days when the mean daily temperature is below a given threshold and buildings must be heated.

This indicator will check for missing values according to the method “from_context”. Based on function integrated_difference(). With injected parameters: thresh=17 degC, condition=<.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K days] – integral_of_air_temperature_deficit_wrt_time, Heating degree days (sum of17°C - TG). With additional attributes: description: {freq} cumulative heating degree days (mean temperature below {thresh})., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.HI(tas='tas', tasmax='tasmax', lat='lat', *, cap_value=1.0, freq='YS', ds=None)

Huglin heliothermal index

Heat-summation index for agroclimatic suitability estimation, developed specifically for viticulture. Considers daily minimum and maximum temperature with a given base threshold, typically between 1 April and 30September, and integrates a day-length coefficient calculation for higher latitudes. Metric originally published in Huglin (1978). Day-length coefficient based on Hall & Jones (2010).

This indicator will check for missing values according to the method “from_context”. Based on function huglin_index(). With injected parameters: thresh=10 degC, method=huglin, start_date=04-01, end_date=11-01.

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • lat (str or DataArray) – Latitude coordinate. If None, a CF-conformant “latitude” field must be available within the passed DataArray. Default: ‘lat’. [Required units : []]

  • cap_value (number) – The value to use for the latitude coefficient when latitude is above 50°N or below 50°S. Only applicable for methods “huglin” and “interpolated” (default: 1.0). Default: 1.0.

  • freq ({‘YS’, ‘YS-JAN’, ‘YS-JUL’}) – Resampling frequency (default: “YS”; For Southern Hemisphere, should be “YS-JUL”). Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

  • xarray.DataArray, [unitless] – Huglin heliothermal index (Summation of ((Tmean + Tmax)/2 - 10°C) * Latitude-based day-length coefficient (k), for days between 1 April and 31 October)

  • . With additional attributes (description: Heat-summation index for agroclimatic suitability estimation, developed specifically for viticulture, computed with {method} formula (Summation of ((Tn + Tx)/2 - {thresh}) * k), where coefficient `k` is a latitude-based day-length for days between {start_date} and {end_date}.)

Return type:

xarray.DataArray

Notes

Let \(TX_{i}\) and \(TG_{i}\) be the daily maximum and mean temperature at day \(i\) and \(T_{thresh}\) the base threshold needed for heat summation (typically, 10 degC). A day-length multiplication, \(k\), based on latitude, \(lat\), is also considered. Then the heliothermal index for dates between 1 April and 30 September is:

\[HI = \sum_{i=\text{April 1}}^{\text{September 30}} \left(\frac{TX_i + TG_i}{2} - T_{thresh} \right) * k\]

There are a few methods provided for calculating the day-length multiplication factor (\(k\)) based on latitude:

  • For the “huglin” and “interpolated” methods, values for k increase from 1.0 at 40°N or 40°S to 1.06 at 50°N or 50°S, where the interpolated method uses a smoothed curve and the huglin method uses a stepwise function. Values above 50°N or below 50°S are set via the cap_value variable, with 1.0 set as default. See: xclim.compute.helpers.huglin_day_length_latitude_coefficient() for more information.

  • For the “jones” method, A more robust day-length calculation based on latitude, calendar, day-of-year, and obliquity is used. The current implementation requires an annual frequency for consistent results. See: xclim.compute.generic.jones_day_length_coefficient() or Hall and Jones [2010] for more information.

For compatibility with the original ICCLIM implementation [Project team ECA&D and KNMI, 2013], end_date should be set to 11-01 with method=”huglin”.

References

Hall and Jones [2010], Huglin [1978] European Climate Assessment & Dataset https://www.ecad.eu/

icclim.ID(tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Ice days

Number of days where the daily maximum temperature is below 0°C

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: thresh=0 degC, condition=<, constrain=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Ice days (TX<0°C). With additional attributes: description: {freq} number of days where the maximum daily temperature is below {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.PRCPTOT(pr='pr', *, freq='YS', ds=None, **indexer)

Total accumulated precipitation (solid and liquid) during wet days

Total accumulated precipitation on days with precipitation. A day is considered to have precipitation if the precipitation is greater than or equal to a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: thresh=1 mm/day, condition=>=, statistic=integral, constrain=None, out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation sum over wet days. With additional attributes: description: {freq} total precipitation over wet days, defined as days where precipitation exceeds {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.R10mm(pr='pr', *, condition='>=', freq='YS', ds=None, **indexer)

Number of wet days

The number of days with daily precipitation at or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: thresh=10 mm/day, constrain=(‘>=’, ‘>’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>=’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Heavy precipitation days (precipitation≥10 mm). With additional attributes: description: {freq} number of days with daily precipitation at or above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.R20mm(pr='pr', *, condition='>=', freq='YS', ds=None, **indexer)

Number of wet days

The number of days with daily precipitation at or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: thresh=20 mm/day, constrain=(‘>=’, ‘>’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>=’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Very heavy precipitation days (precipitation≥20 mm). With additional attributes: description: {freq} number of days with daily precipitation at or above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.R75p(pr='pr', pr_per='pr_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Number of days with precipitation above a given percentile

Number of days in a period where precipitation is above a given percentile, calculated over a given period and a fixed threshold.

This indicator will check for missing values according to the method “from_context”. Based on function days_over_precip_thresh(). With injected parameters: thresh=1 mm/day.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – 75th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of days with precipitation flux above the {pr_per_thresh}th percentile of {pr_per_period}. With additional attributes: description: {freq} number of days with precipitation above the {pr_per_thresh}th percentile of {pr_per_period} period. Only days with at least {thresh} are counted., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.R75pTOT(pr='pr', pr_per='pr_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Fraction of precipitation due to wet days with daily precipitation over a given percentile.

The percentage of the total precipitation over a period occurring for days when the precipitation is above a threshold defining wet days and above a given percentile for that day.

This indicator will check for missing values according to the method “from_context”. Based on function fraction_over_precip_thresh(). With injected parameters: thresh=1 mm/day.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – 75th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – Precipitation fraction due to moderate wet days (>75th percentile). With additional attributes: description: {freq} fraction of total precipitation due to days with precipitation above {pr_per_thresh}th percentile of {pr_per_period} period. Only days with at least {thresh} are included in the total.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.R95p(pr='pr', pr_per='pr_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Number of days with precipitation above a given percentile

Number of days in a period where precipitation is above a given percentile, calculated over a given period and a fixed threshold.

This indicator will check for missing values according to the method “from_context”. Based on function days_over_precip_thresh(). With injected parameters: thresh=1 mm/day.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – 95th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of days with precipitation flux above the {pr_per_thresh}th percentile of {pr_per_period}. With additional attributes: description: {freq} number of days with precipitation above the {pr_per_thresh}th percentile of {pr_per_period} period. Only days with at least {thresh} are counted., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.R95pTOT(pr='pr', pr_per='pr_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Fraction of precipitation due to wet days with daily precipitation over a given percentile.

The percentage of the total precipitation over a period occurring for days when the precipitation is above a threshold defining wet days and above a given percentile for that day.

This indicator will check for missing values according to the method “from_context”. Based on function fraction_over_precip_thresh(). With injected parameters: thresh=1 mm/day.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – 95th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – Precipitation fraction due to very wet days (>95th percentile). With additional attributes: description: {freq} fraction of total precipitation due to days with precipitation above {pr_per_thresh}th percentile of {pr_per_period} period. Only days with at least {thresh} are included in the total.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.R99p(pr='pr', pr_per='pr_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Number of days with precipitation above a given percentile

Number of days in a period where precipitation is above a given percentile, calculated over a given period and a fixed threshold.

This indicator will check for missing values according to the method “from_context”. Based on function days_over_precip_thresh(). With injected parameters: thresh=1 mm/day.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – 99th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Number of days with precipitation flux above the {pr_per_thresh}th percentile of {pr_per_period}. With additional attributes: description: {freq} number of days with precipitation above the {pr_per_thresh}th percentile of {pr_per_period} period. Only days with at least {thresh} are counted., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.R99pTOT(pr='pr', pr_per='pr_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Fraction of precipitation due to wet days with daily precipitation over a given percentile.

The percentage of the total precipitation over a period occurring for days when the precipitation is above a threshold defining wet days and above a given percentile for that day.

This indicator will check for missing values according to the method “from_context”. Based on function fraction_over_precip_thresh(). With injected parameters: thresh=1 mm/day.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • pr_per (str or DataArray) – 99th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [dimensionless] – Precipitation fraction due to extremely wet days (>99th percentile). With additional attributes: description: {freq} fraction of total precipitation due to days with precipitation above {pr_per_thresh}th percentile of {pr_per_period} period. Only days with at least {thresh} are included in the total.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.RR(pr='pr', *, freq='YS', ds=None)

Total accumulated precipitation (solid and liquid)

Total accumulated precipitation.

This indicator will check for missing values according to the method “from_context”. Based on function precip_accumulation(). With injected parameters: tas=None, phase=None, thresh=None.

Parameters:
  • pr (str or DataArray) – Mean daily precipitation flux. Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Precipitation sum. With additional attributes: description: {freq} total precipitation., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Let \(PR_i\) be the mean daily precipitation of day \(i\), then for a period \(j\) starting at day \(a\) and finishing on day \(b\):

\[PR_{ij} = \sum_{i=a}^{b} PR_i\]

If tas and phase are given, the corresponding phase precipitation is estimated before computing the accumulation, using one of snowfall_approximation or rain_approximation with the binary method.

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.RR1(pr='pr', *, condition='>=', freq='YS', ds=None, **indexer)

Number of wet days

The number of days with daily precipitation at or above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: thresh=1 mm/day, constrain=(‘>=’, ‘>’).

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>=’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_lwe_thickness_of_precipitation_amount_above_threshold, Wet days (RR≥1 mm). With additional attributes: description: {freq} number of days with daily precipitation at or above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.RX1day(pr='pr', *, freq='YS', ds=None, **indexer)

Maximum 1-day total precipitation

Maximum total daily precipitation for a given period.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm/day] – lwe_thickness_of_precipitation_amount, Highest 1-day precipitation amount. With additional attributes: description: {freq} maximum 1-day total precipitation, cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.RX5day(pr='pr', *, freq='YS', ds=None, **indexer)

maximum n-day total precipitation

Maximum of the moving sum of daily precipitation for a given period.

This indicator will check for missing values according to the method “from_context”. Based on function running_statistics(). With injected parameters: window=5, window_statistic=integral, statistic=max, window_center=True, out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. Resampling is done after the running statistic. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Time selection is done after applying the running statistic.

Returns:

xarray.DataArray, [mm] – lwe_thickness_of_precipitation_amount, Highest 5-day precipitation amount. With additional attributes: description: {freq} maximum {window}-day total precipitation amount., cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.SD(snd='snd', *, freq='YS', ds=None, **indexer)

Mean snow depth

Mean of daily snow depth.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [cm] – surface_snow_thickness, Mean of daily snow depth. With additional attributes: description: The {freq} mean of daily mean snow depth., cell_methods: time: mean over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.SD1(snd='snd', *, window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover duration (depth).

The season starts when snow depth is above a threshold for at least N consecutive daysand stops when it drops below the same threshold for the same number of days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: thresh=1 cm, condition=>=, aspect=length, mid_date=None, constrain=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Snow days (SD≥1 cm). With additional attributes: description: The duration of the snow season, starting with at least {window} days with snow depth above {thresh} and ending with at least {window} days with snow depth under {thresh}.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.SD50cm(snd='snd', *, window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover duration (depth).

The season starts when snow depth is above a threshold for at least N consecutive daysand stops when it drops below the same threshold for the same number of days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: thresh=50 cm, condition=>=, aspect=length, mid_date=None, constrain=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Snow days (SD≥50 cm). With additional attributes: description: The duration of the snow season, starting with at least {window} days with snow depth above {thresh} and ending with at least {window} days with snow depth under {thresh}.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.SD5cm(snd='snd', *, window=14, freq='YS-JUL', ds=None, **indexer)

Snow cover duration (depth).

The season starts when snow depth is above a threshold for at least N consecutive daysand stops when it drops below the same threshold for the same number of days.

This indicator will check for missing values according to the method “from_context”. Based on function season(). With injected parameters: thresh=5 cm, condition=>=, aspect=length, mid_date=None, constrain=None.

Parameters:
  • snd (str or DataArray) – Surface snow thickness. Default: ‘snd’. [Required units : [length]]

  • window (number) – Minimum number of days that the condition must be met / not met for the start / end of the season. Default: 14.

  • freq (offset alias (string)) – Resampling frequency. If None, time dimension is reduced completely. Default: ‘YS-JUL’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Snow days (SD≥5 cm). With additional attributes: description: The duration of the snow season, starting with at least {window} days with snow depth above {thresh} and ending with at least {window} days with snow depth under {thresh}.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.SDII(pr='pr', *, condition='>=', freq='YS', ds=None, **indexer)

Simple Daily Intensity Index

Average precipitation for days with daily precipitation above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function thresholded_statistics(). With injected parameters: thresh=1 mm/day, statistic=mean, constrain=(‘>’, ‘>=’), out_units=None.

Parameters:
  • pr (str or DataArray) – Surface precipitation flux (all phases). Default: ‘pr’. [Required units : [precipitation]]

  • condition ({‘>=’, ‘!=’, ‘ne’, ‘eq’, ‘==’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>=’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [mm d-1] – lwe_precipitation_rate, Average precipitation during days with daily precipitation over {thresh} (Simple Daily Intensity Index: SDII). With additional attributes: description: {freq} Simple Daily Intensity Index (SDII) or {freq} average precipitation for days with daily precipitation over {thresh}.

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.SU(tasmax='tasmax', *, condition='>', freq='YS', ds=None, **indexer)

Number of days with maximum temperature above a given threshold

The number of days with maximum temperature above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: thresh=25 degC, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, Summer days (TX>25°C). With additional attributes: description: {freq} number of days where daily maximum temperature exceeds {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TG(tas='tas', *, freq='YS', ds=None, **indexer)

Mean temperature

Mean of daily mean temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Mean daily mean temperature. With additional attributes: description: {freq} mean of daily mean temperature., cell_methods: time: mean over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TG10p(tas='tas', tas_per='tas_per', *, freq='YS', bootstrap=False, condition='<', ds=None, **indexer)

Days with mean temperature below the 10th percentile

Number of days with mean temperature below the 10th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tg10p().

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • tas_per (str or DataArray) – 10th percentile of daily mean temperature. Default: ‘tas_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘le’, ‘lt’, ‘<=’, ‘<’}) – Comparison operation. Default: “<”. Default: ‘<’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Days with TG<10th percentile of daily mean temperature (cold days). With additional attributes: description: {freq} number of days with mean temperature below the 10th percentile. A {tas_per_window} day(s) window, centered on each calendar day in the {tas_per_period} period, is used to compute the 10th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 10th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TG90p(tas='tas', tas_per='tas_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Days with mean temperature above the 90th percentile

Number of days with mean temperature above the 90th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tg90p().

Parameters:
  • tas (str or DataArray) – Mean daily temperature. Default: ‘tas’. [Required units : [temperature]]

  • tas_per (str or DataArray) – 90th percentile of daily mean temperature. Default: ‘tas_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_above_threshold, Days with TG>90th percentile of daily mean temperature (warm days). With additional attributes: description: {freq} number of days with mean temperature above the 90th percentile. A {tas_per_window} day(s) window, centered on each calendar day in the {tas_per_period} period, is used to compute the 90th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 90th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TGn(tas='tas', *, freq='YS', ds=None, **indexer)

Minimum of mean temperature

Minimum of daily mean temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Minimum daily mean temperature. With additional attributes: description: {freq} minimum of daily mean temperature., cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TGx(tas='tas', *, freq='YS', ds=None, **indexer)

Maximum of mean temperature

Maximum of daily mean temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • tas (str or DataArray) – Mean surface temperature. Default: ‘tas’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Maximum daily mean temperature. With additional attributes: description: {freq} maximum of daily mean temperature., cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TN(tasmin='tasmin', *, freq='YS', ds=None, **indexer)

Mean of minimum temperature

Mean of daily minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Mean daily minimum temperature. With additional attributes: description: {freq} mean of daily minimum temperature., cell_methods: time: mean over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TN10p(tasmin='tasmin', tasmin_per='tasmin_per', *, freq='YS', bootstrap=False, condition='<', ds=None, **indexer)

Days with minimum temperature below the 10th percentile

Number of days with minimum temperature below the 10th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tn10p().

Parameters:
  • tasmin (str or DataArray) – Mean daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmin_per (str or DataArray) – 10th percentile of daily minimum temperature. Default: ‘tasmin_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘le’, ‘lt’, ‘<=’, ‘<’}) – Comparison operation. Default: “<”. Default: ‘<’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Days with TN<10th percentile of daily minimum temperature (cold nights). With additional attributes: description: {freq} number of days with minimum temperature below the 10th percentile. A {tasmin_per_window} day(s) window, centered on each calendar day in the {tasmin_per_period} period, is used to compute the 10th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 10th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TN90p(tasmin='tasmin', tasmin_per='tasmin_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Days with minimum temperature above the 90th percentile

Number of days with minimum temperature above the 90th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tn90p().

Parameters:
  • tasmin (str or DataArray) – Minimum daily temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmin_per (str or DataArray) – 90th percentile of daily minimum temperature. Default: ‘tasmin_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_above_threshold, Days with TN>90th percentile of daily minimum temperature (warm nights). With additional attributes: description: {freq} number of days with minimum temperature above the 90th percentile. A {tasmin_per_window} day(s) window, centered on each calendar day in the {tasmin_per_period} period, is used to compute the 90th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 90th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TNn(tasmin='tasmin', *, freq='YS', ds=None, **indexer)

Minimum temperature

Minimum of daily minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Minimum daily minimum temperature. With additional attributes: description: {freq} minimum of daily minimum temperature., cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TNx(tasmin='tasmin', *, freq='YS', ds=None, **indexer)

Maximum of minimum temperature

Maximum of daily minimum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Maximum daily minimum temperature. With additional attributes: description: {freq} maximum of daily minimum temperature., cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TR(tasmin='tasmin', *, condition='>', freq='YS', ds=None, **indexer)

Tropical nights

Number of days where minimum temperature is above a given threshold.

This indicator will check for missing values according to the method “from_context”. Based on function count_occurrences(). With injected parameters: thresh=20 degC, constrain=(‘>’, ‘>=’).

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • condition ({‘>=’, ‘>’, ‘le’, ‘gt’, ‘<’, ‘ge’, ‘lt’, ‘<=’}) – Logical comparison operator. Comparison is done as data {condition} thresh. Default: ‘>’.

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, Tropical nights (TN>20°C). With additional attributes: description: {freq} number of Tropical Nights, defined as days with minimum daily temperature above {thresh}., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TX(tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Mean of maximum temperature

Mean of daily maximum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=mean, out_units=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Mean daily maximum temperature. With additional attributes: description: {freq} mean of daily maximum temperature., cell_methods: time: mean over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TX10p(tasmax='tasmax', tasmax_per='tasmax_per', *, freq='YS', bootstrap=False, condition='<', ds=None, **indexer)

Days with maximum temperature below the 10th percentile

Number of days with maximum temperature below the 10th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tx10p().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmax_per (str or DataArray) – 10th percentile of daily maximum temperature. Default: ‘tasmax_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘le’, ‘lt’, ‘<=’, ‘<’}) – Comparison operation. Default: “<”. Default: ‘<’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_below_threshold, Days with TX<10th percentile of daily maximum temperature (cold day-times). With additional attributes: description: {freq} number of days with maximum temperature below the 10th percentile. A {tasmax_per_window} day(s) window, centered on each calendar day in the {tasmax_per_period} period, is used to compute the 10th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 10th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TX90p(tasmax='tasmax', tasmax_per='tasmax_per', *, freq='YS', bootstrap=False, condition='>', ds=None, **indexer)

Days with maximum temperature above the 90th percentile

Number of days with maximum temperature above the 90th percentile.

This indicator will check for missing values according to the method “from_context”. Based on function tx90p().

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmax_per (str or DataArray) – 90th percentile of daily maximum temperature. Default: ‘tasmax_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – days_with_air_temperature_above_threshold, Days with TX>90th percentile of daily maximum temperature (warm day-times). With additional attributes: description: {freq} number of days with maximum temperature above the 90th percentile. A {tasmax_per_window} day(s) window, centered on each calendar day in the {tasmax_per_period} period, is used to compute the 90th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

The 90th percentile should be computed for a 5-day window centered on each calendar day for a reference period.

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TXn(tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Minimum of maximum temperature

Minimum of daily maximum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=min, out_units=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Minimum daily maximum temperature. With additional attributes: description: {freq} minimum of daily maximum temperature., cell_methods: time: minimum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.TXx(tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Maximum temperature

Maximum of daily maximum temperature.

This indicator will check for missing values according to the method “from_context”. Based on function statistics(). With injected parameters: statistic=max, out_units=None.

Parameters:
  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, time dimension is reduced completely. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [K] – air_temperature, Maximum daily maximum temperature. With additional attributes: description: {freq} maximum of daily maximum temperature., cell_methods: time: maximum over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/

icclim.WD(tas='tas', pr='pr', tas_per='tas_per', pr_per='pr_per', *, freq='YS', ds=None, **indexer)

Warm and dry days

Number of days with temperature above a given percentile and precipitation below a given percentile.

This indicator will check for missing values according to the method “from_context”. Based on function warm_and_dry_days().

Parameters:
  • tas (str or DataArray) – Mean daily temperature values. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tas_per (str or DataArray) – Daily 75th percentile of temperature. Default: ‘tas_per’. [Required units : [temperature]]

  • pr_per (str or DataArray) – Daily 25th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Warm and dry days. With additional attributes: description: {freq} number of days where temperature is above {tas_per_thresh}th percentile and precipitation is below {pr_per_thresh}th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Bootstrapping is not available for quartiles because it would make no significant difference to bootstrap percentiles so far from the extremes.

Formula to be written (Beniston [2009]).

References

Beniston [2009] European Climate Assessment & Dataset https://www.ecad.eu/

icclim.WSDI(tasmax='tasmax', tasmax_per='tasmax_per', *, freq='YS', resample_before_rl=True, bootstrap=False, condition='>', ds=None)

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.

This indicator will check for missing values according to the method “from_context”. Based on function warm_spell_duration_index(). With injected parameters: window=6.

Parameters:
  • tasmax (str or DataArray) – Maximum daily temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • tasmax_per (str or DataArray) – Percentile(s) of daily maximum temperature. Default: ‘tasmax_per’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

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

  • bootstrap (boolean) – 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. Default: False.

  • condition ({‘>=’, ‘ge’, ‘gt’, ‘>’}) – Comparison operation. Default: “>”. Default: ‘>’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

Returns:

xarray.DataArray, [days] – number_of_days_with_air_temperature_above_threshold, Warm-spell duration index. With additional attributes: description: {freq} number of days with at least {window} consecutive days where the maximum daily temperature is above the {tasmax_per_thresh}th percentile(s). A {tasmax_per_window} day(s) window, centred on each calendar day in the {tasmax_per_period} period, is used to compute the {tasmax_per_thresh}th percentile(s)., cell_methods: time: sum over days

Return type:

xarray.DataArray

References

From the Expert Team on Climate Change Detection, Monitoring and Indices (ETCCDMI; [Zhang et al., 2011]). Used in Alexander, Zhang, Peterson, Caesar, Gleason, Klein Tank, Haylock, Collins, Trewin, Rahimzadeh, Tagipour, Rupa Kumar, Revadekar, Griffiths, Vincent, Stephenson, Burn, Aguilar, Brunet, Taylor, New, Zhai, Rusticucci, and Vazquez-Aguirre [2006] European Climate Assessment & Dataset https://www.ecad.eu/

icclim.WW(tas='tas', pr='pr', tas_per='tas_per', pr_per='pr_per', *, freq='YS', ds=None, **indexer)

Warm and wet days

Number of days with temperature above a given percentile and precipitation above a given percentile.

This indicator will check for missing values according to the method “from_context”. Based on function warm_and_wet_days().

Parameters:
  • tas (str or DataArray) – Mean daily temperature values. Default: ‘tas’. [Required units : [temperature]]

  • pr (str or DataArray) – Daily precipitation. Default: ‘pr’. [Required units : [precipitation]]

  • tas_per (str or DataArray) – Daily 75th percentile of temperature. Default: ‘tas_per’. [Required units : [temperature]]

  • pr_per (str or DataArray) – Daily 75th percentile of wet day precipitation flux. Default: ‘pr_per’. [Required units : [precipitation]]

  • freq (offset alias (string)) – Resampling frequency. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Indexing parameters to compute the indicator on a temporal subset of the data. It accepts the same arguments as xclim.core.calendar.select_time().

Returns:

xarray.DataArray, [days] – Warm and wet days. With additional attributes: description: {freq} number of days where temperature is above {tas_per_thresh}th percentile and precipitation is above {pr_per_thresh}th percentile., cell_methods: time: sum over days

Return type:

xarray.DataArray

Notes

Bootstrapping is not available for quartiles because it would make no significant difference to bootstrap percentiles so far from the extremes.

Formula to be written (Beniston [2009]).

References

Beniston [2009] European Climate Assessment & Dataset https://www.ecad.eu/

icclim.vDTR(tasmin='tasmin', tasmax='tasmax', *, freq='YS', ds=None, **indexer)

Variability of daily temperature range

The average day-to-day variation in daily temperature range.

This indicator will check for missing values according to the method “from_context”. Based on function interday_difference_statistics(). With injected parameters: statistic=mean, absolute=False.

Parameters:
  • tasmin (str or DataArray) – Minimum surface temperature. Default: ‘tasmin’. [Required units : [temperature]]

  • tasmax (str or DataArray) – Maximum surface temperature. Default: ‘tasmax’. [Required units : [temperature]]

  • freq (offset alias (string)) – Resampling frequency defining the periods as defined in Resampling. If None, the time dimension is completely reduced. Default: ‘YS’.

  • ds (Dataset, optional) – A dataset with the variables given by name. Default: None.

  • indexer – Time attribute and values over which to subset the array. See xclim.core.calendar.select_time(). Subsetting is done after differentiating along time.

Returns:

xarray.DataArray, [K] – air_temperature, Mean absolute day-to-day difference in DTR. With additional attributes: description: {freq} mean diurnal temperature range variability, defined as the average day-to-day variation in daily temperature range for the given time period., cell_methods: time range within days time: difference over days time: mean over days

Return type:

xarray.DataArray

References

European Climate Assessment & Dataset https://www.ecad.eu/