hydromt.stats.extremes.get_peaks#

hydromt.stats.extremes.get_peaks(da: DataArray, ev_type: str = 'BM', min_dist: int = 0, qthresh: float = 0.9, period: str = 'year', min_sample_size: int = 0, time_dim: str = 'time') DataArray[source]#

Return peaks from time series.

Return the timeseries with all but the peak values set to NaN.

For block maxima (BM) peaks, peaks are determined by finding the maximum within each period and then ensuring a minimum distance (min_dist) and minimum sample size (min_sample_size) per period.

For Peaks Over Threshold (POT), peaks are determined solely based on the minimum distance between peaks.

The average interarrival time (extreme_rates) is calculated by dividing the number of peaks by the total duration of the timeseries and converting it to a yearly rate.

Parameters:
  • da (xr.DataArray) – Timeseries data, must have a regular spaced ‘time’ dimension.

  • ev_type ({"POT", "BM"}) – Peaks over threshold (POT) or block maxima (BM) peaks, by default “BM”

  • min_dist (int, optional) – Minimum distance between peaks measured in time steps, by default 0

  • qthresh (float, optional) – Quantile threshold used with peaks over threshold method, by default 0.9

  • period ({'year', 'month', 'quarter', pandas.Timedelta}, optional) – Period string, by default “year”.

  • min_sample_size (int, optional) – Minimum number of finite values in a valid block, by default 0. Peaks of invalid bins are set to NaN.

Returns:

Timeseries data with only peak values, all other values are set to NaN. Average interarrival time calculated based on the average number of peaks per year and stored as “extreme_rates”

Return type:

xr.DataArray