make_temperature_scenarios: Build reference temperature traces for heat-injury validation

View source: R/temperature_scenarios.R

make_temperature_scenariosR Documentation

Build reference temperature traces for heat-injury validation

Description

Returns a list of four tibbles, each with columns time and temp, representing the canonical validation scenarios:

Usage

make_temperature_scenarios(
  baseline = 20,
  spike_temp = 30,
  n_hours = 96,
  dt_hours = 1,
  spike_times_single = 24,
  spike_times_multi = c(24, 48, 72),
  diurnal_n_days = 7,
  diurnal_night_temp = baseline,
  diurnal_day_peaks = NULL,
  diurnal_peak_fwhm = 6,
  diurnal_noise_sd = 0.3,
  diurnal_seed = 1L
)

Arguments

baseline

Numeric. Constant baseline temperature (°C). Default 20.

spike_temp

Numeric. Temperature of each spike (°C); each spike is one time step (dt_hours) wide. Default 30.

n_hours

Integer. Total length of each trace, in hours. Default 96.

dt_hours

Numeric. Time step, in hours. Default 1 (hourly).

spike_times_single

Integer vector. Hours at which the single-spike trace has a spike. Default 24.

spike_times_multi

Integer vector. Hours at which the multi-spike trace has a spike. Default c(24, 48, 72).

diurnal_n_days

Integer. Number of days in the diurnal scenario. Default 7.

diurnal_night_temp

Numeric vector of length diurnal_n_days (or length 1, recycled): night-time baseline temperature (°C) each day, applied at the cool end of that day's diurnal cycle. Passing a vector lets nights on hot days be warmer than nights on cool days (a common natural pattern). Default baseline (constant across days).

diurnal_day_peaks

Numeric vector of length diurnal_n_days (or length 1, recycled): the peak temperature each day reaches near 14:00. If NULL (default) the function alternates cool (baseline + 5) and warm (baseline + 8) days so some days accrue HI and others do not.

diurnal_peak_fwhm

Numeric. Full-width-half-maximum of the daily Gaussian temperature peak, in hours. Default 6 (about 4-5 hours near the daily peak).

diurnal_noise_sd

Numeric. Standard deviation (°C) of smooth hourly fluctuations added on top of the diurnal cycle. Default 0.3.

diurnal_seed

Integer. Seed for the hourly-noise RNG so the diurnal trace is reproducible. Default 1L.

Details

  • flat — constant baseline temperature for n_hours hours.

  • single_spike — flat baseline with one time step (dt_hours wide) at spike_temp placed at each of spike_times_single (default one spike).

  • multi_spike — flat baseline with one time step (dt_hours wide) at spike_temp placed at each of spike_times_multi (default three spikes).

  • diurnal — multi-day diurnal cycle with day-to-day variation in peak temperature and small hourly fluctuations on top. Useful as a stand-in for a natural thermal regime where some days exceed T_crit and accrue injury while others stay below.

Each spike is one time step (dt_hours) wide, so the analytical dose it delivers is the instantaneous rate times the step width, 100\cdot 10^{(T_{spike}-CT_{max,1hr})/z}\cdot dt_{hours} % LT50-dose. With the default dt_hours = 1 this reduces to 100\cdot 10^{(T_{spike}-CT_{max,1hr})/z}, so setting spike_temp = CTmax_1hr delivers ~100% LT50-dose per spike — a calibration target for predict_heat_injury() validation. For dt_hours != 1 the dose scales by dt_hours.

Value

A named list of four tibbles (flat, single_spike, multi_spike, diurnal), each with columns time (numeric, hours from start) and temp (°C). Note the traces differ in length: flat, single_spike, and multi_spike span n_hours (default 96) while diurnal spans diurnal_n_days * 24 (default 168) hours.

Examples

scens <- make_temperature_scenarios()
lapply(scens, head)
# Diurnal calibrated for a shrimp-like organism (T_crit ~ 25 °C):
make_temperature_scenarios(
  baseline = 18,
  diurnal_n_days = 7,
  diurnal_night_temp = 19,
  diurnal_day_peaks  = c(24, 27, 24.5, 27.5, 23, 26.5, 25.5)
)$diurnal

bayesTLS documentation built on Nov. 29, 2026, 1:06 a.m.