View source: R/eqc_Truncation.R
eqc_Truncation | R Documentation |
The function determine the level (0, 1 or 2) of the truncation test
eqc_Truncation(
xts_obj,
ths = list(lv0 = c(n_years = 2), lv1to2 = c(n_years_l = 3, n_years_h = 5))
)
xts_obj |
xts of a single time series |
ths |
list. List of parameters to define in which level would be the daily precipitation. |
Truncation is when heavy precipitation episodes are truncated or noticeably reduced in frequency above a given threshold. Because there is no preceding algorithm for truncation, it is defined here as when the maximum boundary of a time series lasts for a set length of time (years). The maximum boundary is computed as the daily precipitation's maximum moving window value. Thus, based on the length of years: Level 0: no truncation (a constant maximum boundary lasts at least 2 years). Level 1: a constant maximum boundary lasts longer equal (or above) 3 years but less than 5 years Level 2: a constant maximum boundary lasts more than 5 years. Argument ths present the above default thresholds for the levels definition.
Hunziker, S., Gubler, S., Calle, J., Moreno, I., Andrade, M., Velarde, F., ... & Brönnimann, S. (2017). Identifying, attributing, and overcoming common data quality issues of manned station observations. https://doi.org/10.1002/joc.5037
Huerta, A., Serrano-Notivoli, R., & Brönnimann, S. (2024). SC-PREC4SA: A serially complete daily precipitation dataset for South America. https://doi.org/10.31223/X57D8R
## Not run:
set.seed(123)
# creating fake daily precipitation data
dates_t <- seq(as.Date("1980-01-01"), as.Date("2015-12-31"), by = "day")
prec <- round(rnorm(length(dates_t), mean = 1.2, sd = 50), 1)
prec[prec<0] <- 0
prec[prec<3 & prec>2] <- 0
xts_obj <- xts::xts(prec, dates_t)
names(xts_obj) <- "prec"
# Comparison with visual inspection
eqc_Plot(xts_obj)
eqc_Truncation(xts_obj)
# it also work if there is some empty data (but not if all is NA)
xts_obj["1990/2010"] <- NA
eqc_Plot(xts_obj)
eqc_Truncation(xts_obj)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.