View source: R/climate_functions.R
| dm_subdaily_clim | R Documentation |
Computes rolling-window and lagged climate features at subdaily resolution
for direct linkage with point-level dendrometer outputs such as
ZG_phase and SC_phase.
The input can be a standardized climate object returned by
read.climate(), a raw data frame, or a valid file path accepted by
read.climate().
dm_subdaily_clim(
clim_df,
mean_vars = NULL,
sum_vars = NULL,
lag_vars = NULL,
roll_hours = c(3, 6, 24),
lag_hours = c(1, 3, 6, 24)
)
clim_df |
Climate input. This can be:
|
mean_vars |
Variables for rolling means. |
sum_vars |
Variables for rolling sums. |
lag_vars |
Variables for lagged features. |
roll_hours |
Numeric vector of rolling-window sizes in hours.
Fractional values are allowed, e.g. |
lag_hours |
Numeric vector of lag sizes in hours.
Fractional values are allowed, e.g. |
The function learns the temporal resolution automatically from the median
time step in the TIME column. It works with hourly as well as
minute-resolution data (for example 60-, 30-, 15-, 10-, or 5-minute data).
Rolling windows and lags are provided in hours and may be fractional:
0.25 = 15 minutes
0.5 = 30 minutes
1 = 1 hour
3 = 3 hours
If the user requests a rolling window or lag that is smaller than the inferred climate resolution, the function stops with an error.
If a requested window is not an exact multiple of the inferred resolution, it is rounded to the nearest number of time steps and a warning is issued.
A tibble of class "subdaily_clim" with timestamp-level climate
features added. The inferred temporal resolution in hours is stored in
attr(x, "resolution_hours").
data(ktm_clim_hourly)
clim_sub <- dm_subdaily_clim(
ktm_clim_hourly,
mean_vars = c("temp", "VPD", "RH"),
sum_vars = c("prec"),
lag_vars = c("temp", "VPD", "RH"),
roll_hours = c(1, 3, 6, 24),
lag_hours = c(1, 3, 6, 24)
)
head(clim_sub)
attr(clim_sub, "resolution_hours")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.