environmentaltools.common.data_over_threshold

environmentaltools.common.data_over_threshold(data: DataFrame, variable: str, threshold: float, duration: float)[source]

Extract extreme events exceeding a threshold for minimum duration.

Identifies continuous periods where variable values exceed a threshold and persist for at least the specified duration. Counts events per year.

Parameters:
  • data (pd.DataFrame) – Time series data with datetime index.

  • variable (str) – Column name of the variable to analyze.

  • threshold (float) – Threshold value to identify extreme events.

  • duration (float) – Minimum duration (in time units matching the index) required to classify as an extreme event.

Returns:

(events, events_per_year)
  • events (pd.DataFrame): Time series of all values during threshold exceedance events.

  • events_per_year (pd.DataFrame): Count of events per year with ‘eventno’ column.

Return type:

tuple