icclim._core.model.threshold#

Threshold abstract class and ThresholdBuilderInput type.

Module Contents#

class icclim._core.model.threshold.ThresholdBuilderInput[source]#

Threshold building configuration.

Data transfert object mapping all possible configuration to build any threshold.

class icclim._core.model.threshold.Threshold[source]#

Abstract class for all thresholds.

See Generic indices recipes for how to use custom thresholds.

abstract format_metadata(*, jinja_scope: dict[str, Any], jinja_env: jinja2.Environment, **kwargs) icclim._core.generic.threshold.threshold_templates.ThresholdMetadata[source]#

Get a dictionary of standardized threshold metadata.

abstract compute(comparison_data: xarray.DataArray, override_op: Callable[[xarray.DataArray, xarray.DataArray], xarray.DataArray] | None = None, **kwargs) xarray.DataArray[source]#

Compute the exceedance of the threshold.

For example, if the threshold is 10 and the comparison_data is [5, 10, 15], with a “>” operator, the exceedance will be [False, False, True]. The operator can be overridden by override_op. This is needed when self.operator is REACH.

Parameters:
  • comparison_data (xr.DataArray) – Data that must be compared to self threshold

  • override_op (Callable[[DataArray, DataArray], DataArray] | None) – Operator to override self.operator compute function. Optional.

  • kwargs – Keyword arguments passed to the concrete compute implementations. This makes the compute interface contract unreliable. So we accept to not respected LSP here.