Skip to contents

Identify n-hour intervals beginning when a threshold is exceeded

Usage

identify_heat_stress_intervals(dat, ..., heat_threshold = 18, n_hours = 24)

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.

...

Additional columns in dat to use as grouping variables. Results are automatically grouped by DEPTH.

heat_threshold

The threshold for heat stress. Default is heat_threshold = 18). Every observation above heat_threshold triggers an n-hour heat stress interval.

n_hours

Length of heat stress interval in hours (default is n_hours = 24).

Value

Returns a data frame with columns: ..., DEPTH, interval_start and interval_end. interval_start

indicates the beginning of each heat stress interval, i.e, the TIMESTAMP of all observations where VALUE is greater than or equal to heat_threshold. interval_end identifies the end of the heat stress interval, i.e., interval_start + n_hours.

Note: intervals may overlap with previous interval(s).

See also

Other heat stress: filter_out_heat_stress_events()

Examples

data(string_data)

dat <- string_data[which(string_data$VARIABLE == "Temperature"), ]
stress_intervals <- identify_heat_stress_intervals(dat)