The reference rainfall corresponds to the (usually) 95th or 99th percentile of rainfall within the reference period.

get_reference_precipitation(
  precipitation,
  date = NULL,
  reference_period = NULL,
  percentile = 95L,
  wet_day_threshold = 1
)

Arguments

precipitation

vector with rainfall values

date

date for each rain value. Must be the same lentgth of rainfall and must be the same type as the reference period. I.e if date is numeric (e.g. year) then the reference period must be given as numeric as well. If date is a date or a date-time ("date" or "POSIX.ct") then the reference period must be also a date or a date-time

reference_period

vector of length 2 with the beginning and end of the reference period

percentile

percentile for the reference period. Defaults to the 95th percentile

wet_day_threshold

Numeric. Amount of precipitation at which the day is considered a wet day. Defaults to 1.

Value

the 95th percentile for the reference period.

See also

Other rainfall functions: precipitation_above_reference()

Examples

library(dplyr)
#> #> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’: #> #> filter, lag
#> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union
# Simulate one measurement of rain per day for 10 years rainfall <- rlnorm(10*365) years <- rep(2001:2010, each = 365) rain_data <- tibble(rainfall = rainfall, year = years) # We chose a climate normal climate_normal <- c(2001, 2005) rain_data %>% # calculate reference rainfall mutate(ref = get_reference_precipitation(rainfall, year, climate_normal, percentile = 95L)) %>% # calculate prorportion of rainfall above reference group_by(year) %>% summarise(prop_above = precipitation_above_reference(rainfall, ref))
#> # A tibble: 10 × 2 #> year prop_above #> <int> <dbl> #> 1 2001 0.224 #> 2 2002 0.149 #> 3 2003 0.217 #> 4 2004 0.166 #> 5 2005 0.164 #> 6 2006 0.170 #> 7 2007 0.166 #> 8 2008 0.217 #> 9 2009 0.235 #> 10 2010 0.219