Skip to contents

The findPeaks function detects peaks in hydrometric time series using run length encoding against a subset of threshlds.

Usage

findPeaks(x, levels = 100, from = NULL, to = NULL, gaps = 96)

Arguments

x

R6 hydroImport object

levels

The number of thresholds to apply against the time seires. Defaults to 100

from

Set the location from where the thresholds should start. Defaults to the bottom 10% value.

to

Set the location from where the thresholds should end Defaults to the maximum observed value.

gaps

Used to pad out the run length encoding, prevents wobbly data showing multiple exceedances. Set to 96.

Value

A data.table containing dateTime and values of observed peaks

Examples

data(bewdley)
bewdley$hydroYearDay()
#>  Calculating hydrological year and day
#>  Calculating hydrological year and day [7.1s]
#> 
peaksB <- riskyData::findPeaks(bewdley)
print(peaksB)
#>                 dateTime value
#>                   <POSc> <num>
#>   1: 2008-10-02 21:00:00  75.1
#>   2: 2008-10-08 06:00:00 213.0
#>   3: 2008-10-16 23:45:00  79.5
#>   4: 2008-10-22 10:30:00  94.8
#>   5: 2008-10-25 15:15:00  91.8
#>  ---                          
#> 641: 2022-09-06 09:15:00  11.8
#> 642: 2022-09-09 14:30:00  11.6
#> 643: 2022-09-11 10:00:00  11.6
#> 644: 2022-09-26 20:30:00  12.2
#> 645: 2022-09-29 13:00:00  12.7
peaksB <- data.table::data.table(peaksB,
                                 riskyData::hydroYearDay.POSIXct(peaksB$dateTime))

plot <- bewdley$plot(wrap = FALSE)
a <- plot + geom_point(data = peaksB, inherit.aes = FALSE,
                       aes(x = dateTime, y = value), colour = 'red') +
  facet_wrap(~hydroYear, scales = 'free_x')
#> Error in geom_point(data = peaksB, inherit.aes = FALSE, aes(x = dateTime,     y = value), colour = "red"): could not find function "geom_point"