Skip to contents

Keep observations that occur during growing seasons

Usage

filter_in_growing_seasons(
  dat,
  full_season = TRUE,
  trend_threshold = 4,
  superchill_threshold = -0.7,
  max_season = 540
)

Arguments

dat

Data frame with at least three columns: TIMESTAMP (must be possible to convert to POSIXct), DEPTH, and VALUE. If column VARIABLE is included, it must have one unique entry. May also include columns with grouping variables passed to .... Other columns will be ignored.

full_season

Logical argument. The default, full_season = TRUE will only return data for groups with a full season of data (e.g., START_SEASON and END_SEASON as returned by identify_growing_seasons(dat, full_season = TRUE) are both NOT NA).

If full_season = FALSE, data for all groups will be returned; the START_SEASON and END_SEASON dates default to the first and last timestamp in ... and DEPTH.

trend_threshold

The threshold for "trending up". Default is trend_threshold = 4. The last observation above trend_threshold that does not return below trend_threshold triggers the beginning of the growing season for each DEPTH and group in ....

superchill_threshold

The threshold for "superchill". Default is superchill_threshold = -0.7. The first observation below superchill_threshold triggers the end of the growing season for each group in DEPTH and ....

max_season

The length of the growing season in months for groups that have no temperature observations below superchill_threshold. Default is max_season = 540 days (~18 months). Note: units are days because adding 18 months to August 30 or August 31 results in NA (because February 30 and February 31 are not real dates).

Value

Returns dat, filtered to keep observations that occur during growing seasons identified in identify_growing_seasons, with an additional column SEASON to label the seasons ("S1", "S2", ...). Observations may be duplicated in consecutive seasons.

Details

Keeps observations that occur during growing seasons as defined by identify_growing_seasons() (i.e., filters out observations that do not occur during the growing seasons).

The growing season starts when the temperature crosses trend_threshold and does not return below trend_threshold (e.g., 4-degrees trending up) and ends 1 minute before the first observation of superchill_threshold.

The function looks for START_SEASON in January to August to avoid temperature drops caused by hurricanes (typically in September and October) and Winter cooling (November, December).

The function looks for END_SEASON in January to May of the next year (spring superchill).