Specify thresholds for detecting start/end of season
Source:R/calculate_season_metrics.R
set_thresholds.RdCreates a data frame with threshold values for both increasing ("up") and decreasing ("down") trends. These values are used to detect threshold-crossing events in the time series that indicate the start/end of season.
Value
A data frame with two columns:
- direction
A character vector indicating "up" for increasing trends or "down" for decreasing trends.
- threshold
A numeric vector containing threshold values between 0 and 1.
Examples
# Get default thresholds (for increasing and decreasing trends)
default_thres <- set_thresholds()
# Get thresholds with custom rule
custom_thres <- set_thresholds(thres_up = c(0.3, 0.5), thres_down = NULL)