View source: R/climate_functions.R
| dm_daily_clim | R Documentation |
Computes daily climate summaries from climate time series so they can be
related to daily dendrometer summaries from daily.data().
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().
In addition to same-day climate summaries, the function can also compute lagged and antecedent daily climate features from the summarized daily series:
lagged values (e.g. previous 1 or 3 days)
antecedent means over previous n days
antecedent sums over previous n days
dm_daily_clim(
clim_df,
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)
)
clim_df |
Climate input. This can be:
|
mean_vars |
Character vector of variables to summarize by mean. |
min_vars |
Character vector of variables to summarize by minimum. |
max_vars |
Character vector of variables to summarize by maximum. |
sum_vars |
Character vector of variables to summarize by sum. |
median_vars |
Character vector of variables to summarize by median. |
lag_vars |
Character vector of summarized daily climate columns for
which simple lagged values should be computed, e.g.
|
lagmean_vars |
Character vector of summarized daily climate columns for
which antecedent means should be computed, e.g.
|
lagsum_vars |
Character vector of summarized daily climate columns for
which antecedent sums should be computed, e.g.
|
lag_days |
Integer vector giving lag/antecedent window sizes in days,
e.g. |
Lagged and antecedent features are calculated from the already summarized
daily climate columns. For example, if VPD is included in
max_vars, the daily summary column will be VPD_max. If this
column is listed in lag_vars and lag_days = 1, then the
additional column VPD_max_lag_1d is created.
Antecedent means and sums exclude the current day. For example:
x\_lagmean\_3d(t) = mean(x_{t-3}, x_{t-2}, x_{t-1})
x\_lagsum\_7d(t) = sum(x_{t-7}, \ldots, x_{t-1})
A tibble of class "daily_clim" with one row per day.
data(ktm_clim_hourly)
clim_day <- dm_daily_clim(
ktm_clim_hourly,
mean_vars = c("temp", "VPD", "RH"),
max_vars = c("VPD"),
sum_vars = c("prec"),
lag_vars = c("VPD_max", "temp_mean"),
lagmean_vars = c("temp_mean", "VPD_mean", "RH_mean"),
lagsum_vars = c("prec_sum"),
lag_days = c(1, 3, 7)
)
head(clim_day, 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.