Aggregates environmental data by temporal resolution, computing mean and standard error for visualization in time series plots. Uses dbplyr lazy evaluation for efficient database queries.
prep_ts_env(df_env, ts_res)data.frame with columns:
time - aggregated time value
avg - mean of qty
std - standard error of qty (sd/n)
upr - upper confidence bound (avg + std)
lwr - lower confidence bound (avg - std)
For seasonal plots (ts_res = "quarter"), the function adds a wrapping
row to ensure visual continuity across the year boundary. Data is collected
from database only at the end of aggregation.
expr_time_env for temporal transformation logic
plot_ts for visualization