R/hyet_arrive.R
hyet_arrive.Rd
hyet_interar
uses independent rainstorms that comes
from the hyet_split
function and computes their interarrival and
dry time duration.
Returns an error if storms
is not a valid grouped hyetograph.
hyet_arrive(storms)
storms | a grouped dataframe with independent rainstorms. |
---|
a tibble with the duration, total precipitation height and interarrival and dry times in hours of the independent rainstorms.
Please note that the interarrival and dry time durations for the first rainstorms is set to zero.
# create time series with 1 hours time step time_step <- 1 ts_unit <- "hours" len <- 30 crit_dur <- rep(6, 12) hyet <- tibble::tibble( date = seq( from = as.POSIXct(0, origin = "2018-01-01"), length.out = len, by = paste(time_step, ts_unit) ), prec = runif(len, 1, 5) ) # create 2 dry durations of 6 hours hyet$prec[10:15] <- 0 hyet$prec[21:26] <- 0 # add some zeros hyet$prec[2:5] <- 0 # split hyet and compute interarrival times hyet %>% hyet_split(time_step, ts_unit, crit_dur) %>% hyet_arrive()#> # A tibble: 3 x 7 #> storm begin end duration cum_prec inter_period #> <int> <dttm> <dttm> <dbl> <dbl> <drtn> #> 1 1 2018-01-01 02:00:00 2018-01-01 10:00:00 8 13.3 0 hours #> 2 2 2018-01-01 17:00:00 2018-01-01 21:00:00 4 13.1 15 hours #> 3 3 2018-01-02 04:00:00 2018-01-02 07:00:00 3 11.9 11 hours #> # … with 1 more variable: dry_period <drtn>