hyet_arrive: Compute interarrival and dry times duration from independent...

Description Usage Arguments Value Note Examples

View source: R/hyet_arrive.R

Description

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.

Usage

1
hyet_arrive(storms)

Arguments

storms

a grouped dataframe with independent rainstorms.

Value

a tibble with the duration, total precipitation height and interarrival and dry times in hours of the independent rainstorms.

Note

Please note that the interarrival and dry time durations for the first rainstorms is set to zero.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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()

kvantas/hyetor documentation built on Sept. 2, 2019, 12:57 a.m.