44# ' values per site.
55# ' @param thresholds A vector of threshold values used for the assessment
66# ' @param dev_type String defining the type of deviation. "elt" for equal or
7- # ' lower than, "egt" for equal or greater than.
7+ # ' lower than. "lt" for lower than, "egt" for equal or greater than, "gt" for
8+ # ' greater than
89# ' @param relative If TRUE, a relative proportion of hours compared to the total
910# ' timeseries period in % is returned instead the sum of hours
1011# '
@@ -34,6 +35,10 @@ deviating_hours <- function(
3435 sapply(thresholds , function (threshold ) {
3536 if (dev_type == " elt" ){
3637 sum(x < = threshold , na.rm = FALSE ) * resolution
38+ } else if (dev_type == " lt" ){
39+ sum(x < threshold , na.rm = FALSE ) * resolution
40+ } else if (dev_type == " gt" ){
41+ sum(x > threshold , na.rm = FALSE ) * resolution
3742 } else if (dev_type == " egt" ){
3843 sum(x > = threshold , na.rm = FALSE ) * resolution
3944 } else {
@@ -42,9 +47,13 @@ deviating_hours <- function(
4247 })
4348 })))
4449 cn <- if (dev_type == " elt" ){
50+ " equal_below"
51+ } else if (dev_type == " lt" ){
4552 " below"
46- } else if (dev_type == " egt " ){
53+ } else if (dev_type == " gt " ){
4754 " above"
55+ } else if (dev_type == " egt" ){
56+ " equal_above"
4857 }
4958 colnames(df_out ) <- paste(cn , thresholds , sep = " _" )
5059 if (relative ){
0 commit comments