Skip to contents

Find peaks with a moving window. The code is based on the IDEVENT function provided by Sebastian Solari.

Usage

Decluster_SW(Data, Window_Width)

Arguments

Data

Data frame containing two columns. In column:

  • 1 A "Date" object of equally spaced discrete time steps.

  • 2 Numeric vector containing corresponding time series values.

Window_Width

Numeric vector of length one specifying the width, in days, of the window used to ensure events are independent.

Value

List comprising vectors containing the original time series Detrended, independent (declustered) events Declustered and the elements of the original series containing the declustered events EventID.

Examples

#Declustering the O-sWL at site S22 using a 3-day window.
v<-Decluster_SW(Data=S22.Detrend.df[,c(1:2)],Window_Width=7)
#> Warning: no non-missing arguments to max; returning -Inf
#> Warning: no non-missing arguments to max; returning -Inf
#> Warning: no non-missing arguments to max; returning -Inf
#> Warning: no non-missing arguments to max; returning -Inf
#> Warning: no non-missing arguments to max; returning -Inf
plot(as.Date(S22.Detrend.df$Date),S22.Detrend.df$Rainfall,pch=16)
points(as.Date(S22.Detrend.df$Date)[v$EventID],v$Event,col=2,pch=16)