Skip to content

Exceedance

Probability that a variable exceeds (or stays below) a threshold, optionally requiring the condition to persist for a minimum duration.


exceedance

Probability that values are ≥ threshold (and ≤ maxval when set).

Parameter Type Default Description
threshold float Lower bound for exceedance.
maxval float inf Upper bound.
inclusive bool true Use >= instead of >.
duration str or list[str] "0h" Minimum continuous duration the condition must hold.
group str null Time grouping (month, season, year).

When duration is a list the output includes a duration dimension.

Output variable names are suffixed with the threshold value, e.g. hs_2 for threshold 2.

- func: exceedance
  dim: time
  data_vars: [hs]
  threshold: 2.5
  duration: 1d          # must persist ≥ 1 day

- func: exceedance
  dim: time
  data_vars: [hs]
  threshold: 4.0
  duration: [12h, 1d, 3d]   # multiple durations → 'duration' dimension
  group: year

nonexceedance

Probability that values are ≤ threshold.

Parameter Type Default Description
threshold float Upper bound.
inclusive bool true Use <= instead of <.
duration str or list[str] "0h" Minimum continuous duration.
group str null Time grouping.
- func: nonexceedance
  dim: time
  data_vars: [hs]
  threshold: 1.0
  duration: 3d

Duration format

Duration strings use pandas Timedelta notation:

String Meaning
"0h" No duration filtering (simple fraction of time steps)
"6h" 6 hours
"1d" 1 day
"7d" 1 week

API reference

gridstats.ops.exceedance.exceedance(data: xr.Dataset, *, dim: str = 'time', threshold: float, maxval: float = np.inf, inclusive: bool = True, duration: str | list[str] = '0h', group: str | None = None, **kwargs) -> xr.Dataset

Probability of exceedance above a threshold.

Parameters:

Name Type Description Default
data Dataset

Input dataset.

required
dim str

Time dimension name.

'time'
threshold float

Lower bound for exceedance.

required
maxval float

Upper bound (default: no upper bound).

inf
inclusive bool

Whether the threshold comparison is inclusive (>=).

True
duration str | list[str]

Minimum duration the condition must persist. Accepts a string like '3h' or '1d', or a list of strings for multiple durations.

'0h'
group str | None

Time component to group by (e.g. 'month', 'year').

None

Returns:

Type Description
Dataset

Dataset with exceedance probabilities. Variable names are suffixed

Dataset

with the threshold value.

gridstats.ops.exceedance.nonexceedance(data: xr.Dataset, *, dim: str = 'time', threshold: float, inclusive: bool = True, duration: str | list[str] = '0h', group: str | None = None, **kwargs) -> xr.Dataset

Probability of non-exceedance below a threshold.

Parameters:

Name Type Description Default
data Dataset

Input dataset.

required
dim str

Time dimension name.

'time'
threshold float

Upper bound for non-exceedance.

required
inclusive bool

Whether the comparison is inclusive (<=).

True
duration str | list[str]

Minimum duration the condition must persist.

'0h'
group str | None

Time component to group by (e.g. 'month', 'year').

None

Returns:

Type Description
Dataset

Dataset with non-exceedance probabilities. Variable names are suffixed

Dataset

with the threshold value.