View source: R/dm_add_climate.R
| dm_add_climate | R Documentation |
A single helper function that adds climate information to outputs from
daily.data(), phase.zg(), or phase.sc().
Depending on the class of x and the selected scale, the function:
joins daily climate to daily.data() output
joins climate summaries to phase windows in ZG_cycle or SC_cycle
joins subdaily climate features to point-level ZG_phase or SC_phase
dm_add_climate(
x,
clim,
scale = c("auto", "daily", "phase", "subdaily"),
mean_vars = NULL,
min_vars = NULL,
max_vars = NULL,
sum_vars = NULL,
median_vars = NULL,
lag_vars = NULL,
lagmean_vars = NULL,
lagsum_vars = NULL,
lag_days = c(1, 3, 7),
sub_mean_vars = NULL,
sub_sum_vars = NULL,
sub_lag_vars = NULL,
roll_hours = c(3, 6, 24),
lag_hours = c(1, 3, 6, 24),
suffix = "_phase"
)
x |
Object returned by |
clim |
Climate input. This can be:
|
scale |
Character string controlling how climate is attached.
One of
|
mean_vars, min_vars, max_vars, sum_vars, median_vars |
Climate variables to
summarize by mean, minimum, maximum, sum, or median.
These are used by |
lag_vars, lagmean_vars, lagsum_vars |
Variables used by |
lag_days |
Integer vector of lag/antecedent windows in days for
|
sub_mean_vars, sub_sum_vars, sub_lag_vars |
Variables used by
|
roll_hours, lag_hours |
Numeric vectors of rolling-window and lag sizes
in hours for |
suffix |
Suffix appended to climate summaries added by
|
The same biological object with climate information added.
data(nepa17)
data(gf_nepa17)
data(ktm_clim_hourly)
# daily.data() output + daily climate
dd <- daily.data(df = nepa17[1:1000, ], TreeNum = 1)
dd_clim <- dm_add_climate(
dd,
ktm_clim_hourly,
scale = "daily",
mean_vars = c("temp", "VPD", "RH"),
max_vars = c("temp", "VPD"),
sum_vars = c("prec")
)
head(dd_clim)
# phase.zg() output + phase-window climate
zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1)
zg_clim <- dm_add_climate(
zg,
ktm_clim_hourly,
scale = "phase",
mean_vars = c("temp", "VPD", "RH"),
max_vars = c("temp", "VPD"),
sum_vars = c("prec")
)
head(zg_clim$ZG_cycle)
# phase.sc() output + point-level subdaily climate
sc <- phase.sc(df = gf_nepa17[1:800, ], TreeNum = 1, smoothing = 12)
sc_point <- dm_add_climate(
sc,
ktm_clim_hourly,
scale = "subdaily",
sub_mean_vars = c("temp", "VPD", "RH"),
sub_sum_vars = c("prec"),
sub_lag_vars = c("temp", "VPD", "RH"),
roll_hours = c(1, 3, 6, 24),
lag_hours = c(1, 3, 6, 24)
)
head(sc_point$SC_phase)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.