Apply filters to prepare data for degree-day calculation
apply_dd_filters.RdApply filters to prepare data for degree-day calculation
Usage
apply_dd_filters(
  dat,
  trend_threshold = 4,
  superchill_threshold = -0.7,
  max_season = 540,
  full_season = TRUE,
  heat_threshold = 18,
  n_hours = 24
)Arguments
- dat
 Data frame with at least three columns:
TIMESTAMP(must be possible to convert to POSIXct),DEPTH, andVALUE. If columnVARIABLEis included, it must have one unique entry. May also include columns with grouping variables passed to.... Other columns will be ignored.- trend_threshold
 The threshold for "trending up". Default is
trend_threshold = 4. The last observation abovetrend_thresholdthat does not return belowtrend_thresholdtriggers the beginning of the growing season for eachDEPTHand group in....- superchill_threshold
 The threshold for "superchill". Default is
superchill_threshold = -0.7. The first observation belowsuperchill_thresholdtriggers the end of the growing season for each group inDEPTHand....- max_season
 The length of the growing season in months for groups that have no temperature observations below
superchill_threshold. Default ismax_season = 540days (~18 months). Note: units are days because adding 18 months to August 30 or August 31 results inNA(because February 30 and February 31 are not real dates).- full_season
 Logical argument. The default,
full_season = TRUEwill only return data for groups with a full season of data (e.g.,START_SEASONandEND_SEASONas returned byidentify_growing_seasons(dat, full_season = TRUE)are both NOTNA).If
full_season = FALSE, data for all groups will be returned; theSTART_SEASONandEND_SEASONdates default to the first and last timestamp in...andDEPTH.- heat_threshold
 The threshold for heat stress. Default is
heat_threshold = 18). Every observation aboveheat_thresholdtriggers ann-hourheat stress interval.- n_hours
 Length of heat stress interval in hours (default is
n_hours = 24).
Value
Returns dat filtered for days that will be used to calculate
degree-days at DEPTH. Includes observations that start after the
4-degree trending up threshold and end 1 minute before the first
observation of superchill for each season; observations that occur during a
heat stress events are removed.
An additional column SEASON is included to label the growing seasons
("S1", "S2", ...). Some observations may be duplicated in consecutive
seasons.