Skip to contents

Extracts independent peak events above threshold, following the clust method of the R POT package: the first exceedance opens a cluster, the first value back under the threshold closes it unless the minimum spacing has not yet elapsed, and the next exceedance opens the next cluster. Each cluster contributes its maximum.

Usage

ts_peaks_over_threshold(
  ts,
  threshold,
  min_steps_between_events = 1,
  smoothing = c("none", "moving_average", "moving_sum", "difference"),
  period = 1
)

Arguments

ts

a corehydro_ts.

threshold

the exceedance threshold.

min_steps_between_events

the minimum number of time steps between independent events. Default 1.

smoothing

"none" (the default), "moving_average", "moving_sum" or "difference", applied before the extraction.

period

the smoothing window. Default 1.

Value

a corehydro_ts on the "irregular" interval, one ordinate per event.

See also

ts_block_series() for the block-maxima alternative.

Examples

ts <- time_series(as.Date("2000-01-01") + 0:9, c(1, 8, 2, 1, 9, 7, 1, 2, 12, 1))
ts_peaks_over_threshold(ts, threshold = 5, min_steps_between_events = 2)
#> <corehydro_ts> 2 ordinates, interval "irregular"
#>   2000-01-05 to 2000-01-09
#>   2000-01-05  9
#>   2000-01-09  12