| Title: | A Tool for Processing and Analyzing Dendrometer Data |
|---|---|
| Description: | There are various functions for managing and cleaning data before the application of different approaches. This includes identifying and erasing sudden jumps in dendrometer data not related to environmental change, identifying the time gaps of recordings, and changing the temporal resolution of data to different frequencies. Furthermore, the package calculates daily statistics of dendrometer data, including the daily amplitude of tree growth. Various approaches can be applied to separate radial growth from daily cyclic shrinkage and expansion due to uptake and loss of stem water. In addition, it identifies periods of consecutive days with user-defined climatic conditions in daily meteorological data, then check what trees are doing during that period. |
| Authors: | Sugam Aryal [aut, cre, dtc], Martin Häusser [aut], Jussi Grießinger [aut], Ze-Xin Fan [aut], Achim Bräuning [aut, dgs] |
| Maintainer: | Sugam Aryal <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.6 |
| Built: | 2026-05-20 17:01:35 UTC |
| Source: | https://github.com/cran/dendRoAnalyst |
Identifies adverse climate periods from a climate time series and calculates relative dendrometer change from the start of each adverse phase.
In addition to the adverse phase itself, the function also defines a complete period for each event ID:
the adverse climate phase, and
the following normal climate phase until the next adverse phase starts (or until the end of the common series).
Relative dendrometer change is always calculated from the first day of the adverse phase for that ID.
The function returns:
adverse_change: relative change only during adverse phases,
normal_change: relative change only during the following normal phases,
full_period_change: relative change across adverse + following normal phase,
continuous_full_period_change: same as full_period_change,
but values do not reset to 0 at the next adverse phase and instead continue
from the end of the previous full period,
period_info: per-ID and per-tree summary metrics.
clim.twd( df, Clim, dailyValue = "max", thresholdClim = "<10", thresholdDays = ">5", showPlot = TRUE )clim.twd( df, Clim, dailyValue = "max", thresholdClim = "<10", thresholdDays = ">5", showPlot = TRUE )
df |
A data frame with the first column containing date-time stamps
( |
Clim |
A data frame with the first column containing dates and the second column containing the climate variable of interest. |
dailyValue |
Character. Daily aggregation statistic used when resampling
dendrometer data. One of |
thresholdClim |
Character string defining the climate threshold. Supported forms are:
|
thresholdDays |
Character string defining the minimum duration threshold
for consecutive adverse days. Must use a single-threshold form such as
|
showPlot |
Logical. If |
The algorithm works as follows:
Climate data are thresholded to identify adverse days.
Consecutive adverse days are grouped into candidate adverse runs.
Only runs satisfying thresholdDays are retained as true adverse events.
For each retained adverse event, the following normal period is defined as all non-adverse days until the next adverse event starts (or the end of the series).
Dendrometer data are resampled to daily resolution using
dendro.resample.
Relative dendrometer change is calculated from the first day of the adverse phase for each ID.
Threshold syntax:
single-threshold forms such as "<5", "<=10",
">3", ">=0", "==0",
range forms for thresholdClim such as "between(5,10)"
or "5:10", both interpreted inclusively.
thresholdDays must use a single-threshold form such as ">5".
A list of class "clim_twd_output" containing:
A data frame of relative dendrometer change during adverse phases only.
A data frame of relative dendrometer change during the following normal phases only.
A data frame of relative dendrometer change across adverse + following normal phase, reset to 0 at each adverse start.
A data frame similar to
full_period_change, but values continue from the end of the previous
full period instead of resetting to 0.
A data frame with one row per ID and tree, containing adverse and normal phase boundaries, the date and magnitude of maximum adverse decline during the adverse phase, lags to first drop below zero, lags to maximum adverse decline, and lags to return to zero.
A data frame with adverse and normal phase boundaries for each ID.
If the dendrometer and climate datasets have different time spans, analysis is automatically restricted to their common overlap.
Raffelsbauer V, Spannl S, Peña K, Pucha-Cofrep D, Steppe K, Bräuning A (2019). Tree Circumference Changes and Species-Specific Growth Recovery After Extreme Dry Events in a Montane Rainforest in Southern Ecuador. Frontiers in Plant Science, 10, 342. doi:10.3389/fpls.2019.00342
dendro.resample,
phase.zg,
phase.sc
data(gf_nepa17) data(ktm_rain17) rel_out <- clim.twd( df = gf_nepa17, Clim = ktm_rain17, dailyValue = "max", thresholdClim = "<10", thresholdDays = ">5", showPlot = FALSE ) head(rel_out$adverse_change) head(rel_out$normal_change) head(rel_out$full_period_change) head(rel_out$continuous_full_period_change) head(rel_out$period_info) rel_out2 <- clim.twd( df = gf_nepa17, Clim = ktm_rain17, thresholdClim = "between(5,10)", thresholdDays = ">3", showPlot = FALSE )data(gf_nepa17) data(ktm_rain17) rel_out <- clim.twd( df = gf_nepa17, Clim = ktm_rain17, dailyValue = "max", thresholdClim = "<10", thresholdDays = ">5", showPlot = FALSE ) head(rel_out$adverse_change) head(rel_out$normal_change) head(rel_out$full_period_change) head(rel_out$continuous_full_period_change) head(rel_out$period_info) rel_out2 <- clim.twd( df = gf_nepa17, Clim = ktm_rain17, thresholdClim = "between(5,10)", thresholdDays = ">3", showPlot = FALSE )
Calculates grouped statistics from the output of clim.twd().
The function can summarize relative dendrometer change trajectories and event-level metrics:
by tree,
by species,
by site,
or by species within site.
It can also restrict IDs to specific months, years, or custom day-of-year windows based on the adverse-phase start date of each ID.
clim.twd.stats( x, tree_info = NULL, response = c("adverse_change", "normal_change", "full_period_change", "continuous_full_period_change"), group_by = c("tree", "species", "site", "species_site"), center = c("mean", "median"), conf_level = 0.95, months = NULL, years = NULL, doy_window = NULL, year_window = NULL, include_tree_series = TRUE )clim.twd.stats( x, tree_info = NULL, response = c("adverse_change", "normal_change", "full_period_change", "continuous_full_period_change"), group_by = c("tree", "species", "site", "species_site"), center = c("mean", "median"), conf_level = 0.95, months = NULL, years = NULL, doy_window = NULL, year_window = NULL, include_tree_series = TRUE )
x |
An object of class |
tree_info |
Optional metadata table describing trees. It must contain a
column named |
response |
Character. Which response table from
|
group_by |
Character. Grouping level for trajectory summaries. One of
|
center |
Character. Central tendency used for grouped trajectories and
grouped period metrics. One of |
conf_level |
Numeric confidence/limit level. Default is |
months |
Optional numeric vector of months (1–12). Only IDs whose adverse-phase start falls in these months are retained. |
years |
Optional numeric vector of years. Only IDs whose adverse-phase start year falls in these years are retained. |
doy_window |
Optional numeric vector of length 2 defining the allowed
day-of-year window for adverse-phase start. Wrapped windows are supported,
for example |
year_window |
Optional numeric vector of length 2 defining the allowed year range for adverse-phase start. |
include_tree_series |
Logical. If |
Temporal filtering is based on the adverse_start date in
x$phase_table. Multiple filters are combined, so for example users can
simultaneously restrict to:
specific months,
specific years,
a day-of-year window,
and a year range.
If group_by = "species", "site", or "species_site",
tree_info must provide the required columns.
A list of class "clim_twd_stats" with:
Grouped time-series summary for each ID and date, including central tendency, SD bands, and empirical 95% limits.
Grouped per-ID summary derived from
x$period_info.
IDs retained after temporal filtering.
Filtered phase table.
Metadata table used for grouping.
Filtered long-format tree-level response table, if
include_tree_series = TRUE.
List of settings used to generate the summaries.
rel_out <- clim.twd( df = gf_nepa17, Clim = ktm_rain17, thresholdClim = "<10", thresholdDays = ">5", showPlot = FALSE ) # tree-level statistics st1 <- clim.twd.stats( rel_out, response = "full_period_change", group_by = "tree" ) summary(st1) plot(st1, type = "trajectory") # species metadata tree_info <- data.frame( tree = c("T2", "T3"), species = c("Pinus", "Pinus"), site = c("Ktm", "Ktm") ) # species-level summaries restricted to IDs starting in months 6 to 8 st2 <- clim.twd.stats( rel_out, tree_info = tree_info, response = "full_period_change", group_by = "species", center = "median", months = 6:8 ) summary(st2) plot(st2, type = "trajectory", band = "limit95") # species within site st3 <- clim.twd.stats( rel_out, tree_info = tree_info, response = "continuous_full_period_change", group_by = "species_site", doy_window = c(150, 250), year_window = c(2017, 2018) )rel_out <- clim.twd( df = gf_nepa17, Clim = ktm_rain17, thresholdClim = "<10", thresholdDays = ">5", showPlot = FALSE ) # tree-level statistics st1 <- clim.twd.stats( rel_out, response = "full_period_change", group_by = "tree" ) summary(st1) plot(st1, type = "trajectory") # species metadata tree_info <- data.frame( tree = c("T2", "T3"), species = c("Pinus", "Pinus"), site = c("Ktm", "Ktm") ) # species-level summaries restricted to IDs starting in months 6 to 8 st2 <- clim.twd.stats( rel_out, tree_info = tree_info, response = "full_period_change", group_by = "species", center = "median", months = 6:8 ) summary(st2) plot(st2, type = "trajectory", band = "limit95") # species within site st3 <- clim.twd.stats( rel_out, tree_info = tree_info, response = "continuous_full_period_change", group_by = "species_site", doy_window = c(150, 250), year_window = c(2017, 2018) )
Performs hypothesis tests on parameters derived from clim.twd() output.
This function is designed for scenarios such as:
species comparison as a whole,
species comparison by year,
site comparison as a whole,
site comparison by year,
species-within-site comparison,
ID-wise comparisons.
The function uses the period_info table from clim.twd() and
tests selected parameters across groups such as trees, species, sites, or
species-site combinations.
clim.twd.test( x, tree_info = NULL, parameter = c("lag_to_below_zero", "lag_to_max_adverse_decline", "lag_to_return_zero", "max_adverse_decline_value", "change_end_adverse", "change_end_full_period", "continuous_end_full_period"), compare_by = c("tree", "species", "site", "species_site"), within = c("all", "year", "ID"), test_method = c("auto", "t_test", "welch_t", "wilcox", "anova", "kruskal"), ids = NULL, years = NULL, months = NULL, doy_window = NULL, year_window = NULL, pairwise = TRUE, p_adjust_method = "BH", min_n_per_group = 2 )clim.twd.test( x, tree_info = NULL, parameter = c("lag_to_below_zero", "lag_to_max_adverse_decline", "lag_to_return_zero", "max_adverse_decline_value", "change_end_adverse", "change_end_full_period", "continuous_end_full_period"), compare_by = c("tree", "species", "site", "species_site"), within = c("all", "year", "ID"), test_method = c("auto", "t_test", "welch_t", "wilcox", "anova", "kruskal"), ids = NULL, years = NULL, months = NULL, doy_window = NULL, year_window = NULL, pairwise = TRUE, p_adjust_method = "BH", min_n_per_group = 2 )
x |
An object of class |
tree_info |
Optional metadata table describing trees. It must contain a
column named |
parameter |
Character. Parameter from
|
compare_by |
Character. Grouping variable to compare. One of
|
within |
Character. Defines the comparison scenario:
|
test_method |
Character. One of
|
ids |
Optional numeric vector of IDs to retain before testing. |
years |
Optional numeric vector of years to retain based on
|
months |
Optional numeric vector of months (1–12) to retain based on
|
doy_window |
Optional numeric vector of length 2 defining the allowed
day-of-year window of |
year_window |
Optional numeric vector of length 2 defining the allowed
year range for |
pairwise |
Logical. If |
p_adjust_method |
Character. P-value adjustment method for pairwise tests.
Default is |
min_n_per_group |
Minimum number of non-missing observations required per
group before testing. Default is |
A list of class "clim_twd_test" containing:
Filtered test data used for the analyses.
Main test results by stratum.
Pairwise comparison table where available.
Descriptive summaries by stratum and group.
Settings used for the analysis.
rel_out <- clim.twd( df = gf_nepa17, Clim = ktm_rain17, thresholdClim = "<10", thresholdDays = ">5", showPlot = FALSE ) tree_info <- data.frame( tree = c("T2", "T3"), species = c("Pinus", "Pinus"), site = c("Ktm", "Ktm") ) # species comparison across all retained IDs tst1 <- clim.twd.test( rel_out, tree_info = tree_info, parameter = "max_adverse_decline_value", compare_by = "species", within = "all" ) summary(tst1) plot(tst1) # species comparison by year tst2 <- clim.twd.test( rel_out, tree_info = tree_info, parameter = "lag_to_return_zero", compare_by = "species", within = "year" ) # site comparison by year tst3 <- clim.twd.test( rel_out, tree_info = tree_info, parameter = "change_end_full_period", compare_by = "site", within = "year", test_method = "kruskal" )rel_out <- clim.twd( df = gf_nepa17, Clim = ktm_rain17, thresholdClim = "<10", thresholdDays = ">5", showPlot = FALSE ) tree_info <- data.frame( tree = c("T2", "T3"), species = c("Pinus", "Pinus"), site = c("Ktm", "Ktm") ) # species comparison across all retained IDs tst1 <- clim.twd.test( rel_out, tree_info = tree_info, parameter = "max_adverse_decline_value", compare_by = "species", within = "all" ) summary(tst1) plot(tst1) # species comparison by year tst2 <- clim.twd.test( rel_out, tree_info = tree_info, parameter = "lag_to_return_zero", compare_by = "species", within = "year" ) # site comparison by year tst3 <- clim.twd.test( rel_out, tree_info = tree_info, parameter = "change_end_full_period", compare_by = "site", within = "year", test_method = "kruskal" )
Computes daily statistics from high-frequency dendrometer time series. For each day, it extracts the minimum and maximum values, their times of occurrence, daily mean and median, daily amplitude, the signed lag between the time of maximum and minimum, the day-to-day change in the daily maximum, and a daily status indicating whether the day is growing, shrinking, or stable relative to the previous day.
daily.data(df, TreeNum)daily.data(df, TreeNum)
df |
A data frame with the first column containing date-time stamps
convertible to |
TreeNum |
Integer. The index of the tree (column) to analyze.
|
The function requires a data frame with a time column in the first column
and one or more dendrometer series in the following columns. The user
selects the series using TreeNum.
The returned object has class "daily_output", so it can be plotted
directly with plot().
The column Max_diff is computed as:
The column Day_status is derived from Max_diff:
"growing" if Max_diff > 0
"shrinking" if Max_diff < 0
"stable" if Max_diff = 0
The first day has NA for Max_diff and Day_status.
A tibble of class "daily_output" containing:
Calendar date.
Daily minimum value.
Time of day of minimum value.
Daily maximum value.
Time of day of maximum value.
Daily mean value.
Daily median value.
Daily amplitude = Max - Min.
Time of minimum expressed in decimal hours.
Time of maximum expressed in decimal hours.
Signed difference in hours: Time_max_h - Time_min_h.
"*" if Time_max > Time_min, otherwise "".
Difference between today's maximum and the previous day's maximum.
"growing", "shrinking", "stable", or NA.
The object returned by daily.data() can be plotted using
plot() because it is assigned class "daily_output".
King G, Fonti P, Nievergelt D, Büntgen U, Frank D (2013) Climatic drivers of hourly to yearly tree radius variations along a 6°C natural warming gradient. Agricultural and Forest Meteorology 168:36–46. doi:10.1016/j.agrformet.2012.08.002
data(nepa17) daily_stats <- daily.data(df = nepa17[1:1000, ], TreeNum = 1) head(daily_stats, 10)data(nepa17) daily_stats <- daily.data(df = nepa17[1:1000, ], TreeNum = 1) head(daily_stats, 10)
This function changes the temporal resolution of dendrometer and climate
time series. It supports both aggregation to coarser resolutions and
interpolation to finer resolutions. The target resolution can be defined in
minutes, hours, days, weeks, or month-end frequency. Aggregation can be
performed using mean, max, min, sum, or
count (number of non-missing values). When a finer temporal
resolution than the original data is requested, the function can interpolate
the series to the new time step using linear interpolation.
dendro.resample( df, by, value = "mean", method = c("auto", "aggregate", "interpolate") )dendro.resample( df, by, value = "mean", method = c("auto", "aggregate", "interpolate") )
df |
A dataframe with the first column containing date-time values in
the format |
by |
A character string defining the target temporal resolution. Supported values are:
|
value |
A character string defining the aggregation function.
Supported values are |
method |
A character string defining how resampling should be performed. Options are:
|
A dataframe with resampled data. The first column contains the new time stamps and the remaining columns contain the resampled variables.
library(dendRoAnalyst) data(nepa17) # Monthly resampling using maximum values resample_ME <- dendro.resample(df = gf_nepa17, by = "ME", value = "max") head(resample_ME, 10) # Daily resampling using mean values resample_D <- dendro.resample(df = gf_nepa17, by = "D", value = "mean") # Count non-missing values per day resample_count <- dendro.resample(df = gf_nepa17, by = "D", value = "count", method = "aggregate") # Interpolate to 30-minute resolution resample_30M <- dendro.resample(df = gf_nepa17, by = "30M", value = "mean", method = "auto")library(dendRoAnalyst) data(nepa17) # Monthly resampling using maximum values resample_ME <- dendro.resample(df = gf_nepa17, by = "ME", value = "max") head(resample_ME, 10) # Daily resampling using mean values resample_D <- dendro.resample(df = gf_nepa17, by = "D", value = "mean") # Count non-missing values per day resample_count <- dendro.resample(df = gf_nepa17, by = "D", value = "count", method = "aggregate") # Interpolate to 30-minute resolution resample_30M <- dendro.resample(df = gf_nepa17, by = "30M", value = "mean", method = "auto")
Truncates dendrometer data to a user-defined calendar-year and day-of-year window.
The first column of df is treated as the date-time column and is
renamed internally to TIME. The date-time column may be a
Date, POSIXct, or character vector in the format
"yyyy-mm-dd HH:MM:SS". Character dates in the format
"yyyy-mm-dd" are also accepted.
This version supports leap years correctly. For example, DOY = 366
is valid for leap years such as 2016, 2020, or 2024, but invalid for
non-leap years.
dendro.truncate(df, CalYear, DOY)dendro.truncate(df, CalYear, DOY)
df |
A data frame where the first column contains date or date-time
values. The first column is renamed to |
CalYear |
Numeric value or numeric vector of length two giving the calendar year or start and end calendar years. |
DOY |
Numeric value or numeric vector of length two giving the day of year or start and end day of year. |
The truncation rules are:
If CalYear has length one and DOY has length one,
data from that single day are returned.
If CalYear has length one and DOY has length two,
data from the first DOY to the second DOY within the same year are
returned.
If CalYear has length two and DOY has length one,
data from that DOY in the first year to the same DOY in the second year
are returned.
If CalYear has length two and DOY has length two,
data from the first DOY of the first year to the second DOY of the
second year are returned.
The function uses real calendar dates internally rather than row positions. Therefore, leap-year DOY 366 is handled correctly.
A tibble containing the truncated dendrometer data.
library(dendRoAnalyst) data(nepa) # Extract data from DOY 20 to 50 in 2017 trunc1 <- dendro.truncate(df = nepa, CalYear = 2017, DOY = c(20, 50)) head(trunc1, 10) # Leap-year example, if the data contain year 2020 # trunc2 <- dendro.truncate(df = df2020, CalYear = 2020, DOY = c(1, 366))library(dendRoAnalyst) data(nepa) # Extract data from DOY 20 to 50 in 2017 trunc1 <- dendro.truncate(df = nepa, CalYear = 2017, DOY = c(20, 50)) head(trunc1, 10) # Leap-year example, if the data contain year 2020 # trunc2 <- dendro.truncate(df = df2020, CalYear = 2020, DOY = c(1, 366))
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" )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)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)
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) )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:
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)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)
Builds a long-format epoch table by extracting climate values before and after event times.
The optional Year and DOY arguments allow the user to restrict
which events are included in the superposed epoch analysis. The full climate
table is retained for lag extraction so that values before and after selected
events are still available.
dm_epoch_extract( events, clim, vars = "all", lag_before = 24, lag_after = 24, step = 1, unit = c("hours", "days", "mins"), agg_fun = "mean", var_funs = NULL, Year = NULL, DOY = NULL, restrict_null_to_window = TRUE )dm_epoch_extract( events, clim, vars = "all", lag_before = 24, lag_after = 24, step = 1, unit = c("hours", "days", "mins"), agg_fun = "mean", var_funs = NULL, Year = NULL, DOY = NULL, restrict_null_to_window = TRUE )
events |
Output of [dm_event_times()] or a data frame containing an
|
clim |
Climate data frame. The first column must contain timestamps. |
vars |
Climate variables to use, or |
lag_before |
Number of lag steps before the event. |
lag_after |
Number of lag steps after the event. |
step |
Step size in units. |
unit |
One of |
agg_fun |
Aggregation function applied to all climate variables when
|
var_funs |
Optional named vector or named list of aggregation functions for each variable. |
Year |
Optional numeric vector of calendar years to include in the SEA.
Events whose |
DOY |
Optional numeric vector of length one or two giving the
day-of-year window to include in the SEA. If length one, only that DOY is
retained. If length two, the inclusive range is retained. Cross-year DOY
windows are supported, for example |
restrict_null_to_window |
Logical. If |
An object of class c("dm_epoch", "dm_epoch_extract").
# events <- dm_event_times(zg, event = "GRO_start") # ep <- dm_epoch_extract( # events = events, # clim = climate, # vars = c("Rain", "temp", "vpd"), # Year = c(2022, 2023, 2024), # DOY = c(100, 300), # lag_before = 24, # lag_after = 24, # unit = "hours" # )# events <- dm_event_times(zg, event = "GRO_start") # ep <- dm_epoch_extract( # events = events, # clim = climate, # vars = c("Rain", "temp", "vpd"), # Year = c(2022, 2023, 2024), # DOY = c(100, 300), # lag_before = 24, # lag_after = 24, # unit = "hours" # )
Tests observed superposed epoch composites against empirical null distributions generated by randomly sampled anchor times.
If the input object was created with Year and/or DOY filters
in [dm_epoch_extract()] and restrict_null_to_window = TRUE, null
anchors are sampled from the same calendar-year and day-of-year window.
dm_epoch_test( x, statistic = c("mean", "median"), null = c("same_doy_window", "same_month", "random_time"), n_iter = 1000, doy_window = 15, match_hour = TRUE, match_minute = TRUE, conf_level = 0.95, seed = NULL )dm_epoch_test( x, statistic = c("mean", "median"), null = c("same_doy_window", "same_month", "random_time"), n_iter = 1000, doy_window = 15, match_hour = TRUE, match_minute = TRUE, conf_level = 0.95, seed = NULL )
x |
Object returned by [dm_epoch_extract()]. |
statistic |
Composite statistic. One of |
null |
Null model. One of |
n_iter |
Number of null iterations. |
doy_window |
DOY window used for |
match_hour |
Logical. For hourly or minute data, keep the same hour when possible. |
match_minute |
Logical. For minute data, keep the same minute when possible. |
conf_level |
Confidence level for null envelopes. |
seed |
Optional random seed. |
An object of class c("dm_epoch", "dm_epoch_test").
Extracts climate at event times and summarizes climate in windows preceding
those events. Event times can be phase starts, phase ends, or
Max.twd.time for phase.zg() output.
dm_event_climate( x, clim_df, event = c("phase_start", "phase_end", "max_twd"), phase = "all", windows = c(0, 1, 3, 6, 12, 24, 48), mean_vars = NULL, max_vars = NULL, min_vars = NULL, sum_vars = NULL, median_vars = NULL, instant_vars = NULL, instant_match = c("nearest", "previous", "next") )dm_event_climate( x, clim_df, event = c("phase_start", "phase_end", "max_twd"), phase = "all", windows = c(0, 1, 3, 6, 12, 24, 48), mean_vars = NULL, max_vars = NULL, min_vars = NULL, sum_vars = NULL, median_vars = NULL, instant_vars = NULL, instant_match = c("nearest", "previous", "next") )
x |
Output of |
clim_df |
Subdaily climate input. This can be a standardized climate
object from |
event |
One of |
phase |
Phase selector. For |
windows |
Numeric vector of antecedent windows in hours, e.g.
|
mean_vars, max_vars, min_vars, sum_vars, median_vars
|
Climate variables to summarize in antecedent windows. |
instant_vars |
Climate variables to extract at the exact event time.
If |
instant_match |
Matching rule for event-time extraction:
|
A tibble with one row per event and climate summaries in the requested antecedent windows.
data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_zg <- dm_event_climate( zg, ktm_clim_hourly, event = "phase_start", phase = "all", windows = c(0, 1, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("temp", "VPD"), sum_vars = c("prec") ) head(evt_zg) evt_maxtwd <- dm_event_climate( zg, ktm_clim_hourly, event = "max_twd", windows = c(0, 1, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) head(evt_maxtwd)data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_zg <- dm_event_climate( zg, ktm_clim_hourly, event = "phase_start", phase = "all", windows = c(0, 1, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("temp", "VPD"), sum_vars = c("prec") ) head(evt_zg) evt_maxtwd <- dm_event_climate( zg, ktm_clim_hourly, event = "max_twd", windows = c(0, 1, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) head(evt_maxtwd)
Summarizes a climate variable extracted by dm_event_climate() by
phase, event type, month, or month-of-year.
dm_event_climate_summary( event_data, climate_var, group_var = c("Phase", "event_type"), by = c("none", "month", "month_of_year", "year"), Year = NULL, DOY = NULL )dm_event_climate_summary( event_data, climate_var, group_var = c("Phase", "event_type"), by = c("none", "month", "month_of_year", "year"), Year = NULL, DOY = NULL )
event_data |
Output of |
climate_var |
Name of the climate-derived column to summarize. |
group_var |
Grouping variable. One of |
by |
One of |
Year |
Optional numeric year or vector of years for filtering. |
DOY |
Optional numeric vector of length 2 for filtering. |
A tibble of summary statistics.
data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_zg <- dm_event_climate( zg, ktm_clim_hourly, event = "phase_start", windows = c(0, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) smry <- dm_event_climate_summary( evt_zg, climate_var = "VPD_mean_prev_6h", group_var = "Phase", by = "month_of_year" ) head(smry)data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_zg <- dm_event_climate( zg, ktm_clim_hourly, event = "phase_start", windows = c(0, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) smry <- dm_event_climate_summary( evt_zg, climate_var = "VPD_mean_prev_6h", group_var = "Phase", by = "month_of_year" ) head(smry)
Tests whether an event-based climate variable differs between groups such as phases or event types.
dm_event_climate_test( event_data, climate_var, group_var = c("Phase", "event_type"), by = c("none", "month", "month_of_year", "year"), Year = NULL, DOY = NULL, method = c("auto", "anova", "kruskal", "t.test", "wilcox") )dm_event_climate_test( event_data, climate_var, group_var = c("Phase", "event_type"), by = c("none", "month", "month_of_year", "year"), Year = NULL, DOY = NULL, method = c("auto", "anova", "kruskal", "t.test", "wilcox") )
event_data |
Output of |
climate_var |
Name of the climate-derived column to test. |
group_var |
Grouping variable. One of |
by |
One of |
Year |
Optional numeric year or vector of years for filtering. |
DOY |
Optional numeric vector of length 2 for filtering. |
method |
One of |
A list with summary statistics, overall tests, and pairwise tests.
data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_zg <- dm_event_climate( zg, ktm_clim_hourly, event = "phase_start", windows = c(0, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) tst <- dm_event_climate_test( evt_zg, climate_var = "VPD_mean_prev_6h", group_var = "Phase", by = "month_of_year", method = "auto" ) tst$summary tst$overall_tests head(tst$pairwise_tests)data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_zg <- dm_event_climate( zg, ktm_clim_hourly, event = "phase_start", windows = c(0, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) tst <- dm_event_climate_test( evt_zg, climate_var = "VPD_mean_prev_6h", group_var = "Phase", by = "month_of_year", method = "auto" ) tst$summary tst$overall_tests head(tst$pairwise_tests)
Extracts event times from objects returned by phase.zg() or
phase.sc(). The resulting table can be passed directly to
[dm_epoch_extract()] for superposed epoch analysis.
dm_event_times( x, event = "all", phase = NULL, min_duration = NULL, min_magnitude = NULL, min_max_twd = NULL, remove_na_times = TRUE )dm_event_times( x, event = "all", phase = NULL, min_duration = NULL, min_magnitude = NULL, min_max_twd = NULL, remove_na_times = TRUE )
x |
Object of class |
event |
Event type to extract. Use |
phase |
Optional phase filter for generic events |
min_duration |
Optional minimum |
min_magnitude |
Optional minimum |
min_max_twd |
Optional minimum |
remove_na_times |
Logical. If |
A tibble of events with class c("dm_events", ...).
Joins daily climate summaries to the output of daily.data() by
calendar date.
The climate input can be:
the output of dm_daily_clim()
the output of read.climate()
a raw climate data frame
a valid climate file path readable by read.climate()
If the supplied climate input is not already a daily climate table, it will
first be converted to daily summaries with dm_daily_clim() using
default daily means for numeric variables.
dm_join_daily_clim(daily_obj, clim_daily)dm_join_daily_clim(daily_obj, clim_daily)
daily_obj |
Output of |
clim_daily |
Climate input. This can be a daily climate table, a
standardized climate object returned by |
The daily.data() output with climate columns appended. The returned
object has class c("daily_output_clim", "daily_output", ...).
data(nepa17) data(ktm_clim_hourly) dd <- daily.data(df = nepa17[1:1000, ], TreeNum = 1) clim_std <- read.climate( ktm_clim_hourly, time_col = "TIME", vars = c("temp", "prec", "VPD", "RH"), verbose = FALSE ) clim_day <- dm_daily_clim( clim_std, mean_vars = c("temp", "VPD", "RH"), max_vars = c("temp", "VPD"), sum_vars = c("prec") ) dd_clim <- dm_join_daily_clim(dd, clim_day) head(dd_clim)data(nepa17) data(ktm_clim_hourly) dd <- daily.data(df = nepa17[1:1000, ], TreeNum = 1) clim_std <- read.climate( ktm_clim_hourly, time_col = "TIME", vars = c("temp", "prec", "VPD", "RH"), verbose = FALSE ) clim_day <- dm_daily_clim( clim_std, mean_vars = c("temp", "VPD", "RH"), max_vars = c("temp", "VPD"), sum_vars = c("prec") ) dd_clim <- dm_join_daily_clim(dd, clim_day) head(dd_clim)
Summarizes climate conditions within each phase window of
phase.zg() or phase.sc() output and appends those summaries to
ZG_cycle or SC_cycle.
The climate input can be:
the output of read.climate()
a raw climate data frame
a valid climate file path readable by read.climate()
Climate variables are summarized over each phase interval defined by the
Start and End columns of the phase-cycle table.
dm_join_phase_clim( x, clim_df, mean_vars = NULL, min_vars = NULL, max_vars = NULL, sum_vars = NULL, median_vars = NULL, suffix = "_phase" )dm_join_phase_clim( x, clim_df, mean_vars = NULL, min_vars = NULL, max_vars = NULL, sum_vars = NULL, median_vars = NULL, suffix = "_phase" )
x |
Object returned by |
clim_df |
Climate input. This can be a standardized climate object
returned by |
mean_vars |
Character vector of climate variables to summarize by mean within each phase window. |
min_vars |
Character vector of climate variables to summarize by minimum within each phase window. |
max_vars |
Character vector of climate variables to summarize by maximum within each phase window. |
sum_vars |
Character vector of climate variables to summarize by sum within each phase window. |
median_vars |
Character vector of climate variables to summarize by median within each phase window. |
suffix |
Character suffix appended to the generated climate summary
columns. Default is |
The same phase object with climate summaries appended to ZG_cycle or
SC_cycle. The returned object has class
c("ZG_output_clim", "ZG_output", ...) or
c("SC_output_clim", "SC_output", ...).
data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) zg_clim <- dm_join_phase_clim( zg, ktm_clim_hourly, mean_vars = c("temp", "VPD", "RH"), max_vars = c("temp", "VPD"), sum_vars = c("prec") ) head(zg_clim$ZG_cycle)data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) zg_clim <- dm_join_phase_clim( zg, ktm_clim_hourly, mean_vars = c("temp", "VPD", "RH"), max_vars = c("temp", "VPD"), sum_vars = c("prec") ) head(zg_clim$ZG_cycle)
Joins timestamp-level subdaily climate features to point-level output from
phase.zg() or phase.sc().
The climate input can be:
the output of dm_subdaily_clim()
the output of read.climate()
a raw climate data frame
a valid climate file path readable by read.climate()
If the supplied climate input is not already a subdaily climate-feature table,
the function attempts to standardize it with read.climate() and then
joins by exact timestamp using the TIME column.
dm_join_subdaily_clim(x, clim_sub)dm_join_subdaily_clim(x, clim_sub)
x |
Object returned by |
clim_sub |
Climate input. This can be a subdaily climate-feature table,
a standardized climate object returned by |
The same phase object with climate features appended to ZG_phase or
SC_phase. The returned object has class
c("ZG_output_clim", "ZG_output", ...) or
c("SC_output_clim", "SC_output", ...).
data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) 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) ) zg_point_clim <- dm_join_subdaily_clim(zg, clim_sub) head(zg_point_clim$ZG_phase)data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) 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) ) zg_point_clim <- dm_join_subdaily_clim(zg, clim_sub) head(zg_point_clim$ZG_phase)
General plotting function for dendrometer outputs with attached climate
information. It works with objects of class daily_output_clim,
ZG_output_clim, and SC_output_clim, usually produced by
dm_add_climate(), dm_join_daily_clim(),
dm_join_phase_clim(), or dm_join_subdaily_clim().
The function can display one selected climate variable through time, by phase or day status, as boxplots or violin plots, or as a climate-response relationship.
dm_plot_climate( x, climate_var, metric_var = NULL, scale = c("auto", "daily", "cycle", "point"), type = c("timeseries", "boxplot", "violin", "both", "relation"), group_var = NULL, Year = NULL, DOY = NULL, point_alpha = 0.6, add_smooth = FALSE, temporal = NULL )dm_plot_climate( x, climate_var, metric_var = NULL, scale = c("auto", "daily", "cycle", "point"), type = c("timeseries", "boxplot", "violin", "both", "relation"), group_var = NULL, Year = NULL, DOY = NULL, point_alpha = 0.6, add_smooth = FALSE, temporal = NULL )
x |
A climate-augmented dendrometer object. |
climate_var |
Character. Name of the climate variable to plot. |
metric_var |
Optional character. Biological response variable used when
|
scale |
Character. Data level to use. One of |
type |
Character. Plot type. One of |
group_var |
Optional character. Grouping variable. If |
Year |
Optional numeric year or vector of years for subsetting. |
DOY |
Optional numeric vector of length 2 giving the day-of-year range. |
point_alpha |
Numeric. Alpha value for points. |
add_smooth |
Logical. If |
temporal |
Deprecated argument kept for compatibility with older examples. It is ignored. |
A ggplot2 object, returned invisibly.
data(gf_nepa17) data(ktm_clim_hourly) 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") ) dm_plot_climate( zg_clim, climate_var = "VPD_mean_phase", scale = "cycle", type = "boxplot" ) plot( zg_clim, climate_var = "VPD_mean_phase", scale = "cycle", type = "boxplot" )data(gf_nepa17) data(ktm_clim_hourly) 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") ) dm_plot_climate( zg_clim, climate_var = "VPD_mean_phase", scale = "cycle", type = "boxplot" ) plot( zg_clim, climate_var = "VPD_mean_phase", scale = "cycle", type = "boxplot" )
Plots and compares multiple climate variables attached to climate-augmented
dendrometer outputs. It works with objects of class daily_output_clim,
ZG_output_clim, and SC_output_clim.
Supported plot types include faceted time-series, grouped boxplots, violin plots, combined violin-boxplots, correlation heatmaps, and regression heatmaps.
dm_plot_climate_compare( x, climate_vars = NULL, numeric_vars = NULL, scale = c("auto", "daily", "cycle", "point"), type = c("timeseries", "boxplot", "violin", "both", "cor_heatmap", "regression_heatmap"), group_var = NULL, Year = NULL, DOY = NULL, box_scales = c("free_y", "fixed"), cor_method = c("pearson", "spearman", "kendall"), use_pairwise = TRUE, regression_stat = c("r.squared", "slope", "p.value"), point_alpha = 0.5, show_values = FALSE, temporal = NULL )dm_plot_climate_compare( x, climate_vars = NULL, numeric_vars = NULL, scale = c("auto", "daily", "cycle", "point"), type = c("timeseries", "boxplot", "violin", "both", "cor_heatmap", "regression_heatmap"), group_var = NULL, Year = NULL, DOY = NULL, box_scales = c("free_y", "fixed"), cor_method = c("pearson", "spearman", "kendall"), use_pairwise = TRUE, regression_stat = c("r.squared", "slope", "p.value"), point_alpha = 0.5, show_values = FALSE, temporal = NULL )
x |
A climate-augmented dendrometer object. |
climate_vars |
Character vector of climate variables to compare. If
|
numeric_vars |
Optional character vector of numeric variables used when
|
scale |
Character. Data level to use. One of |
type |
Character. Plot type. One of |
group_var |
Optional character. Grouping variable. If |
Year |
Optional numeric year or vector of years for subsetting. |
DOY |
Optional numeric vector of length 2 giving the day-of-year range. |
box_scales |
Character. Facet scale behavior for grouped plots. One of
|
cor_method |
Character. Correlation method. One of |
use_pairwise |
Logical. If |
regression_stat |
Character. Statistic shown in regression heatmaps.
One of |
point_alpha |
Numeric. Alpha value for points. |
show_values |
Logical. If |
temporal |
Deprecated argument kept for compatibility with older examples. It is ignored. |
For type = "regression_heatmap", pairwise simple linear regressions
are fitted as y ~ x for every variable combination. The heatmap can
display , slope, or p-value.
A ggplot2 object, returned invisibly.
data(gf_nepa17) data(ktm_clim_hourly) 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") ) dm_plot_climate_compare( zg_clim, climate_vars = c("temp_mean_phase", "VPD_mean_phase", "RH_mean_phase"), scale = "cycle", type = "boxplot" ) plot( zg_clim, climate_vars = c("temp_mean_phase", "VPD_mean_phase", "RH_mean_phase"), scale = "cycle", type = "boxplot" )data(gf_nepa17) data(ktm_clim_hourly) 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") ) dm_plot_climate_compare( zg_clim, climate_vars = c("temp_mean_phase", "VPD_mean_phase", "RH_mean_phase"), scale = "cycle", type = "boxplot" ) plot( zg_clim, climate_vars = c("temp_mean_phase", "VPD_mean_phase", "RH_mean_phase"), scale = "cycle", type = "boxplot" )
Standardizes one or more dendrometer series within seasonal years so that multiple trees can be brought to a comparable scale while preserving their within-season temporal pattern.
Seasonal years are defined as:
"NH": Northern Hemisphere year, from 01 Jan to 31 Dec
"SH": Southern Hemisphere year, from 01 Jul to 30 Jun of the next year
"CS": Custom season defined by CS_doys = c(doy1, doy2)
For season_type = "CS":
if CS_doys[1] <= CS_doys[2], the season stays within one calendar year
if CS_doys[1] > CS_doys[2], the season wraps across years
Standardization is applied separately for each dendrometer series and each seasonal year.
dm_standardize( df, season_type = c("NH", "SH", "CS"), CS_doys = NULL, method = c("center", "amplitude", "robust_amplitude", "minmax", "zscore", "robust_zscore", "percentile"), ref_type = c("first_value", "first_n_days", "ref_window"), ref_n_days = 7, ref_doys = NULL, q_low = 0.05, q_high = 0.95 )dm_standardize( df, season_type = c("NH", "SH", "CS"), CS_doys = NULL, method = c("center", "amplitude", "robust_amplitude", "minmax", "zscore", "robust_zscore", "percentile"), ref_type = c("first_value", "first_n_days", "ref_window"), ref_n_days = 7, ref_doys = NULL, q_low = 0.05, q_high = 0.95 )
df |
A data frame whose first column contains date-time
( |
season_type |
One of |
CS_doys |
Optional numeric vector of length 2 defining the start and end
DOY for |
method |
Standardization method. One of:
|
ref_type |
Reference-value definition for methods that need a reference
(
|
ref_n_days |
Number of initial days used when |
ref_doys |
Optional numeric vector of length 2 defining a DOY reference
window when |
q_low |
Lower quantile used by |
q_high |
Upper quantile used by |
A list of class "dm_standardized" containing:
data: wide data frame with columns
TIME, season_year, in_season, and standardized dendrometer series
parameters: tibble with one row per tree and seasonal year,
summarizing the reference value and scaling denominator used
metadata: method and seasonal-year settings
For season_type = "CS", observations outside the custom season are
retained in data, but their standardized values are set to NA
and in_season = FALSE.
data(gf_nepa17) # Northern Hemisphere seasonal-year standardization out_nh <- dm_standardize( df = gf_nepa17, season_type = "NH", method = "robust_amplitude" ) # Southern Hemisphere seasonal-year standardization out_sh <- dm_standardize( df = gf_nepa17, season_type = "SH", method = "center" ) # Custom season within one year out_cs1 <- dm_standardize( df = gf_nepa17, season_type = "CS", CS_doys = c(100, 280), method = "robust_amplitude" ) # Custom season wrapping across years out_cs2 <- dm_standardize( df = gf_nepa17, season_type = "CS", CS_doys = c(250, 120), method = "percentile" ) head(out_nh$data) head(out_nh$parameters)data(gf_nepa17) # Northern Hemisphere seasonal-year standardization out_nh <- dm_standardize( df = gf_nepa17, season_type = "NH", method = "robust_amplitude" ) # Southern Hemisphere seasonal-year standardization out_sh <- dm_standardize( df = gf_nepa17, season_type = "SH", method = "center" ) # Custom season within one year out_cs1 <- dm_standardize( df = gf_nepa17, season_type = "CS", CS_doys = c(100, 280), method = "robust_amplitude" ) # Custom season wrapping across years out_cs2 <- dm_standardize( df = gf_nepa17, season_type = "CS", CS_doys = c(250, 120), method = "percentile" ) head(out_nh$data) head(out_nh$parameters)
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) )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")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")
Performs continuous wavelet analysis on dendrometer time series.
The function can work with:
raw dendrometer series from a data frame,
detrended dendrometer series from dm.detrend.fit() output,
first differences of either raw or detrended series.
It automatically:
identifies the temporal resolution of the input series,
regularizes the series to a complete time grid,
optionally interpolates missing values,
performs wavelet analysis separately for each selected tree/series,
converts wavelet periods to hours for summary and plotting.
dm_wavelet( x, TreeNum = "all", source = c("auto", "raw", "detrended", "first_diff"), detrended_col = c("detrended_data"), na_action = c("interpolate", "fail"), loess_span = 0.75, dj = 1/20, lowerPeriod = NULL, upperPeriod = NULL, make_pval = TRUE, n_sim = 10, verbose = TRUE )dm_wavelet( x, TreeNum = "all", source = c("auto", "raw", "detrended", "first_diff"), detrended_col = c("detrended_data"), na_action = c("interpolate", "fail"), loess_span = 0.75, dj = 1/20, lowerPeriod = NULL, upperPeriod = NULL, make_pval = TRUE, n_sim = 10, verbose = TRUE )
x |
Input data. Either:
|
TreeNum |
Either |
source |
Which series to analyze. One of:
|
detrended_col |
For |
na_action |
How to handle missing values after completing the regular time grid. One of:
|
loess_span |
Smoothing span passed to |
dj |
Frequency resolution parameter passed to
|
lowerPeriod |
Optional lower period bound in native time units of the
detected input resolution. If |
upperPeriod |
Optional upper period bound in native time units of the
detected input resolution. If |
make_pval |
Logical; if |
n_sim |
Number of simulations used when |
verbose |
Logical; if |
An object of class "dm_wavelet" with elements:
The matched function call.
Either "raw" or "dm_detrended".
Series source actually used.
Character vector of analyzed series names.
Detected time unit of the input series.
Detected time step in native units.
Detected time step expressed in hours.
Detected time step in seconds.
Regularized time series used for analysis.
Named list of wavelet results, one per series. Each entry
contains the original WaveletComp object plus time and
period-in-hours information.
Analysis settings.
Computes cross-wavelet power and wavelet coherence between dendrometer series
and climate variables using WaveletComp::analyze.coherency().
The function:
crops dendrometer and climate inputs to their common time window,
detects their temporal resolutions,
resamples both to the coarser detected resolution,
optionally interpolates missing values,
optionally uses first differences of the dendrometer series,
computes pairwise coherence for all selected tree/climate combinations.
dm_wavelet_coherence( dm, clim, TreeNum = "all", clim_vars = "all", source = c("auto", "raw", "detrended", "first_diff"), detrended_col = c("detrended_data"), dm_fun = c("mean", "max", "min", "sum"), clim_funs = "mean", na_action = c("interpolate", "fail"), loess_span = 0, dj = 1/20, lowerPeriod = NULL, upperPeriod = NULL, window.type.t = 1, window.type.s = 1, window.size.t = 5, window.size.s = 1/4, make.pval = TRUE, make_pval = NULL, method = "white.noise", n.sim = 10, n_sim = NULL, verbose = TRUE )dm_wavelet_coherence( dm, clim, TreeNum = "all", clim_vars = "all", source = c("auto", "raw", "detrended", "first_diff"), detrended_col = c("detrended_data"), dm_fun = c("mean", "max", "min", "sum"), clim_funs = "mean", na_action = c("interpolate", "fail"), loess_span = 0, dj = 1/20, lowerPeriod = NULL, upperPeriod = NULL, window.type.t = 1, window.type.s = 1, window.size.t = 5, window.size.s = 1/4, make.pval = TRUE, make_pval = NULL, method = "white.noise", n.sim = 10, n_sim = NULL, verbose = TRUE )
dm |
Dendrometer input. Either a data frame with time in the first column
or an object of class |
clim |
Climate data frame. The first column must be time; remaining selected columns must be numeric climate variables. |
TreeNum |
Dendrometer series selector: |
clim_vars |
Climate variable selector: |
source |
One of |
detrended_col |
For |
dm_fun |
Aggregation function for dendrometer resampling: one of
|
clim_funs |
Either a single aggregation function applied to all climate
variables, or a named character vector such as
|
na_action |
One of |
loess_span |
Detrending span passed to |
dj |
Frequency resolution passed to |
lowerPeriod |
Optional lower period in native analysis units. |
upperPeriod |
Optional upper period in native analysis units. |
window.type.t |
Time-direction smoothing window type. |
window.type.s |
Scale-direction smoothing window type. |
window.size.t |
Time-direction smoothing window size. |
window.size.s |
Scale-direction smoothing window size. |
make.pval |
Logical. If |
make_pval |
Optional alias for |
method |
Surrogate generation method for p-values. |
n.sim |
Number of simulations. |
n_sim |
Optional alias for |
verbose |
Logical. |
WaveletComp::analyze.coherency() expects two aligned series in one data
frame plus a dt value in the analysis time units, and returns
cross-wavelet power, coherence, phase angles, p-values, Fourier periods, and
cone-of-influence fields.
An object of class "dm_wavelet_coherence".
wc <- dm_wavelet_coherence( dm = gf_nepa17, clim = ktm_clim_hourly, TreeNum = 1, clim_vars = c("temp", "VPD"), source = "raw", dm_fun = "mean", clim_funs = c(temp = "mean", VPD = "mean"), loess_span = 0, make.pval = TRUE, n.sim = 10, verbose = FALSE ) plot(wc) plot(wc, type = "cross_power") plot(wc, type = "average_coherence") plot(wc, type = "phase") plot(wc, type = "series")wc <- dm_wavelet_coherence( dm = gf_nepa17, clim = ktm_clim_hourly, TreeNum = 1, clim_vars = c("temp", "VPD"), source = "raw", dm_fun = "mean", clim_funs = c(temp = "mean", VPD = "mean"), loess_span = 0, make.pval = TRUE, n.sim = 10, verbose = FALSE ) plot(wc) plot(wc, type = "cross_power") plot(wc, type = "average_coherence") plot(wc, type = "phase") plot(wc, type = "series")
Reconstructs a selected oscillatory component, or a selected period band,
from a dm_wavelet object using WaveletComp::reconstruct().
Requested periods are supplied in hours. They are internally
converted to the native wavelet period units used when dm_wavelet()
was computed, then passed to WaveletComp::reconstruct().
The function supports two modes:
mode = "extract" returns the selected cycle or band itself.
mode = "remove" returns the original series with the selected
cycle or band removed.
dm_wavelet_reconstruct( x, series = NULL, mode = c("extract", "remove"), period_hours = NULL, lower_hours = NULL, upper_hours = NULL, lvl = 0, only_sig = TRUE, siglvl = 0.05, only_coi = FALSE, only_ridge = FALSE, rescale = FALSE, verbose = TRUE )dm_wavelet_reconstruct( x, series = NULL, mode = c("extract", "remove"), period_hours = NULL, lower_hours = NULL, upper_hours = NULL, lvl = 0, only_sig = TRUE, siglvl = 0.05, only_coi = FALSE, only_ridge = FALSE, rescale = FALSE, verbose = TRUE )
x |
An object of class |
series |
Optional character vector of series names to reconstruct. If
|
mode |
One of |
period_hours |
Optional numeric vector of exact periods, in hours, to
reconstruct. If supplied, |
lower_hours |
Optional lower period bound in hours for band reconstruction. |
upper_hours |
Optional upper period bound in hours for band reconstruction. |
lvl |
Minimum wavelet power level to include in the reconstruction. |
only_sig |
Logical. If |
siglvl |
Significance level used when |
only_coi |
Logical. If |
only_ridge |
Logical. If |
rescale |
Logical. Passed to |
verbose |
Logical. If |
An object of class "dm_wavelet_reconstruct" with elements:
Matched function call.
Selected series names.
Reconstruction mode, either "extract" or "remove".
A list describing the requested selection in hours and in native wavelet units.
Named list of WaveletComp::reconstruct() outputs.
Tidy table with columns TIME,
series, original, reconstructed, difference,
and filtered.
Per-series table of periods actually used in the reconstruction, in native units and in hours.
Wide table with TIME in the first column and
one filtered series column per selected tree/series.
Minimal metadata copied from the parent dm_wavelet
object.
wv <- dm_wavelet( x = gf_nepa17, TreeNum = 1:2, source = "raw", make_pval = TRUE, verbose = FALSE ) # extract circadian component rec_extract <- dm_wavelet_reconstruct( wv, mode = "extract", lower_hours = 20, upper_hours = 28, only_sig = TRUE ) # remove circadian component rec_remove <- dm_wavelet_reconstruct( wv, mode = "remove", lower_hours = 20, upper_hours = 28, only_sig = TRUE ) head(rec_extract$filtered_wide) head(rec_remove$filtered_wide)wv <- dm_wavelet( x = gf_nepa17, TreeNum = 1:2, source = "raw", make_pval = TRUE, verbose = FALSE ) # extract circadian component rec_extract <- dm_wavelet_reconstruct( wv, mode = "extract", lower_hours = 20, upper_hours = 28, only_sig = TRUE ) # remove circadian component rec_remove <- dm_wavelet_reconstruct( wv, mode = "remove", lower_hours = 20, upper_hours = 28, only_sig = TRUE ) head(rec_extract$filtered_wide) head(rec_remove$filtered_wide)
Creates detrended standardized dendrometer series from objects returned by [dm.growth.fit()] or [dm.growth.fit.double()].
The function compares the original daily dendrometer series ('x$original_daily_data') with the fitted growth curve from 'x$fitted_data'. Because fitted values are stored on the processed scale used for modelling, the function first reconstructs fitted values on the original daily scale by adding back the seasonal baseline (the first non-missing original daily value of each series within each vegetation season).
Residuals are then calculated as:
To obtain a detrended standardized series with mean equal to 1 and no negative
values, residuals are transformed within each series × season_label as:
where is a small constant ensuring strictly positive values.
If all residuals within a season are identical, the standardized series
becomes a constant vector of 1.
dm.detrend.fit( x, series = NULL, seasons = NULL, epsilon = 1e-06, keep_na_rows = FALSE )dm.detrend.fit( x, series = NULL, seasons = NULL, epsilon = 1e-06, keep_na_rows = FALSE )
x |
An object of class |
series |
Optional character vector of dendrometer series to retain.
Default is |
seasons |
Optional character vector of vegetation-season labels to
retain. Default is |
epsilon |
Small positive constant added after shifting residuals by their
seasonal minimum. Default is |
keep_na_rows |
Logical. If |
The function uses x$original_daily_data, which must be present in the
input object. If the object was created by an older version of
[dm.growth.fit()] or [dm.growth.fit.double()] that did not store
original_daily_data, the function will stop with an informative error.
Standardization is carried out separately within each vegetation season. This
means the mean of the detrended standardized series is 1 for each
series × season_label, not necessarily across the entire dataset.
A list of class "dm_detrended" with elements:
The matched function call.
Wide-format tibble with metadata columns and one detrended standardized series column per dendrometer.
Long-format tibble containing original daily values, reconstructed fitted values on the original scale, residuals, shifted residuals, and detrended standardized values.
Per-series and per-season summary table containing baseline values and residual standardization parameters.
The original x$fit_statistics table.
data(gf_nepa17) fit1 <- dm.growth.fit( df = gf_nepa17, TreeNum = 1:2, method = "gompertz", year_mode = "yearly", verbose = FALSE ) det1 <- dm.detrend.fit(fit1) head(det1$detrended_data) head(det1$parameters) fit2 <- dm.growth.fit.double( df = gf_nepa17, TreeNum = 1, method = "gompertz", year_mode = "yearly", verbose = FALSE ) det2 <- dm.detrend.fit(fit2) head(det2$detrended_long)data(gf_nepa17) fit1 <- dm.growth.fit( df = gf_nepa17, TreeNum = 1:2, method = "gompertz", year_mode = "yearly", verbose = FALSE ) det1 <- dm.detrend.fit(fit1) head(det1$detrended_data) head(det1$parameters) fit2 <- dm.growth.fit.double( df = gf_nepa17, TreeNum = 1, method = "gompertz", year_mode = "yearly", verbose = FALSE ) det2 <- dm.detrend.fit(fit2) head(det2$detrended_long)
This function modells the annual growth of dendrometer data using gompertz function.
dm.fit.gompertz( df, CalYear, TreeNum, f_derivative = F, start = list(b = 0.5, k = 0.005), verbose = FALSE )dm.fit.gompertz( df, CalYear, TreeNum, f_derivative = F, start = list(b = 0.5, k = 0.005), verbose = FALSE )
df |
dataframe with first column containing date and time in the format |
CalYear |
numeric for year of calculation. If df has more than one year, assigning CalYear truncates the data of only that year. |
TreeNum |
numerical value indicating the tree to be analysed. E.g. '1' refers to the first dendrometer data column in df. |
f_derivative |
logical if yes returns first derivative of gompertz curve. |
start |
A named list of start values for fitting
the Gompertz curve (passed to |
verbose |
logical if TRUE also returns the optimized parameters. Default is FALSE. |
A data frame with the modelled dendrometer series. If verbose = TRUE, returns a list
with two data frames. The fitted curve and parameters.
library(dendRoAnalyst) data(gf_nepa17) gomp_fitted<-dm.fit.gompertz(df=gf_nepa17, TreeNum = 1, CalYear=2017) head(gomp_fitted,10)library(dendRoAnalyst) data(gf_nepa17) gomp_fitted<-dm.fit.gompertz(df=gf_nepa17, TreeNum = 1, CalYear=2017) head(gomp_fitted,10)
Fits one or more growth models to dendrometer series and returns a compact table of evaluation statistics only.
This function is intended for method comparison rather than data extraction. It runs the selected fitting methods, aligns observed and fitted values on all non-missing observation days, and calculates goodness-of-fit measures for each fitted series and vegetation-season fit.
Supported single-curve methods are '"gam"', '"gompertz"', '"logistic"', '"richards"', '"loess"', and '"spline"', which are fitted using [dm.growth.fit()]. Supported bimodal methods are '"double_gompertz"' and '"double_richards"', which are fitted using [dm.growth.fit.double()].
The function returns only an evaluation table and does not return fitted curves, processed data, or parameter objects. It is therefore useful for comparing alternative fitting methods across series, years, or sites before selecting a final modeling approach.
dm.growth.evaluate( df, TreeNum = "all", methods = c("gam", "gompertz", "logistic", "richards", "loess", "spline", "double_gompertz", "double_richards"), years = "all", year_mode = c("yearly", "pooled"), fit_GRO = TRUE, site_mode = c("NH", "SH", "CS"), custom_veg_season = c(275, 274), growth_fraction = c(0.1, 0.9), min_unique_growth = 10, rate_threshold_fraction = 0.1, peak_separation_min = 10, valley_ratio_max = 0.4, min_relative_peak = 0.05, start_value_gompertz_parameters = list(a = NA_real_, b = NA_real_, k = NA_real_), start_value_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v = 1), start_value_double_gompertz_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, a2 = NA_real_, k2 = NA_real_, t02 = NA_real_), start_value_double_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v = 1, a2 = NA_real_, k2 = NA_real_, t02 = NA_real_, v2 = 1), loess_span = 0.2, spline_df = 10, verbose = TRUE )dm.growth.evaluate( df, TreeNum = "all", methods = c("gam", "gompertz", "logistic", "richards", "loess", "spline", "double_gompertz", "double_richards"), years = "all", year_mode = c("yearly", "pooled"), fit_GRO = TRUE, site_mode = c("NH", "SH", "CS"), custom_veg_season = c(275, 274), growth_fraction = c(0.1, 0.9), min_unique_growth = 10, rate_threshold_fraction = 0.1, peak_separation_min = 10, valley_ratio_max = 0.4, min_relative_peak = 0.05, start_value_gompertz_parameters = list(a = NA_real_, b = NA_real_, k = NA_real_), start_value_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v = 1), start_value_double_gompertz_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, a2 = NA_real_, k2 = NA_real_, t02 = NA_real_), start_value_double_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v = 1, a2 = NA_real_, k2 = NA_real_, t02 = NA_real_, v2 = 1), loess_span = 0.2, spline_df = 10, verbose = TRUE )
df |
A data frame or tibble. The first column must be a time stamp and the remaining selected columns must be numeric dendrometer series. |
TreeNum |
Either '"all"', a numeric vector selecting dendrometer series by position, or a character vector of series names. |
methods |
Character vector of fitting methods to evaluate. |
years |
Either '"all"' or a character vector of vegetation-season labels. |
year_mode |
Either '"yearly"' or '"pooled"'. |
fit_GRO |
Logical. If 'TRUE', convert processed daily series to cumulative growth before fitting. |
site_mode |
Vegetation season definition. One of '"NH"', '"SH"', or '"CS"'. |
custom_veg_season |
Numeric vector of length 2 defining a custom season in day-of-year coordinates when 'site_mode = "CS"'. |
growth_fraction |
Numeric vector of length 2 used by the fitting functions to estimate cumulative-growth timing. |
min_unique_growth |
Minimum number of unique cumulative-growth values required before a fit is attempted. |
rate_threshold_fraction |
Numeric scalar between 0 and 1. Passed to the fitting functions where supported. |
peak_separation_min |
Minimum peak separation in days for [dm.growth.fit.double()]. |
valley_ratio_max |
Maximum allowed valley-to-peak ratio for [dm.growth.fit.double()]. |
min_relative_peak |
Minimum relative peak height for [dm.growth.fit.double()]. |
start_value_gompertz_parameters |
Optional starting values for Gompertz fits. |
start_value_richards_parameters |
Optional starting values for logistic and Richards fits. |
start_value_double_gompertz_parameters |
Optional starting values for double-Gompertz fits. |
start_value_double_richards_parameters |
Optional starting values for double-Richards fits. |
loess_span |
Span used when 'method = "loess"'. |
spline_df |
Degrees of freedom used when 'method = "spline"'. |
verbose |
Logical. If 'TRUE', prints progress messages. |
Evaluation statistics are calculated by comparing observed daily values against fitted daily values on all days where observed values are available.
The returned metrics have the following interpretation:
'rmse': root mean squared error. Smaller values indicate closer fit.
'mae': mean absolute error. Smaller values indicate closer fit and are less sensitive to large deviations than RMSE.
'bias': mean fitted minus observed value. Positive values indicate overestimation and negative values indicate underestimation.
'r2': coefficient of determination, computed from residual and total sums of squares. Larger values indicate better fit.
'correlation': Pearson correlation between observed and fitted values. Larger values indicate stronger agreement in shape.
'nrmse': normalized RMSE, calculated as RMSE divided by the observed value range. This allows comparison across series with different magnitudes.
'rss': residual sum of squares.
'aic_approx' and 'bic_approx': approximate information criteria based on RSS and an effective parameter count rather than the exact likelihood returned by each modeling function.
The columns 'aic_approx' and 'bic_approx' are labeled as approximate because they are not extracted from the original model objects through a unified likelihood interface. Instead, they are computed from the residual sum of squares and an effective number of fitted parameters. They are therefore most useful for relative comparison among methods fitted to the same dataset.
Negative values of 'aic_approx' or 'bic_approx' are not an error. They occur naturally when the average residual variance is smaller than 1, because the logarithmic term in the information-criterion formula becomes negative. In practice, the absolute sign is not important; only differences among methods fitted to the same data should be interpreted.
For methods with flexible smoothness, such as GAM or spline, the effective parameter count is approximate. Consequently, 'aic_approx' and 'bic_approx' should be treated as heuristic ranking measures rather than exact likelihood-based criteria.
A tibble with one row per fitted series and fit, containing:
Fitting method used for the row.
Series name.
Vegetation-season label or '"pooled"'.
Number of observed days used for comparison.
Root mean squared error.
Mean absolute error.
Mean fitted minus observed value.
Coefficient of determination.
Pearson correlation between observed and fitted values.
RMSE divided by the observed range.
Residual sum of squares.
Approximate AIC based on RSS and effective parameter count.
Approximate BIC based on RSS and effective parameter count.
Effective parameter count used in the approximate information criteria.
Logical convergence flag returned by the fitting function.
Model note, warning, or error message returned by the fitting function.
[dm.growth.fit()], [dm.growth.fit.double()]
Fits cumulative growth curves to daily dendrometer series using one of
several supported methods: generalized additive model "gam",
Gompertz "gompertz", logistic "logistic", Richards
"richards", local regression "loess", or smoothing spline
"spline".
The function:
resamples dendrometer data to daily maxima using [dendro.resample()],
assigns each daily observation to a vegetation season,
optionally converts daily stem-size values to cumulative growth
with fit_GRO = TRUE,
fits one curve per series and season with
year_mode = "yearly" or one pooled curve across retained seasons
with year_mode = "pooled",
estimates growing-season timing from the fitted cumulative-growth curve,
additionally identifies active-growth timing from the fitted growth-rate curve.
For Gompertz, logistic, and Richards fits, the asymptote parameter
a, representing maximum seasonal growth, can optionally be fixed to
the observed maximum cumulative growth for that series and vegetation season.
This is controlled by fix_a_to_observed_max.
dm.growth.fit( df, TreeNum = "all", method = c("gam", "gompertz", "logistic", "richards", "loess", "spline"), years = "all", year_mode = c("yearly", "pooled"), fit_GRO = TRUE, site_mode = c("NH", "SH", "CS"), custom_veg_season = c(275, 274), growth_fraction = c(0.1, 0.9), min_unique_growth = 10, rate_threshold_fraction = 0.1, fix_a_to_observed_max = FALSE, fixed_a_multiplier = 1, start_value_gompertz_parameters = list(a = NA_real_, b = NA_real_, k = NA_real_), start_value_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v = 1), loess_span = 0.2, spline_df = 10, verbose = TRUE )dm.growth.fit( df, TreeNum = "all", method = c("gam", "gompertz", "logistic", "richards", "loess", "spline"), years = "all", year_mode = c("yearly", "pooled"), fit_GRO = TRUE, site_mode = c("NH", "SH", "CS"), custom_veg_season = c(275, 274), growth_fraction = c(0.1, 0.9), min_unique_growth = 10, rate_threshold_fraction = 0.1, fix_a_to_observed_max = FALSE, fixed_a_multiplier = 1, start_value_gompertz_parameters = list(a = NA_real_, b = NA_real_, k = NA_real_), start_value_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v = 1), loess_span = 0.2, spline_df = 10, verbose = TRUE )
df |
A data frame or tibble. The first column must be a timestamp
|
TreeNum |
Either |
method |
Fitting method. One of |
years |
Either |
year_mode |
Either |
fit_GRO |
Logical. If |
site_mode |
Vegetation season definition. One of |
custom_veg_season |
Numeric vector of length two giving the start and
end day-of-year for custom vegetation seasons in |
growth_fraction |
Numeric vector of length two giving the lower and
upper fractions of final fitted seasonal growth used to define cumulative
growth onset and cessation, for example |
min_unique_growth |
Minimum number of unique non-missing cumulative growth values required before a fit is attempted. |
rate_threshold_fraction |
Numeric scalar between 0 and 1. Active-growth dates are derived from the fitted growth-rate curve as the first and last days where fitted growth rate exceeds this fraction of the peak fitted growth rate. |
fix_a_to_observed_max |
Logical. If |
fixed_a_multiplier |
Numeric multiplier applied to the observed maximum
when |
start_value_gompertz_parameters |
Optional named list with starting
values for Gompertz fits. Supported names are |
start_value_richards_parameters |
Optional named list with starting
values for Richards and logistic fits. Supported names are |
loess_span |
Span used when |
spline_df |
Degrees of freedom used when |
verbose |
Logical. If |
The first column of df is treated as the time column and renamed to
"TIME" internally. If it is not already a date-time object, the
function attempts to parse it using [lubridate::parse_date_time()].
growth_start_* and growth_end_* are based on cumulative fitted
growth. rate_start_* and rate_end_* are based on the fitted
growth-rate curve.
For Gompertz, logistic, and Richards models, a is the upper asymptote.
When fix_a_to_observed_max = TRUE, this parameter is not estimated by
nonlinear least squares. Instead, it is fixed to:
where is the observed cumulative growth for that series and
vegetation season.
An object of class "dm_growth_fit" with elements:
The matched function call.
Raw daily dendrometer data after resampling to daily maxima and assigning vegetation seasons, but before centering and optional cumulative-growth transformation.
Daily processed data used for fitting.
Daily fitted values on the full vegetation-season grid.
Table with fit-level statistics and estimated timing.
Table with fit-level model parameters and convergence information.
Vegetation seasons retained for fitting.
[summary.dm_growth_fit()], [print.dm_growth_fit()]
# fit <- dm.growth.fit( # df = dendro_data, # TreeNum = "all", # method = "gompertz", # year_mode = "yearly", # fit_GRO = TRUE, # fix_a_to_observed_max = TRUE # ) # fit2 <- dm.growth.fit( # df = dendro_data, # TreeNum = "all", # method = "richards", # year_mode = "yearly", # fit_GRO = TRUE, # fix_a_to_observed_max = TRUE, # fixed_a_multiplier = 1.02 # )# fit <- dm.growth.fit( # df = dendro_data, # TreeNum = "all", # method = "gompertz", # year_mode = "yearly", # fit_GRO = TRUE, # fix_a_to_observed_max = TRUE # ) # fit2 <- dm.growth.fit( # df = dendro_data, # TreeNum = "all", # method = "richards", # year_mode = "yearly", # fit_GRO = TRUE, # fix_a_to_observed_max = TRUE, # fixed_a_multiplier = 1.02 # )
Fits bimodal cumulative growth curves to daily dendrometer series using either a double-Gompertz or double-Richards model.
Overall growing-season timing is derived from the fitted cumulative-growth
curve using growth_fraction. Pulse-specific timing is derived from the
derivative of the fitted curve using a pulse-specific relative rate threshold
given by rate_threshold_fraction.
Pulse-specific timing is returned as NA when the fitted curve does not
show a convincing two-pulse pattern according to derivative-based criteria.
If fallback_to_single = TRUE and no convincing two-pulse pattern is
found, the function refits a corresponding single growth curve and returns
that fit instead. In that case, overall season timing is still returned, but
pulse-specific timing remains NA.
For double-Gompertz and double-Richards fits, the total asymptote can
optionally be fixed to the observed maximum cumulative growth of the
corresponding series and vegetation season. In the double-curve case, this
means a + a2 is fixed, while the relative contribution of the first
and second pulse is estimated.
dm.growth.fit.double( df, TreeNum = "all", method = c("gompertz", "richards"), years = "all", year_mode = c("yearly", "pooled"), fit_GRO = TRUE, site_mode = c("NH", "SH", "CS"), custom_veg_season = c(275, 274), growth_fraction = c(0.1, 0.9), min_unique_growth = 10, rate_threshold_fraction = 0.1, peak_separation_min = 10, valley_ratio_max = 0.4, min_relative_peak = 0.05, fallback_to_single = TRUE, fix_a_to_observed_max = FALSE, fixed_a_multiplier = 1, start_value_double_gompertz_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, a2 = NA_real_, k2 = NA_real_, t02 = NA_real_), start_value_double_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v = 1, a2 = NA_real_, k2 = NA_real_, t02 = NA_real_, v2 = 1), verbose = TRUE )dm.growth.fit.double( df, TreeNum = "all", method = c("gompertz", "richards"), years = "all", year_mode = c("yearly", "pooled"), fit_GRO = TRUE, site_mode = c("NH", "SH", "CS"), custom_veg_season = c(275, 274), growth_fraction = c(0.1, 0.9), min_unique_growth = 10, rate_threshold_fraction = 0.1, peak_separation_min = 10, valley_ratio_max = 0.4, min_relative_peak = 0.05, fallback_to_single = TRUE, fix_a_to_observed_max = FALSE, fixed_a_multiplier = 1, start_value_double_gompertz_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, a2 = NA_real_, k2 = NA_real_, t02 = NA_real_), start_value_double_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v = 1, a2 = NA_real_, k2 = NA_real_, t02 = NA_real_, v2 = 1), verbose = TRUE )
df |
A data frame or tibble. The first column must be a time stamp
|
TreeNum |
Either |
method |
Double-curve fitting method. One of |
years |
Either |
year_mode |
Either |
fit_GRO |
Logical. If |
site_mode |
Vegetation season definition. One of |
custom_veg_season |
Numeric vector of length two giving the start and
end day-of-year for custom vegetation seasons in |
growth_fraction |
Numeric vector of length two giving the lower and upper fractions of final fitted seasonal growth used to define overall growing-season onset and cessation. |
min_unique_growth |
Minimum number of unique non-missing cumulative growth values required before a fit is attempted. |
rate_threshold_fraction |
Numeric scalar between 0 and 1. Pulse start and end are defined as the first and last days where fitted growth rate exceeds this fraction of the pulse-specific peak fitted growth rate. |
peak_separation_min |
Minimum number of days separating the two fitted derivative peaks required to classify a fit as truly two-pulse. |
valley_ratio_max |
Maximum allowed ratio between the valley rate and the weaker of the two derivative peaks. Smaller values require a deeper valley between pulses. |
min_relative_peak |
Minimum relative height, expressed as a fraction of the global derivative maximum, for a local derivative peak to be considered. |
fallback_to_single |
Logical. If |
fix_a_to_observed_max |
Logical. If |
fixed_a_multiplier |
Numeric multiplier applied to the observed maximum
when |
start_value_double_gompertz_parameters |
Optional named list of starting
values for the double-Gompertz fit. Supported names are |
start_value_double_richards_parameters |
Optional named list of starting
values for the double-Richards fit. Supported names are |
verbose |
Logical. If |
The second pulse is constrained to occur after the first pulse, which improves numerical stability and reduces label switching between the two components.
For double-Gompertz and double-Richards models, the total seasonal asymptote is:
When fix_a_to_observed_max = TRUE, the function fits:
where is the observed cumulative growth of the selected
dendrometer series and vegetation season.
The fitted pulse contributions are still returned as a and a2,
and their sum should equal fixed_a_value, apart from small numerical
rounding.
Non-applicable parameters are returned as NA. For example, b
and b2 are relevant for double-Gompertz, while v and v2
are relevant for double-Richards.
An object of class "dm_growth_fit" with elements:
The matched function call.
Raw daily dendrometer data after resampling to daily maxima and assigning vegetation seasons, but before centering and optional cumulative-growth transformation.
Daily processed data used for fitting.
Daily fitted values on the full vegetation-season grid.
Fit-level statistics and estimated timing.
Fit-level model parameters and convergence information.
Vegetation seasons retained for fitting.
[dm.growth.fit()], [summary.dm_growth_fit()], [print.dm_growth_fit()]
# Double-Gompertz with total seasonal asymptote fixed # fit_gomp <- dm.growth.fit.double( # df = dendro_data, # TreeNum = "all", # method = "gompertz", # year_mode = "yearly", # fit_GRO = TRUE, # fix_a_to_observed_max = TRUE # ) # Double-Richards with the total asymptote set 2 percent above observed max # fit_rich <- dm.growth.fit.double( # df = dendro_data, # TreeNum = "all", # method = "richards", # year_mode = "yearly", # fit_GRO = TRUE, # fix_a_to_observed_max = TRUE, # fixed_a_multiplier = 1.02 # )# Double-Gompertz with total seasonal asymptote fixed # fit_gomp <- dm.growth.fit.double( # df = dendro_data, # TreeNum = "all", # method = "gompertz", # year_mode = "yearly", # fit_GRO = TRUE, # fix_a_to_observed_max = TRUE # ) # Double-Richards with the total asymptote set 2 percent above observed max # fit_rich <- dm.growth.fit.double( # df = dendro_data, # TreeNum = "all", # method = "richards", # year_mode = "yearly", # fit_GRO = TRUE, # fix_a_to_observed_max = TRUE, # fixed_a_multiplier = 1.02 # )
Detects missing timestamps (based on provided resolution), inserts rows with NA,
and optionally interpolates missing values using either cubic spline interpolation
(na.spline) or seasonal decomposition interpolation
(na.interp).
Optionally, the function can test the reliability of interpolation for increasing gap lengths (e.g., 6 hours to 3 days) using real data. This allows the user to assess how well a given interpolation method recovers missing values over different durations.
dm.na.interpolation( df, resolution, fill = FALSE, method = "spline", assess = FALSE, assess_lengths_hours = seq(6, 72, by = 6), assess_samples_per_length = 10, assess_buffer_hours = 6, assess_seed = NULL, verbose = FALSE )dm.na.interpolation( df, resolution, fill = FALSE, method = "spline", assess = FALSE, assess_lengths_hours = seq(6, 72, by = 6), assess_samples_per_length = 10, assess_buffer_hours = 6, assess_seed = NULL, verbose = FALSE )
df |
A data frame with the first column as datetime ( |
resolution |
Integer. Temporal resolution in minutes (e.g., 60 for hourly data). |
fill |
Logical. If |
method |
Character. Interpolation method (only used if
|
assess |
Logical. If |
assess_lengths_hours |
Integer vector. The gap durations (in hours) to test during
assessment. Default: |
assess_samples_per_length |
Integer. Number of artificial gaps per gap length
per series. Default: |
assess_buffer_hours |
Integer. Minimum number of hours of valid data required
before and after the artificial gap to allow valid assessment. Default: |
assess_seed |
Integer or |
verbose |
Logical. If |
The assessment simulates interpolation over artificial gaps of different durations. For each dendrometer series and each gap length:
Random windows (with clean data) are selected.
Data in the window is temporarily set to NA.
The gap is interpolated using the selected method.
The predicted values are compared to the original (true) values using:
MAPE — Mean Absolute Percentage Error.
MdAPE — Median Absolute Percentage Error.
RMSE_pct — Root Mean Square Error (%).
Bias_pct — Mean Percentage Error (%).
Max_diff_abs — Mean absolute difference in daily maximum.
Min_diff_abs — Mean absolute difference in daily minimum.
Time_max_diff_h — Mean absolute difference in time of daily maximum (hours).
Time_min_diff_h — Mean absolute difference in time of daily minimum (hours).
A list of class "dm_na_interpolation" with components:
$dataData frame containing the original or gap-filled series.
$gap_infoTable describing timestamp gaps and internal NA runs.
$assessmentA tibble summarizing interpolation accuracy for each
series and gap length, or NULL when assess = FALSE.
$filledLogical indicating whether interpolation was performed.
$assessedLogical indicating whether interpolation assessment was performed.
$methodInterpolation method used.
$resolutionTemporal resolution in minutes.
library(dendRoAnalyst) data(nepa17) #res0 <- dm.na.interpolation(nepa17[1:1000, ], resolution = 60) #plot(res0) #plot(res0, type = "gaps") #res1 <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "spline" #) #plot(res1) #plot(res1, type = "gaps") #plot(res1, type = "interpolation", original = nepa17[1:1000, ]) #res2 <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "seasonal", # assess = TRUE # ) #plot(res2) #plot(res2, type = "assessment", metric = "MdAPE")library(dendRoAnalyst) data(nepa17) #res0 <- dm.na.interpolation(nepa17[1:1000, ], resolution = 60) #plot(res0) #plot(res0, type = "gaps") #res1 <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "spline" #) #plot(res1) #plot(res1, type = "gaps") #plot(res1, type = "interpolation", original = nepa17[1:1000, ]) #res2 <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "seasonal", # assess = TRUE # ) #plot(res2) #plot(res2, type = "assessment", metric = "MdAPE")
The dendrometer data from three Chir pine tree collected in hourly resolution for 2017.
gf_nepa17gf_nepa17
A data frame with 8760 rows and 3 variables:
Timedatetime time of data recording
T2double reading for first tree
T3double reading for second tree
Dendrometers generally have limited memory capacity beyond which they stop recording. To keep the measurement ongoing, they should be adjusted periodically, which can cause positive or negative jumps in the data. This function locates these artefacts and interactively adjusts them one by one.
i.jump.locator( df, TreeNum, detection_method = c("manual", "auto"), manual_threshold = NULL, auto_method_penalty = 10, adjustment_method = c("window_median", "point_diff"), adjust_window = 5, plot_window = 20, auto_every_second = TRUE, set_jump_point_na = FALSE )i.jump.locator( df, TreeNum, detection_method = c("manual", "auto"), manual_threshold = NULL, auto_method_penalty = 10, adjustment_method = c("window_median", "point_diff"), adjust_window = 5, plot_window = 20, auto_every_second = TRUE, set_jump_point_na = FALSE )
df |
Data frame with first column containing date and time in the format
|
TreeNum |
Numerical value indicating the tree to be analysed. E.g. |
detection_method |
Either |
manual_threshold |
Numeric threshold considered as artefact when
|
auto_method_penalty |
Numeric manual penalty value used in
|
adjustment_method |
Either |
adjust_window |
Integer window size used for robust jump-size estimation
when |
plot_window |
Integer number of points shown before and after each jump in the interactive plot. |
auto_every_second |
Logical. If |
set_jump_point_na |
Logical. If |
A dataframe containing jump-free dendrometer data.
Dendrometers generally have limited memory capacity beyond which
they stop recording. To keep the measurement ongoing, they should be adjusted
periodically, which can cause positive or negative jumps in the data. This
function locates these artefacts and adjusts them automatically. Unlike
i.jump.locator , it can handle datasets with more than one
dendrometer.
jump.locator( df, detection_method = c("manual", "auto"), manual_threshold = NULL, auto_method_penalty = 10, adjustment_method = c("window_median", "point_diff"), adjust_window = 5, auto_every_second = TRUE, set_jump_point_na = FALSE )jump.locator( df, detection_method = c("manual", "auto"), manual_threshold = NULL, auto_method_penalty = 10, adjustment_method = c("window_median", "point_diff"), adjust_window = 5, auto_every_second = TRUE, set_jump_point_na = FALSE )
df |
Data frame with first column containing date and time in the format
|
detection_method |
Either |
manual_threshold |
Numeric threshold considered as artefact when
|
auto_method_penalty |
Numeric manual penalty value used in
|
adjustment_method |
Either |
adjust_window |
Integer window size used for robust jump-size estimation
when |
auto_every_second |
Logical. If |
set_jump_point_na |
Logical. If |
A dataframe containing jump-free dendrometer data.
library(dendRoAnalyst) data(nepa) # Manual detection jump_free_nepa <- jump.locator( df = nepa, detection_method = "manual", manual_threshold = 1 ) # Automatic detection with cpt.mean() and penalty = "Manual" jump_free_nepa2 <- jump.locator( df = nepa, detection_method = "auto", auto_method_penalty = 10 )library(dendRoAnalyst) data(nepa) # Manual detection jump_free_nepa <- jump.locator( df = nepa, detection_method = "manual", manual_threshold = 1 ) # Automatic detection with cpt.mean() and penalty = "Manual" jump_free_nepa2 <- jump.locator( df = nepa, detection_method = "auto", auto_method_penalty = 10 )
Hourly near-surface climate data for Kathmandu, Nepal, extracted from the Copernicus Climate Change Service (C3S) ERA5-Land reanalysis. The dataset is included to demonstrate climate–dendrometer workflows in dendRoAnalyst, including joining hourly climate data with dendrometer observations, event-based analyses, and wavelet-based analyses.
ktm_clim_hourlyktm_clim_hourly
A data frame with hourly observations and 5 variables:
TIMEDate-time stamp of the hourly observation.
tempAir temperature in degree Celsius.
precPrecipitation in millimetres.
VPDVapour pressure deficit in kPa.
RHRelative humidity in percent.
ktm_clim_hourly contains a single-location hourly climate time series
for Kathmandu derived from ERA5-Land. ERA5-Land is a global land-surface
reanalysis produced by replaying the land component of ERA5 at enhanced
spatial resolution and is widely used for land-surface and ecohydrological
applications.
This dataset is intended as an example climate input for dendRoAnalyst. It can be used, for example, with functions that join dendrometer and climate data, calculate phase-climate relations, run event analyses, or perform wavelet and wavelet-coherence analyses.
Users should check the exact temporal coverage of the object in their local installation, for example with:
range(ktm_clim_hourly$TIME)
Extracted from the Copernicus Climate Change Service (C3S) Climate Data Store ERA5-Land reanalysis product:
Muñoz-Sabater, J. (2019). ERA5-Land hourly data from 1950 to present. Copernicus Climate Change Service (C3S) Climate Data Store (CDS).
Muñoz-Sabater, J., Dutra, E., Agustí-Panareda, A., Albergel, C., Arduini, G., Balsamo, G., Boussetta, S., Choulga, M., Harrigan, S., Hersbach, H., Martens, B., Miralles, D. G., Piles, M., Rodríguez-Fernández, N. J., Zsoter, E., Buontempo, C., and Thépaut, J.-N. (2021). ERA5-Land: a state-of-the-art global reanalysis dataset for land applications. Earth System Science Data, 13, 4349–4383.
This file contains daily rainfall data of Kathmandu. The source of this data is 'Government of Nepal, Department of Hydrology and Meteorology'.
ktm_rain17ktm_rain17
A data frame with 365 rows and 2 variables:
TIMEDate in YYYY-MM-DD format.
rainfalldouble rainfall in millimeters
http://www.mfd.gov.np/city?id=31/
Computes a mean detrended dendrometer series across multiple trees from the
output of dm.detrend.fit().
This is useful for creating one representative detrended series for a species, site, or treatment group after detrending individual dendrometer series.
Optionally, the function can:
calculate a robust mean using a trimmed mean across trees,
remove temporal autocorrelation from the mean detrended series using
forecast::auto.arima(),
rescale the autocorrelation-removed series so it stays non-negative and has mean = 1 within each vegetation season.
mean_detrended.dm( detrended_dm, series = NULL, ac1.remove = TRUE, robust.mean = TRUE, trim = 0.15, seasonal_rescale = TRUE )mean_detrended.dm( detrended_dm, series = NULL, ac1.remove = TRUE, robust.mean = TRUE, trim = 0.15, seasonal_rescale = TRUE )
detrended_dm |
An object of class |
series |
Optional character vector of tree/series names to include.
Default is |
ac1.remove |
Logical. If |
robust.mean |
Logical. If |
trim |
Proportion to trim from each tail when |
seasonal_rescale |
Logical. If |
A tibble of class "mean_dm_detrended" containing:
metadata columns copied from the detrended input,
STD_DDM: the mean detrended series,
RES_DDM: the autocorrelation-removed mean detrended series
(returned only when ac1.remove = TRUE).
fit1 <- dm.growth.fit( df = gf_nepa17, TreeNum = 1:2, method = "gompertz", year_mode = "yearly", verbose = FALSE ) det1 <- dm.detrend.fit(fit1) m_det <- mean_detrended.dm(det1) head(m_det, 10)fit1 <- dm.growth.fit( df = gf_nepa17, TreeNum = 1:2, method = "gompertz", year_mode = "yearly", verbose = FALSE ) det1 <- dm.detrend.fit(fit1) m_det <- mean_detrended.dm(det1) head(m_det, 10)
Calculates running correlations between a selected daily dendrometer summary and one or more climate variables. The user can select the daily dendrometer statistic, correlation method, optional bootstrap confidence intervals, and lagged / antecedent climate transformations.
mov.cor.dm( df, Clim, TreeNum, win_size, cor_method = c("pearson", "kendall", "spearman"), boot = FALSE, R = 1000, boot.ci = 0.05, set_seed = 1, dm_stat = c("mean", "min", "max", "median", "amplitude", "change"), clim_vars = NULL, lag_days = 0, accum_days = 1, clim_fun = "raw", min_complete = NULL, p_adjust_method = "BH" )mov.cor.dm( df, Clim, TreeNum, win_size, cor_method = c("pearson", "kendall", "spearman"), boot = FALSE, R = 1000, boot.ci = 0.05, set_seed = 1, dm_stat = c("mean", "min", "max", "median", "amplitude", "change"), clim_vars = NULL, lag_days = 0, accum_days = 1, clim_fun = "raw", min_complete = NULL, p_adjust_method = "BH" )
df |
A data frame with the first column containing date-time in the format
|
Clim |
A data frame with the first column containing daily date
( |
TreeNum |
Integer indicating the dendrometer series to analyze. |
win_size |
Integer giving the running window size in days. Minimum is 18. |
cor_method |
Correlation method: one of |
boot |
Logical. If |
R |
Integer number of bootstrap iterations. |
boot.ci |
Numeric confidence level selector: one of |
set_seed |
Integer seed for reproducibility of bootstrap results. |
dm_stat |
Daily dendrometer statistic used for correlation. One of
|
clim_vars |
Optional character vector of climate variables to analyze.
If |
lag_days |
Climate lag in days. Can be:
|
accum_days |
Antecedent window length in days for climate transformation. Can be scalar, per-variable, or a named numeric vector. |
clim_fun |
Climate transformation over the antecedent window. One of
|
min_complete |
Minimum number of complete paired observations required in
a running window to calculate correlation. If |
p_adjust_method |
Method for p-value adjustment in the non-bootstrap
output. Passed to |
The dendrometer series is first aggregated to daily resolution. The daily
dendrometer statistic used for correlation is controlled by dm_stat:
"mean": daily mean dendrometer value
"min": daily minimum
"max": daily maximum
"median": daily median
"amplitude": daily amplitude (max - min)
"change": day-to-day change in the daily mean
Users can choose the climate variables to analyze via clim_vars.
Climate transformation settings can be given as:
a single value applied to all selected climate variables
an unnamed vector with one value per selected climate variable
a named vector mapping each selected climate variable to its own setting
This applies to clim_fun, lag_days, and accum_days.
A list with class "mov_cor_dm" (and "mov_cor_dm_boot" if
bootstrapped) containing:
results: named list of tibbles, one per climate variable
metadata: analysis metadata
call: the matched function call
library(dendRoAnalyst) data(gf_nepa17) data(ktm_rain17) # one common climate transformation for all selected variables out_corr <- mov.cor.dm( df = gf_nepa17, Clim = ktm_rain17, TreeNum = 1, win_size = 21, clim_fun = "raw" ) print(out_corr) summary(out_corr) # variable-specific climate transformations out_varfun <- mov.cor.dm( df = gf_nepa17, Clim = ktm_rain17, TreeNum = 1, win_size = 21, clim_vars = c("rainfall"), clim_fun = c(rainfall = "sum"), lag_days = c(rainfall = 1), accum_days = c(rainfall = 7) ) # bootstrap confidence intervals out_boot <- mov.cor.dm( df = gf_nepa17, Clim = ktm_rain17, TreeNum = 1, win_size = 21, boot = TRUE, R = 250 ) summary(out_boot)library(dendRoAnalyst) data(gf_nepa17) data(ktm_rain17) # one common climate transformation for all selected variables out_corr <- mov.cor.dm( df = gf_nepa17, Clim = ktm_rain17, TreeNum = 1, win_size = 21, clim_fun = "raw" ) print(out_corr) summary(out_corr) # variable-specific climate transformations out_varfun <- mov.cor.dm( df = gf_nepa17, Clim = ktm_rain17, TreeNum = 1, win_size = 21, clim_vars = c("rainfall"), clim_fun = c(rainfall = "sum"), lag_days = c(rainfall = 1), accum_days = c(rainfall = 7) ) # bootstrap confidence intervals out_boot <- mov.cor.dm( df = gf_nepa17, Clim = ktm_rain17, TreeNum = 1, win_size = 21, boot = TRUE, R = 250 ) summary(out_boot)
Dendrometer data from three Chir pine trees collected in hourly resolution for 2 years.
nepanepa
A data frame with 14534 rows and 3 variables:
Timedatetime time of data recording
T2double reading for first tree
T3double reading for second tree
Dendrometer data from three Chir pine tree collected in hourly resolution for 2017.
nepa17nepa17
A data frame with 8753 rows and 3 variables:
Timedatetime time of data recording
T2double reading for first tree
T3double reading for second tree
Dendrometer data from three Chir pine trees collected in hourly resolution for 2 years with separated time.
nepa2nepa2
A data frame with 14534 rows and 8 variables:
yearnumeric year of data recording
monthnumeric months of data recording
daynumeric days of data recording
hoursnumeric hours of data recording
minutesnumeric minutes of data recording
secondsnumeric seconds of data recording
T2double reading for first tree
T3double reading for second tree
Fills NA gaps in one or more focal dendrometer series by borrowing
information from a reference network recorded at the same site and on the
same time grid.
The focal dataset df is treated as the master time axis. The
reference network is aligned to that axis, so missing timestamps already
inserted into df are preserved during interpolation.
Two interpolation modes are available:
niMethod = "proportional" uses the average relative change in
the reference network between consecutive timestamps and propagates that
change to the focal series.
niMethod = "linear" fits a cross-sensor regression between
reference values at time and , and predicts the focal
value at time from the focal value at time .
Optional bootstrap-based uncertainty limits can be attached, synthetic-gap validation can be used to assess recovery performance, and an optional post-processing step can detect and correct abrupt post-gap jumps in the interpolated series.
network.interpolation( df, referenceDF, niMethod = c("proportional", "linear"), n_boot = 1000, return_flags = TRUE, return_pi = TRUE, pi_for_all = FALSE, return_fit = FALSE, assess = FALSE, assess_lengths_steps = c(1, 2, 3, 6, 12, 24), assess_samples_per_length = 20, assess_buffer_steps = 1, assess_seed = NULL, assess_use_only_observed = TRUE, progress = interactive(), correct_gap_jumps = FALSE, jump_threshold = NULL, jump_adjustment_method = c("window_median", "point_diff"), jump_adjust_window = 5, jump_set_point_na = FALSE )network.interpolation( df, referenceDF, niMethod = c("proportional", "linear"), n_boot = 1000, return_flags = TRUE, return_pi = TRUE, pi_for_all = FALSE, return_fit = FALSE, assess = FALSE, assess_lengths_steps = c(1, 2, 3, 6, 12, 24), assess_samples_per_length = 20, assess_buffer_steps = 1, assess_seed = NULL, assess_use_only_observed = TRUE, progress = interactive(), correct_gap_jumps = FALSE, jump_threshold = NULL, jump_adjustment_method = c("window_median", "point_diff"), jump_adjust_window = 5, jump_set_point_na = FALSE )
df |
Data frame containing focal dendrometer data. The first column must
be datetime ( |
referenceDF |
Data frame containing reference dendrometer data. The first column must be datetime, and remaining columns are reference series. |
niMethod |
Character. Interpolation method. One of
|
n_boot |
Integer. Number of bootstrap resamples used in proportional mode. |
return_flags |
Logical. If |
return_pi |
Logical. If |
pi_for_all |
Logical. If |
return_fit |
Logical. If |
assess |
Logical. If |
assess_lengths_steps |
Integer vector. Artificial gap lengths, expressed in number of rows/time steps, to test during validation. |
assess_samples_per_length |
Integer. Number of sampled artificial gaps per gap length and per focal series. |
assess_buffer_steps |
Integer. Number of observed steps required before
and after each artificial gap when
|
assess_seed |
Integer or |
assess_use_only_observed |
Logical. If |
progress |
Logical. If |
correct_gap_jumps |
Logical. If |
jump_threshold |
Numeric. Minimum absolute jump size required before a
post-gap correction is applied. Required if
|
jump_adjustment_method |
Character. Method used to estimate the
post-gap offset. One of |
jump_adjust_window |
Integer. Window size used by
|
jump_set_point_na |
Logical. If |
The function assumes that missing timestamps have already been inserted into
df and corresponding measurements set to NA, for example with
dm.na.interpolation.
For a focal series , let be the last available focal
value before the current timestamp. Let and be the
vectors of reference values at the previous and current timestamps.
In proportional mode, the relative reference change is
and the focal estimate is
Bootstrap resampling of reference sensors is used to estimate a 95% interval.
In linear mode, a simple regression of on is fit
across reference sensors at each step, and the focal value is predicted from
with a 95% prediction interval.
If fewer than two valid reference sensors are available at a timestamp pair, or if the focal previous value is missing, the focal value is left unchanged.
If correct_gap_jumps = TRUE, the function inspects the first observed
point immediately after each imputed run. If a jump larger than
jump_threshold is detected, the estimated offset is removed from that
point onward. This is useful when a dendrometer resumes from a shifted
baseline after a gap.
If assess = TRUE, the function inserts artificial gaps into observed
sections of each focal series, interpolates them with the chosen method, and
compares predictions with the true values. This produces both per-gap
summaries and seasonal diagnostics of interpolation error.
The returned object is a data frame with class
"network_interpolation".
A data frame with class "network_interpolation".
The data frame contains the original TIME column, focal series
columns, and optionally:
<series>_interpLogical flag for imputed rows.
<series>_pi_lo, <series>_pi_hi
95% prediction limits.
<series>_fitModel-implied fitted values.
<series>_jump_correctionNumeric jump offset removed at the
first observed point after an imputed run. NA means no correction
was applied.
In addition, the following attributes are attached:
network_originalOriginal focal data on the aligned time grid.
network_referenceReference data aligned to the focal time grid.
network_diagnosticsLong-format diagnostics for plotting.
network_summaryPer-series interpolation summary table.
network_jump_correctionsTable of inspected and corrected post-gap jumps.
network_validation_rawPer-gap validation summary table, or
NULL.
network_validation_pointsPoint-level validation results, or
NULL.
network_validation_summarySummarized validation metrics by
series and gap length, or NULL.
network_validation_seasonalSeasonal validation diagnostics
by day of year, or NULL.
network_methodInterpolation method used.
network_n_bootNumber of bootstrap resamples used.
network_assessedLogical indicating whether validation was run.
network_jump_settingsList of jump-correction settings.
Smaller validation metrics such as MAE, RMSE, MAPE, and
MdAPE indicate better gap recovery. PI_coverage_95 indicates
how well the nominal 95% uncertainty interval captures the true values
under synthetic-gap validation. Seasonal diagnostics help identify periods
of the year when network interpolation is more or less reliable.
If many post-gap corrections are applied or max_abs_gap_jump is
large, it may indicate re-zeroing, sensor reset, or baseline
discontinuities after gaps.
The focal dataset df defines the output time grid.
Reference series are aligned to that grid using the datetime column.
At least two valid reference sensors are required at consecutive timestamps for interpolation.
Jump correction is a post-processing step and does not alter the core interpolation logic.
plot.network_interpolation,
dm.na.interpolation
#library(dendRoAnalyst) #data("gf_nepa17") ## Create an artificial focal gap #df1 <- gf_nepa17 #df1[40:50, "T2"] <- NA ## Build a small reference network #ref <- cbind(gf_nepa17, gf_nepa17[, 2:3], gf_nepa17[, 2:3]) #colnames(ref) <- c("Time", "T1", "T2", "T3", "T4", "T5", "T6") ## Interpolate with uncertainty limits #out <- network.interpolation( # df1, ref, # niMethod = "proportional", # n_boot = 100, # return_flags = TRUE, # return_pi = TRUE #) #head(out, 10) # Interpolate with jump correction and validation #out2 <- network.interpolation( # df1, ref, # niMethod = "proportional", # n_boot = 100, # return_flags = TRUE, # return_pi = TRUE, # assess = TRUE, # assess_lengths_steps = c(1, 2, 4), # correct_gap_jumps = TRUE, # jump_threshold = 0.05, # jump_adjustment_method = "window_median", # jump_adjust_window = 5 #) # Plotting #plot(out2) #plot(out2, type = "compare") #plot(out2, type = "seasonal_error") # Extracting the information using attr() #attr(out, "network_validation_summary") #attr(out, "network_validation_points") #attr(out, "network_validation_seasonal")#library(dendRoAnalyst) #data("gf_nepa17") ## Create an artificial focal gap #df1 <- gf_nepa17 #df1[40:50, "T2"] <- NA ## Build a small reference network #ref <- cbind(gf_nepa17, gf_nepa17[, 2:3], gf_nepa17[, 2:3]) #colnames(ref) <- c("Time", "T1", "T2", "T3", "T4", "T5", "T6") ## Interpolate with uncertainty limits #out <- network.interpolation( # df1, ref, # niMethod = "proportional", # n_boot = 100, # return_flags = TRUE, # return_pi = TRUE #) #head(out, 10) # Interpolate with jump correction and validation #out2 <- network.interpolation( # df1, ref, # niMethod = "proportional", # n_boot = 100, # return_flags = TRUE, # return_pi = TRUE, # assess = TRUE, # assess_lengths_steps = c(1, 2, 4), # correct_gap_jumps = TRUE, # jump_threshold = 0.05, # jump_adjustment_method = "window_median", # jump_adjust_window = 5 #) # Plotting #plot(out2) #plot(out2, type = "compare") #plot(out2, type = "seasonal_error") # Extracting the information using attr() #attr(out, "network_validation_summary") #attr(out, "network_validation_points") #attr(out, "network_validation_seasonal")
Implements the stem-cycle approach (Downes et al., 1999; Deslauriers et al., 2011) to divide a dendrometer time series into three biologically meaningful phases:
Shrinkage (phase = 1): the dendrometer reading decreases compared to the previous reading.
Expansion (phase = 2): the dendrometer reading increases compared to the previous reading, but remains below the previous maximum.
Increment (phase = 3): the dendrometer reading exceeds the previous maximum (irreversible stem growth).
For each contiguous phase, the function calculates duration, magnitude, rate, and assigns day-of-year information. Optionally, the dendrometer series may be smoothed before phase calculation to reduce noise and spurious phase changes.
phase.sc(df, TreeNum, smoothing = NULL)phase.sc(df, TreeNum, smoothing = NULL)
df |
A data frame with the first column containing date-time in the format
|
TreeNum |
Integer. The index of the dendrometer column to analyze.
For example, |
smoothing |
Numeric or |
Classification uses the cumulative maximum of the dendrometer series:
If the cumulative maximum increases, the phase is labeled Increment (3).
If the cumulative maximum is constant and the first difference is positive, the phase is Expansion (2).
If the cumulative maximum is constant and the first difference is negative, the phase is Shrinkage (1).
The function returns both phase-level summaries (SC_cycle) and point-level
labels (SC_phase). Optional smoothing uses smooth_dm with
method = "median_mean" and a window length between 1–24 hours.
A list of class "SC_output" containing:
A tibble with one row per contiguous phase, including:
Phases – Phase type (1 = Shrinkage, 2 = Expansion, 3 = Increment)
Start, End – POSIXct start and end time of the phase
Duration_h, Duration_m – Phase duration (hours, minutes)
Magnitude – Change in dendrometer value during the phase (measurement unit)
rate – Rate of change expressed in (Magnitude*1000/Duration_h) (eg. m/hour)
DOY – Day-of-year at phase start
A tibble of point-level values including:
TIME – timestamp
dm – dendrometer measurement
Phases – phase assignment for each timestamp
Deslauriers A, Rossi S, Turcotte A, Morin H, Krause C (2011) A three-step procedure in SAS to analyze the time series from automatic dendrometers. Dendrochronologia 29:151–161. doi:10.1016/j.dendro.2011.01.008
Downes G, Beadle C, Worledge D (1999) Daily stem growth patterns in irrigated Eucalyptus globulus and E. nitens in relation to climate. Trees 14:102–111. doi:10.1007/PL00009752
phase.zg for the zero-growth approach;
smooth_dm for smoothing dendrometer series.
library(dendRoAnalyst) data(gf_nepa17) # Apply stem-cycle approach without smoothing sc1 <- phase.sc(df = gf_nepa17, TreeNum = 1) head(sc1$SC_cycle, 5) head(sc1$SC_phase, 5) # Apply with 12-hour smoothing to reduce noise sc2 <- phase.sc(df = gf_nepa17, TreeNum = 1, smoothing = 12) head(sc2$SC_cycle, 5)library(dendRoAnalyst) data(gf_nepa17) # Apply stem-cycle approach without smoothing sc1 <- phase.sc(df = gf_nepa17, TreeNum = 1) head(sc1$SC_cycle, 5) head(sc1$SC_phase, 5) # Apply with 12-hour smoothing to reduce noise sc2 <- phase.sc(df = gf_nepa17, TreeNum = 1, smoothing = 12) head(sc2$SC_cycle, 5)
Implements the Zero-Growth approach (Zweifel et al., 2016) on a single dendrometer series to (i) classify each timestamp into tree water deficit (TWD; reversible shrinkage/expansion) or growth (GRO; irreversible expansion), (ii) summarize each contiguous phase (start/end, duration, magnitude, rates, TWD statistics), and (iii) optionally smooth the raw series prior to phase assignment to reduce spurious phase flips.
The growth line is computed as the running cumulative maximum of the (raw or smoothed) dendrometer series. TWD is defined as the vertical distance between the growth line and the observed measurement.
phase.zg(df, TreeNum, smoothing = NULL, beta = 0.1)phase.zg(df, TreeNum, smoothing = NULL, beta = 0.1)
df |
A data frame with the first column containing date-time
(character, |
TreeNum |
Integer index of the dendrometer series column to analyze.
For example, |
smoothing |
|
beta |
Numeric scalar giving the exponent applied to the effective loading
duration in the ABr formula. Defaults to |
Phase assignment.
Let be the dendrometer measurement (raw or smoothed). The growth
line is . Points with are labeled
GRO (phase = 2). Points with are labeled TWD
(phase = 1). Contiguous runs of identical labels are summarized into
individual phases.
Summaries per phase (ZG_cycle). For each phase, the function returns:
Phases (1 = TWD, 2 = GRO)
Start, End (POSIXct)
Duration_h (hours)
Magnitude (mm): for GRO only, computed from the growth line
as ; NA for TWD
rate (m/h): Magnitude * 1000 / Duration_h (GRO only)
max.twd (mm), Max.twd.time (POSIXct): peak TWD and its time (TWD only)
Avg.twd (mm), STD.twd (mm): mean and SD of TWD within the phase (TWD only)
AUC.load (mm*h): area under the TWD curve from phase start to Max.twd.time (TWD only)
AUC.total (mm*h): area under the full TWD curve across the phase (TWD only)
DOY: day-of-year of the phase start
ABr.value: Absolut Baumreaktion (ABr) for TWD phases, defined here as
returned as NA for GRO phases. This metric anchors severity on the event peak while
allowing the loading duration to contribute with exponent beta.
Point-level output (ZG_phase). The second element returns the input time series augmented with:
Phases (1/2), TWD (= GRO - dm), and GRO (growth line).
Smoothing (optional).
If smoothing is provided (hours), the function uses
smooth_dm(..., method = "median_mean", window_hours = smoothing) to create a
smoothed series used only for phase assignment; all magnitudes and TWD
statistics are still computed against the original dm. This reduces
short-lived phase flips due to noise. Valid range is 1–24 hours.
Temporal resolution. The function auto-detects the median sampling interval (in minutes) to parameterize smoothing. If multiple distinct intervals are detected, a warning is emitted (results may be degraded if resolution is inconsistent).
Notes & caveats.
Negative Magnitude values in GRO phases indicate residual noise or
insufficient smoothing; a warning is issued.
Very short phases may occur around local extrema; consider smoothing or post-filtering minimal run lengths upstream if needed.
Ensure timestamps are regular (or nearly regular) for best results.
A named list of class "ZG_output" with two tibbles:
ZG_cycle: one row per contiguous phase with columns
Phases, Start, End, Duration_h, Magnitude, rate,
max.twd, Max.twd.time, AUC.load, AUC.total, ABr.value,
Avg.twd, STD.twd, DOY.
ZG_phase: point-level data with columns
TIME, dm, Phases, TWD, GRO.
Integer; 1 = TWD (reversible shrinkage/expansion), 2 = GRO (irreversible expansion).
POSIXct; phase boundaries.
Numeric; phase duration in hours.
Numeric; GRO-only millimeter change of growth line across the phase. NA for TWD.
Numeric; GRO-only rate in (Magnitude*1000/Duration_h).
Numeric; peak TWD within the TWD phase.
POSIXct; time of max.twd within the TWD phase.
Numeric; pre-peak area under the TWD curve in mm*h, integrated from
phase start to Max.twd.time.
Numeric; total area under the TWD curve in mm*h across the full TWD phase.
Numeric; Absolut Baumreaktion value for TWD phases,
NA for GRO.
Numeric; mean and standard deviation of TWD in the phase.
Integer; day-of-year for the phase start.
Zweifel R, Haeni M, Buchmann N, Eugster W (2016) Are trees able to grow in periods of stem shrinkage? New Phytologist, 211:839–849. doi:10.1111/nph.13995
library(dendRoAnalyst) data(gf_nepa17) # Minimal example (no smoothing) zg <- phase.zg(df = gf_nepa17[1:600, ], TreeNum = 1) head(zg$ZG_cycle, 5) head(zg$ZG_phase, 5) # With smoothing (e.g., 6 hours) to reduce short flips zg6 <- phase.zg(df = gf_nepa17[1:600, ], TreeNum = 1, smoothing = 6, beta = 0.1) subset(zg6$ZG_cycle, Phases == 1L)[1:5, c("Start","End","max.twd","ABr.value")]library(dendRoAnalyst) data(gf_nepa17) # Minimal example (no smoothing) zg <- phase.zg(df = gf_nepa17[1:600, ], TreeNum = 1) head(zg$ZG_cycle, 5) head(zg$ZG_phase, 5) # With smoothing (e.g., 6 hours) to reduce short flips zg6 <- phase.zg(df = gf_nepa17[1:600, ], TreeNum = 1, smoothing = 6, beta = 0.1) subset(zg6$ZG_cycle, Phases == 1L)[1:5, c("Start","End","max.twd","ABr.value")]
Plot interpolation assessment metrics
plot_dm_assessment(x, metric = "MdAPE", series = NULL, facet = TRUE)plot_dm_assessment(x, metric = "MdAPE", series = NULL, facet = TRUE)
x |
Object returned by |
metric |
Character. One of:
|
series |
Optional character vector of series names to plot. |
facet |
Logical. If |
A ggplot2 object.
#res <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "seasonal", # assess = TRUE #) #plot_dm_assessment(res, metric = "MdAPE")#res <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "seasonal", # assess = TRUE #) #plot_dm_assessment(res, metric = "MdAPE")
Plot detected gaps in dendrometer data
plot_dm_gaps(x, series = NULL, empty_gaps = c("plot", "error"))plot_dm_gaps(x, series = NULL, empty_gaps = c("plot", "error"))
x |
Object returned by |
series |
Optional character vector of series names to plot. |
empty_gaps |
Character. Behavior when no gaps are present:
|
A ggplot2 object.
#res <- dm.na.interpolation(nepa17[1:1000, ], resolution = 60) #plot_dm_gaps(res)#res <- dm.na.interpolation(nepa17[1:1000, ], resolution = 60) #plot_dm_gaps(res)
Plot original and interpolated dendrometer series
plot_dm_interpolation( x, original = NULL, series = NULL, start = NULL, end = NULL, free_y = TRUE, ncol = 1 )plot_dm_interpolation( x, original = NULL, series = NULL, start = NULL, end = NULL, free_y = TRUE, ncol = 1 )
x |
Object returned by |
original |
Optional original input data frame used in
|
series |
Optional character vector of series names to plot. |
start |
Optional start datetime for plotting subset. |
end |
Optional end datetime for plotting subset. |
free_y |
Logical. If |
ncol |
Integer. Number of facet columns. |
A ggplot2 object.
#res <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "spline" #) #plot_dm_interpolation(res, original = nepa17[1:1000, ])#res <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "spline" #) #plot_dm_interpolation(res, original = nepa17[1:1000, ])
Draws boxplots or violins of event-based climate variables across phases or event types, with optional significance annotation.
plot_event_climate_box( event_data, climate_var, group_var = c("Phase", "event_type"), facet_by = c("none", "month", "month_of_year", "year"), Year = NULL, DOY = NULL, geom = c("boxplot", "violin", "both"), add_test = TRUE, test_method = c("auto", "anova", "kruskal", "t.test", "wilcox"), point_alpha = 0.5 )plot_event_climate_box( event_data, climate_var, group_var = c("Phase", "event_type"), facet_by = c("none", "month", "month_of_year", "year"), Year = NULL, DOY = NULL, geom = c("boxplot", "violin", "both"), add_test = TRUE, test_method = c("auto", "anova", "kruskal", "t.test", "wilcox"), point_alpha = 0.5 )
event_data |
Output of |
climate_var |
Name of the climate-derived column to plot. |
group_var |
Grouping variable. One of |
facet_by |
One of |
Year |
Optional numeric year or vector of years for filtering. |
DOY |
Optional numeric vector of length 2 for filtering. |
geom |
One of |
add_test |
Logical. If |
test_method |
Passed to |
point_alpha |
Point transparency. |
A ggplot2 object.
data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_zg <- dm_event_climate( zg, ktm_clim_hourly, event = "phase_start", windows = c(0, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) if (any(!is.na(evt_zg$VPD_mean_prev_6h))) { plot_event_climate_box( evt_zg, climate_var = "VPD_mean_prev_6h", group_var = "Phase", facet_by = "month_of_year", geom = "both", add_test = TRUE ) }data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_zg <- dm_event_climate( zg, ktm_clim_hourly, event = "phase_start", windows = c(0, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) if (any(!is.na(evt_zg$VPD_mean_prev_6h))) { plot_event_climate_box( evt_zg, climate_var = "VPD_mean_prev_6h", group_var = "Phase", facet_by = "month_of_year", geom = "both", add_test = TRUE ) }
Draws a scatterplot between an event-based climate variable and a response variable and annotates the fitted linear relationship with R², slope, and p-value.
plot_event_climate_relation( event_data, climate_var, response_var, group_var = NULL, Year = NULL, DOY = NULL, add_smooth = TRUE, point_alpha = 0.7 )plot_event_climate_relation( event_data, climate_var, response_var, group_var = NULL, Year = NULL, DOY = NULL, add_smooth = TRUE, point_alpha = 0.7 )
event_data |
Output of |
climate_var |
Name of the climate-derived column. |
response_var |
Name of the response variable. |
group_var |
Optional grouping variable for color. |
Year |
Optional numeric year or vector of years for filtering. |
DOY |
Optional numeric vector of length 2 for filtering. |
add_smooth |
Logical. If |
point_alpha |
Point transparency. |
A ggplot2 object.
data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_maxtwd <- dm_event_climate( zg, ktm_clim_hourly, event = "max_twd", windows = c(0, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) if (all(c("VPD_mean_prev_6h", "max.twd") %in% names(evt_maxtwd)) && any(is.finite(evt_maxtwd$VPD_mean_prev_6h)) && any(is.finite(evt_maxtwd$max.twd))) { plot_event_climate_relation( evt_maxtwd, climate_var = "VPD_mean_prev_6h", response_var = "max.twd", group_var = "Phase" ) }data(gf_nepa17) data(ktm_clim_hourly) zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1) evt_maxtwd <- dm_event_climate( zg, ktm_clim_hourly, event = "max_twd", windows = c(0, 3, 6, 12, 24), mean_vars = c("temp", "VPD", "RH"), max_vars = c("VPD"), sum_vars = c("prec") ) if (all(c("VPD_mean_prev_6h", "max.twd") %in% names(evt_maxtwd)) && any(is.finite(evt_maxtwd$VPD_mean_prev_6h)) && any(is.finite(evt_maxtwd$max.twd))) { plot_event_climate_relation( evt_maxtwd, climate_var = "VPD_mean_prev_6h", response_var = "max.twd", group_var = "Phase" ) }
Wrapper around plot() for objects returned by mov.cor.dm().
plot_mov.cor(mov.cor.output, ...)plot_mov.cor(mov.cor.output, ...)
mov.cor.output |
Output of |
... |
Passed to |
A ggplot2 object.
Plots grouped trajectories or grouped ID-level metrics from
clim.twd.stats().
## S3 method for class 'clim_twd_stats' plot( x, y = NULL, type = c("trajectory", "id_metric"), ids = NULL, groups = NULL, band = c("none", "sd", "limit95", "both"), metric = c("lag_to_below_zero", "lag_to_max_adverse_decline", "lag_to_return_zero", "max_adverse_decline_value", "change_end_adverse", "change_end_full_period", "continuous_end_full_period"), facet_by = c("IDs", "group", "none"), legend_position = "bottom", main = NULL, ... )## S3 method for class 'clim_twd_stats' plot( x, y = NULL, type = c("trajectory", "id_metric"), ids = NULL, groups = NULL, band = c("none", "sd", "limit95", "both"), metric = c("lag_to_below_zero", "lag_to_max_adverse_decline", "lag_to_return_zero", "max_adverse_decline_value", "change_end_adverse", "change_end_full_period", "continuous_end_full_period"), facet_by = c("IDs", "group", "none"), legend_position = "bottom", main = NULL, ... )
x |
An object of class |
y |
Unused. |
type |
One of |
ids |
Optional numeric vector of IDs to plot. |
groups |
Optional character vector of group labels to plot. |
band |
One of |
metric |
Metric column from |
facet_by |
One of |
legend_position |
Legend position. |
main |
Optional title. |
... |
Further arguments passed to or from other methods. |
A ggplot2 object.
Plots the data used in clim.twd.test() as grouped boxplots with jittered
observations, faceted by stratum when applicable.
## S3 method for class 'clim_twd_test' plot( x, y = NULL, show_points = TRUE, facet = TRUE, legend_position = "none", main = NULL, ... )## S3 method for class 'clim_twd_test' plot( x, y = NULL, show_points = TRUE, facet = TRUE, legend_position = "none", main = NULL, ... )
x |
An object of class |
y |
Unused. |
show_points |
Logical. If |
facet |
Logical. If |
legend_position |
Legend position. |
main |
Optional plot title. |
... |
Further arguments passed to or from other methods. |
A ggplot2 object.
Unified S3 plotting method for objects returned by daily.data().
Missing grouping labels are removed before grouped boxplots are drawn so
NA does not appear on the x-axis.
## S3 method for class 'daily_output' plot( x, y = NULL, Year = NULL, DOY = NULL, type = c("summary", "amplitude", "minmax_ribbon", "timing", "timing_violin", "lag", "change", "boxplot", "heatmap"), stat = c("amplitude", "Max_diff", "mean", "median", "Max", "Min", "lag_h", "Time_min_h", "Time_max_h"), by = c("month", "month_of_year", "year"), box_style = c("boxplot", "violin", "both"), status_cols = c(growing = "forestgreen", shrinking = "firebrick", stable = "grey60"), timing_segment_cols = c(`max after min` = "grey65", `max before/equal min` = "black"), ... )## S3 method for class 'daily_output' plot( x, y = NULL, Year = NULL, DOY = NULL, type = c("summary", "amplitude", "minmax_ribbon", "timing", "timing_violin", "lag", "change", "boxplot", "heatmap"), stat = c("amplitude", "Max_diff", "mean", "median", "Max", "Min", "lag_h", "Time_min_h", "Time_max_h"), by = c("month", "month_of_year", "year"), box_style = c("boxplot", "violin", "both"), status_cols = c(growing = "forestgreen", shrinking = "firebrick", stable = "grey60"), timing_segment_cols = c(`max after min` = "grey65", `max before/equal min` = "black"), ... )
x |
Object of class |
y |
Unused. |
Year |
Optional numeric year or vector of years for subsetting. |
DOY |
Optional numeric vector of length 2 giving the start and end day-of-year for subsetting. |
type |
Plot type. One of
|
stat |
Statistic used for |
by |
Grouping for |
box_style |
Style for |
status_cols |
Colors for |
timing_segment_cols |
Named vector of two colors for the timing connector:
one for |
... |
Unused. |
Plot types:
"summary": daily Min, mean, median, and Max.
"amplitude": daily amplitude through time.
"minmax_ribbon": ribbon between daily Min and Max.
"timing": per-day line connecting daily minimum and maximum timing.
"timing_violin": violin distribution of Time_min_h
and Time_max_h for the selected window.
"lag": signed lag between daily maximum and minimum time.
"change": day-to-day change in daily maximum
Max_diff.
"boxplot": grouped distributions of a chosen daily statistic.
For by = "month", monthly groups are plotted on a continuous
date axis. The axis limits are extended beyond the first and last
plotted month so edge months are not clipped.
"heatmap": year x day-of-year heatmap of a chosen daily statistic.
For type = "timing", the red and blue points are not connected across
days. Instead, each day has its own segment connecting minimum and maximum
time.
A ggplot2 object, returned invisibly.
data(nepa17) dd <- daily.data(df = nepa17[1:1000, ], TreeNum = 1) plot(dd) plot(dd, type = "timing") plot(dd, type = "timing", Year = 2017, DOY = c(1, 6)) plot(dd, type = "timing_violin", Year = 2017, DOY = c(1, 6)) plot(dd, type = "boxplot", stat = "amplitude", by = "month") plot(dd, type = "boxplot", stat = "amplitude", by = "month_of_year", box_style = "both") plot(dd, type = "change")data(nepa17) dd <- daily.data(df = nepa17[1:1000, ], TreeNum = 1) plot(dd) plot(dd, type = "timing") plot(dd, type = "timing", Year = 2017, DOY = c(1, 6)) plot(dd, type = "timing_violin", Year = 2017, DOY = c(1, 6)) plot(dd, type = "boxplot", stat = "amplitude", by = "month") plot(dd, type = "boxplot", stat = "amplitude", by = "month_of_year", box_style = "both") plot(dd, type = "change")
S3 plotting method for objects of class daily_output_clim. This allows
climate-augmented daily dendrometer outputs to be visualized directly with
the generic plot() function.
## S3 method for class 'daily_output_clim' plot( x, y = NULL, ..., climate_var = NULL, climate_vars = NULL, numeric_vars = NULL, compare = FALSE, temporal = NULL )## S3 method for class 'daily_output_clim' plot( x, y = NULL, ..., climate_var = NULL, climate_vars = NULL, numeric_vars = NULL, compare = FALSE, temporal = NULL )
x |
An object of class |
y |
Optional climate variable name passed as the second argument. |
... |
Additional arguments passed to |
climate_var |
Character. Name of one climate variable to plot. |
climate_vars |
Character vector of climate variables for comparison plots. |
numeric_vars |
Character vector of numeric variables used for correlation or regression heatmaps. |
compare |
Logical. If |
temporal |
Deprecated argument kept for compatibility with older examples. It is ignored. |
A ggplot2 object, returned invisibly.
# plot(daily_clim_output, climate_var = "temp_mean", type = "timeseries")# plot(daily_clim_output, climate_var = "temp_mean", type = "timeseries")
S3 plotting method for objects returned by [dm.detrend.fit()].
The default plot compares:
original daily dendrometer series,
fitted curve reconstructed on the original daily scale,
residuals ('observed - fitted_original'),
detrended standardized series.
## S3 method for class 'dm_detrended' plot( x, y = NULL, type = c("compare", "fit", "residual", "detrended", "boxplot"), series = NULL, seasons = NULL, x_axis = c("default", "date", "season_day", "doy"), facet_by = c("series", "season", "none"), ncol = NULL, box_group = c("series", "season"), show_observed = TRUE, show_fitted = TRUE, point_alpha = 0.7, line_width = 0.8, legend_position = "right", ... )## S3 method for class 'dm_detrended' plot( x, y = NULL, type = c("compare", "fit", "residual", "detrended", "boxplot"), series = NULL, seasons = NULL, x_axis = c("default", "date", "season_day", "doy"), facet_by = c("series", "season", "none"), ncol = NULL, box_group = c("series", "season"), show_observed = TRUE, show_fitted = TRUE, point_alpha = 0.7, line_width = 0.8, legend_position = "right", ... )
x |
An object of class |
y |
Unused. |
type |
Plot type. One of:
|
series |
Optional character vector of dendrometer series to plot.
Default is |
seasons |
Optional character vector of vegetation-season labels to plot.
Default is |
x_axis |
Character string controlling the x-axis. One of:
|
facet_by |
Character string controlling faceting. One of:
|
ncol |
Optional integer giving the number of columns in faceted plots where [ggplot2::facet_wrap()] is used. |
box_group |
For |
show_observed |
Logical. If |
show_fitted |
Logical. If |
point_alpha |
Numeric alpha level used for observed points. Default is
|
line_width |
Numeric line width used for fitted, residual, and detrended
lines. Default is |
legend_position |
Character string specifying legend position.
Default is |
... |
Further arguments passed to or from other methods. |
A ggplot2 object.
fit1 <- dm.growth.fit( df = gf_nepa17, TreeNum = 1:2, method = "gompertz", year_mode = "yearly", verbose = FALSE ) det1 <- dm.detrend.fit(fit1) plot(det1) plot(det1, type = "fit") plot(det1, type = "residual") plot(det1, type = "detrended") plot(det1, type = "boxplot") plot(det1, type = "compare", facet_by = "series") plot(det1, type = "compare", facet_by = "season")fit1 <- dm.growth.fit( df = gf_nepa17, TreeNum = 1:2, method = "gompertz", year_mode = "yearly", verbose = FALSE ) det1 <- dm.detrend.fit(fit1) plot(det1) plot(det1, type = "fit") plot(det1, type = "residual") plot(det1, type = "detrended") plot(det1, type = "boxplot") plot(det1, type = "compare", facet_by = "series") plot(det1, type = "compare", facet_by = "season")
Plot a dm_epoch object
## S3 method for class 'dm_epoch' plot( x, y = NULL, type = c("composite", "heatmap", "difference"), variables = NULL, facet = TRUE, show_ci = TRUE, legend_position = "right", ... )## S3 method for class 'dm_epoch' plot( x, y = NULL, type = c("composite", "heatmap", "difference"), variables = NULL, facet = TRUE, show_ci = TRUE, legend_position = "right", ... )
x |
Object of class |
y |
Unused. |
type |
Plot type. One of |
variables |
Optional climate variables to plot. |
facet |
Logical. If |
show_ci |
Logical. If |
legend_position |
Legend position passed to [ggplot2::theme()]. |
... |
Unused. |
A ggplot object.
Creates ggplot2-based comparison plots for objects returned by [dm.growth.evaluate()].
## S3 method for class 'dm_growth_evaluation' plot( x, metric = c("rmse", "mae", "bias", "abs_bias", "r2", "correlation", "nrmse", "rss", "aic_approx", "bic_approx"), type = c("boxplot", "mean", "heatmap"), order_methods = TRUE, decreasing = NULL, show_points = TRUE, show_errorbar = TRUE, heatmap_label = c("series_fit", "series", "fit_id"), na.rm = TRUE, ... )## S3 method for class 'dm_growth_evaluation' plot( x, metric = c("rmse", "mae", "bias", "abs_bias", "r2", "correlation", "nrmse", "rss", "aic_approx", "bic_approx"), type = c("boxplot", "mean", "heatmap"), order_methods = TRUE, decreasing = NULL, show_points = TRUE, show_errorbar = TRUE, heatmap_label = c("series_fit", "series", "fit_id"), na.rm = TRUE, ... )
x |
An object of class |
metric |
Evaluation metric to plot. One of |
type |
Plot type. One of |
order_methods |
Logical. If |
decreasing |
Logical or |
show_points |
Logical. If |
show_errorbar |
Logical. If |
heatmap_label |
Character string used to label rows in the heatmap. One
of |
na.rm |
Logical. If |
... |
Further arguments passed to plotting methods. |
A ggplot object.
[dm.growth.evaluate()]
Creates ggplot2-based plots for objects returned by [dm.growth.fit()] and [dm.growth.fit.double()].
The plotting method supports multiple views of fitted dendrometer growth curves, including observed versus fitted trajectories, residuals, timing summaries, overlays of multiple curves, and distributions of fitted model parameters.
The x-axis can be displayed as vegetation-season day, calendar day-of-year
(DOY), or actual date, depending on the selected x_axis argument and
the type of plot.
When x_axis = "date" and faceting separates individual years or
series-year combinations, each facet receives its own x-axis range. This
avoids plotting one yearly fitted curve inside the full dendrometer time
window when several seasons are present in the input object.
## S3 method for class 'dm_growth_fit' plot( x, type = c("fit", "season", "residuals", "timing", "overlay", "parameters"), series = NULL, fit_id = NULL, facet_by = c("default", "tree", "year", "none"), ncol = NULL, normalize = FALSE, x_axis = c("default", "season_day", "doy", "date"), observed_source = c("processed", "original_daily"), show_observed = TRUE, show_fitted = TRUE, show_timing = TRUE, point_alpha = 0.7, line_width = 0.8, legend_position = "right", ... )## S3 method for class 'dm_growth_fit' plot( x, type = c("fit", "season", "residuals", "timing", "overlay", "parameters"), series = NULL, fit_id = NULL, facet_by = c("default", "tree", "year", "none"), ncol = NULL, normalize = FALSE, x_axis = c("default", "season_day", "doy", "date"), observed_source = c("processed", "original_daily"), show_observed = TRUE, show_fitted = TRUE, show_timing = TRUE, point_alpha = 0.7, line_width = 0.8, legend_position = "right", ... )
x |
An object of class |
type |
Character string specifying the plot type. One of
|
series |
Optional filter selecting one or more dendrometer series to
plot. May be a character vector of series names. Default is |
fit_id |
Optional filter selecting one or more fit identifiers to plot.
May be a character or numeric vector. Numeric values are coerced internally
to character. Default is |
facet_by |
Character string controlling faceting layout. One of
|
ncol |
Optional integer giving the number of columns in faceted plots. Passed to [ggplot2::facet_wrap()]. |
normalize |
Logical. If |
x_axis |
Character string controlling the x-axis representation. One of
|
observed_source |
Character string controlling which observed daily
series is plotted against the fitted curve. One of |
show_observed |
Logical. If |
show_fitted |
Logical. If |
show_timing |
Logical. If |
point_alpha |
Numeric alpha level used for observed points. |
line_width |
Numeric line width used for fitted curves. |
legend_position |
Character string specifying legend position, passed to [ggplot2::theme()]. |
... |
Further arguments passed to or from other methods. |
The plotting method returns a ggplot object. The returned plot can be
further modified using normal ggplot2 syntax.
Timing markers are taken from the fit_statistics table inside the
"dm_growth_fit" object:
growth_start_* and growth_end_* represent growing-season
timing based on cumulative fitted growth.
rate_start_* and rate_end_* represent active-growth
timing based on the fitted growth-rate curve.
For double-growth fits, pulse-specific timing such as
pulse1_start_*, pulse2_start_*, and separator_* is
used in type = "timing" when available.
For yearly fits in southern hemisphere or cross-year custom seasons,
calendar timing variables such as growth_start_day and
rate_start_day are interpreted as true calendar DOY, while
*_season_day variables represent day counts relative to vegetation
season start.
In pooled fits, date-based and calendar-DOY timing fields may be unavailable, because pooled fits are not anchored to a single season start date.
A ggplot object.
[dm.growth.fit()], [dm.growth.fit.double()], [summary.dm_growth_fit()]
# fit <- dm.growth.fit(...) # plot(fit, type = "fit") # plot(fit, type = "fit", facet_by = "year", x_axis = "date") # plot(fit, type = "fit", facet_by = "year", x_axis = "season_day") # plot(fit, type = "residuals", facet_by = "year") # plot(fit, type = "timing") # plot(fit, type = "parameters")# fit <- dm.growth.fit(...) # plot(fit, type = "fit") # plot(fit, type = "fit", facet_by = "year", x_axis = "date") # plot(fit, type = "fit", facet_by = "year", x_axis = "season_day") # plot(fit, type = "residuals", facet_by = "year") # plot(fit, type = "timing") # plot(fit, type = "parameters")
S3 plot method for objects returned by dm.na.interpolation.
## S3 method for class 'dm_na_interpolation' plot( x, type = NULL, series = NULL, metric = "MdAPE", original = NULL, start = NULL, end = NULL, free_y = TRUE, ncol = 1, facet = TRUE, empty_gaps = c("plot", "error"), ... )## S3 method for class 'dm_na_interpolation' plot( x, type = NULL, series = NULL, metric = "MdAPE", original = NULL, start = NULL, end = NULL, free_y = TRUE, ncol = 1, facet = TRUE, empty_gaps = c("plot", "error"), ... )
x |
Object returned by |
type |
Character. Plot type:
|
series |
Optional character vector of series names to plot. |
metric |
Character assessment metric used when |
original |
Optional original input data frame used before interpolation. |
start |
Optional start datetime for subsetting. |
end |
Optional end datetime for subsetting. |
free_y |
Logical. If |
ncol |
Integer. Number of facet columns. |
facet |
Logical. If |
empty_gaps |
Character. Behavior when |
... |
Further arguments. |
A ggplot2 object.
library(dendRoAnalyst) data(nepa17) ## No gaps: defaults to time-series plot #res0 <- dm.na.interpolation(nepa17[1:1000, ], resolution = 60) #plot(res0) #plot(res0, type = "gaps") #plot(res0, type = "gaps", empty_gaps = "error") ## Filled data #res1 <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "spline" #) #plot(res1) #plot(res1, type = "gaps") #plot(res1, type = "interpolation", original = nepa17[1:1000, ]) ## Assessed data #res2 <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "seasonal", # assess = TRUE #) #plot(res2) #plot(res2, type = "assessment", metric = "MdAPE")library(dendRoAnalyst) data(nepa17) ## No gaps: defaults to time-series plot #res0 <- dm.na.interpolation(nepa17[1:1000, ], resolution = 60) #plot(res0) #plot(res0, type = "gaps") #plot(res0, type = "gaps", empty_gaps = "error") ## Filled data #res1 <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "spline" #) #plot(res1) #plot(res1, type = "gaps") #plot(res1, type = "interpolation", original = nepa17[1:1000, ]) ## Assessed data #res2 <- dm.na.interpolation( # nepa17[1:1000, ], # resolution = 60, # fill = TRUE, # method = "seasonal", # assess = TRUE #) #plot(res2) #plot(res2, type = "assessment", metric = "MdAPE")
S3 plotting method for objects returned by dm_standardize().
## S3 method for class 'dm_standardized' plot( x, y = NULL, trees = "all", type = c("series", "seasonal", "heatmap", "boxplot"), x_axis = c("time", "doy", "season_doy"), facet_by = c("tree", "season_year", "none"), legend_by = c("season_year", "tree", "none"), in_season_only = TRUE, box_group = c("tree", "season_year"), alpha = 0.8, line_size = 0.45, point_size = 1.6, ... )## S3 method for class 'dm_standardized' plot( x, y = NULL, trees = "all", type = c("series", "seasonal", "heatmap", "boxplot"), x_axis = c("time", "doy", "season_doy"), facet_by = c("tree", "season_year", "none"), legend_by = c("season_year", "tree", "none"), in_season_only = TRUE, box_group = c("tree", "season_year"), alpha = 0.8, line_size = 0.45, point_size = 1.6, ... )
x |
Object of class |
y |
Unused. |
trees |
Character vector of dendrometer series to plot, or |
type |
Plot type. One of:
|
x_axis |
For |
facet_by |
Faceting option. One of |
legend_by |
Legend grouping. One of |
in_season_only |
Logical. If |
box_group |
For |
alpha |
Line or point transparency. |
line_size |
Line width. |
point_size |
Point size. |
... |
Unused. |
A ggplot2 object, returned invisibly.
data(gf_nepa17) out_std <- dm_standardize( df = gf_nepa17, season_type = "NH", method = "robust_amplitude" ) plot(out_std) plot(out_std, type = "seasonal") plot(out_std, type = "seasonal", facet_by = "tree", legend_by = "season_year") plot(out_std, type = "seasonal", facet_by = "season_year", legend_by = "tree") plot(out_std, type = "heatmap", facet_by = "tree") plot(out_std, type = "boxplot", facet_by = "tree", legend_by = "season_year")data(gf_nepa17) out_std <- dm_standardize( df = gf_nepa17, season_type = "NH", method = "robust_amplitude" ) plot(out_std) plot(out_std, type = "seasonal") plot(out_std, type = "seasonal", facet_by = "tree", legend_by = "season_year") plot(out_std, type = "seasonal", facet_by = "season_year", legend_by = "tree") plot(out_std, type = "heatmap", facet_by = "tree") plot(out_std, type = "boxplot", facet_by = "tree", legend_by = "season_year")
S3 plotting method for objects returned by dm_wavelet().
The function provides three main visualization types:
"series": plots the analyzed input dendrometer series over time,
"average": plots the average wavelet power spectrum against period,
"power": plots the full wavelet power spectrum as a time-period image.
Periods are shown in hours, regardless of the original temporal resolution of the input series. For power plots, the x-axis shows the actual time series timestamps and the y-axis shows the wavelet period in hours.
## S3 method for class 'dm_wavelet' plot( x, y = NULL, series = NULL, type = c("power", "average", "series"), facet = TRUE, log_period = TRUE, log_power = TRUE, clip_quantile = c(0.01, 0.99), show_sig = TRUE, show_coi = TRUE, coi_fill = "white", coi_alpha = 0.45, siglvl = 0.05, sig_color = "black", sig_size = 0.4, main = NULL, ... )## S3 method for class 'dm_wavelet' plot( x, y = NULL, series = NULL, type = c("power", "average", "series"), facet = TRUE, log_period = TRUE, log_power = TRUE, clip_quantile = c(0.01, 0.99), show_sig = TRUE, show_coi = TRUE, coi_fill = "white", coi_alpha = 0.45, siglvl = 0.05, sig_color = "black", sig_size = 0.4, main = NULL, ... )
x |
An object of class |
y |
Unused. |
series |
Optional character vector giving one or more series names to
plot. If |
type |
Character string specifying the plot type. One of:
|
facet |
Logical. If |
log_period |
Logical. If |
log_power |
Logical. If |
clip_quantile |
Optional numeric vector of length 2 giving lower and
upper quantiles used to clip wavelet power before plotting, for example
|
show_sig |
Logical. If |
show_coi |
Logical. If |
coi_fill |
Fill colour used for the cone of influence shading. |
coi_alpha |
Numeric transparency of the cone of influence shading. |
siglvl |
Numeric significance threshold between 0 and 1. Default is
|
sig_color |
Colour used for significance overlays. |
sig_size |
Line width or point size used for significance overlays. |
main |
Optional plot title. If |
... |
Further arguments passed to or from other methods. Currently unused. |
For type = "power", the function uses the wavelet power matrix stored
in the "dm_wavelet" object and converts the Fourier periods to hours.
The power plot may also show:
significance contours, when p-values are available,
the cone of influence (COI), when COI information is available.
For type = "average", the function plots the average wavelet power
spectrum and may optionally indicate significant periods when average-spectrum
p-values are available.
For type = "series", the original analyzed series are plotted without
any wavelet transformation.
A ggplot2 object.
wv <- dm_wavelet( x = gf_nepa17, TreeNum = 1:2, source = "raw", make_pval = TRUE, verbose = FALSE ) # original series plot(wv, type = "series") # average wavelet power plot(wv, type = "average") # full power spectrum plot(wv, type = "power") # one selected series plot(wv, series = names(wv$results)[1], type = "power") # stronger contrast in the power plot plot( wv, type = "power", log_power = TRUE, clip_quantile = c(0.05, 0.95) )wv <- dm_wavelet( x = gf_nepa17, TreeNum = 1:2, source = "raw", make_pval = TRUE, verbose = FALSE ) # original series plot(wv, type = "series") # average wavelet power plot(wv, type = "average") # full power spectrum plot(wv, type = "power") # one selected series plot(wv, series = names(wv$results)[1], type = "power") # stronger contrast in the power plot plot( wv, type = "power", log_power = TRUE, clip_quantile = c(0.05, 0.95) )
Plot method for dm_wavelet_coherence objects
## S3 method for class 'dm_wavelet_coherence' plot( x, y = NULL, pair = NULL, type = c("coherence", "cross_power", "average_coherence", "average_cross_power", "phase", "series"), facet = TRUE, log_period = TRUE, log_power = TRUE, clip_quantile = c(0.01, 0.99), show_sig = TRUE, show_coi = TRUE, siglvl = 0.05, sig_color = "black", sig_size = 0.4, coi_fill = "white", coi_alpha = 0.45, main = NULL, ... )## S3 method for class 'dm_wavelet_coherence' plot( x, y = NULL, pair = NULL, type = c("coherence", "cross_power", "average_coherence", "average_cross_power", "phase", "series"), facet = TRUE, log_period = TRUE, log_power = TRUE, clip_quantile = c(0.01, 0.99), show_sig = TRUE, show_coi = TRUE, siglvl = 0.05, sig_color = "black", sig_size = 0.4, coi_fill = "white", coi_alpha = 0.45, main = NULL, ... )
x |
An object of class |
y |
Unused. |
pair |
Optional pair name(s) to plot. If |
type |
One of |
facet |
Logical. If |
log_period |
Logical. |
log_power |
Logical for raster intensity. |
clip_quantile |
Optional clipping quantiles for raster intensity. |
show_sig |
Logical. |
show_coi |
Logical. |
siglvl |
Significance level. |
sig_color |
Significance contour color. |
sig_size |
Significance contour linewidth. |
coi_fill |
COI fill color. |
coi_alpha |
COI alpha. |
main |
Optional title. |
... |
Unused. |
A ggplot2 object.
Plots reconstructed or filtered cycle components extracted by
dm_wavelet_reconstruct().
## S3 method for class 'dm_wavelet_reconstruct' plot( x, y = NULL, series = NULL, type = c("compare", "reconstructed", "difference", "filtered"), facet = TRUE, legend_position = "right", line_width = 0.8, alpha = 0.7, main = NULL, ... )## S3 method for class 'dm_wavelet_reconstruct' plot( x, y = NULL, series = NULL, type = c("compare", "reconstructed", "difference", "filtered"), facet = TRUE, legend_position = "right", line_width = 0.8, alpha = 0.7, main = NULL, ... )
x |
An object of class |
y |
Unused. |
series |
Optional character vector of series names to plot. If
|
type |
One of:
|
facet |
Logical. If |
legend_position |
Legend position passed to ggplot2. |
line_width |
Line width. |
alpha |
Alpha transparency for original series in compare plots. |
main |
Optional title. |
... |
Further arguments passed to or from other methods. |
A ggplot2 object.
S3 plotting method for objects returned by mean_detrended.dm().
It can plot:
the mean detrended series (STD_DDM),
the autocorrelation-removed mean detrended series (RES_DDM),
or both together.
## S3 method for class 'mean_dm_detrended' plot( x, y = NULL, type = c("series", "seasonal", "boxplot"), value = c("both", "STD_DDM", "RES_DDM"), seasons = NULL, x_axis = c("default", "date", "doy", "season_day"), facet_by = c("none", "season", "metric"), ncol = NULL, box_group = c("metric", "season"), alpha = 0.8, line_width = 0.8, point_size = 1.4, legend_position = "right", ... )## S3 method for class 'mean_dm_detrended' plot( x, y = NULL, type = c("series", "seasonal", "boxplot"), value = c("both", "STD_DDM", "RES_DDM"), seasons = NULL, x_axis = c("default", "date", "doy", "season_day"), facet_by = c("none", "season", "metric"), ncol = NULL, box_group = c("metric", "season"), alpha = 0.8, line_width = 0.8, point_size = 1.4, legend_position = "right", ... )
x |
An object of class |
y |
Unused. |
type |
Plot type. One of:
|
value |
Which variable to plot. One of:
|
seasons |
Optional character vector of |
x_axis |
Character string controlling the x-axis. One of:
|
facet_by |
Character string controlling faceting. One of:
|
ncol |
Optional integer giving the number of facet columns. |
box_group |
For |
alpha |
Numeric alpha transparency for lines/points. |
line_width |
Numeric line width. |
point_size |
Numeric point size. |
legend_position |
Character legend position passed to ggplot2. |
... |
Further arguments passed to or from other methods. |
A ggplot2 object.
S3 plotting method for output of mov.cor.dm().
Supports heatmaps, line plots, faceted line plots, peak-correlation summaries,
and comparison across multiple mov.cor.dm() objects.
## S3 method for class 'mov_cor_dm' plot( x, y = NULL, sig.only = TRUE, ci = 0.95, clim_vars = "all", type = c("heatmap", "line", "facet", "peak", "compare"), x_axis = c("time", "doy"), use_adjusted = TRUE, show_na = TRUE, show_ci = FALSE, sig_mode = c("outline", "point", "filter", "none"), annotate_peak = FALSE, show_window_label = TRUE, compare_with = NULL, compare_labels = NULL, low_col = "red", mid_col = "white", high_col = "blue", na_col = "grey79", line_size = 0.5, point_size = 1.8, alpha_sig = 0.9, ... )## S3 method for class 'mov_cor_dm' plot( x, y = NULL, sig.only = TRUE, ci = 0.95, clim_vars = "all", type = c("heatmap", "line", "facet", "peak", "compare"), x_axis = c("time", "doy"), use_adjusted = TRUE, show_na = TRUE, show_ci = FALSE, sig_mode = c("outline", "point", "filter", "none"), annotate_peak = FALSE, show_window_label = TRUE, compare_with = NULL, compare_labels = NULL, low_col = "red", mid_col = "white", high_col = "blue", na_col = "grey79", line_size = 0.5, point_size = 1.8, alpha_sig = 0.9, ... )
x |
Object returned by |
y |
Unused. |
sig.only |
Logical. If |
ci |
Numeric confidence level between 0 and 1. For non-bootstrap
results, significance is based on |
clim_vars |
Character vector of climate variables to plot, or
|
type |
Plot type. One of |
x_axis |
X-axis style. One of |
use_adjusted |
Logical. For non-bootstrap objects, if |
show_na |
Logical. If |
show_ci |
Logical. If |
sig_mode |
One of |
annotate_peak |
Logical. If |
show_window_label |
Logical. If |
compare_with |
Optional list of additional |
compare_labels |
Optional character vector of labels for the comparison
objects. If |
low_col |
Colour for negative correlations. |
mid_col |
Colour for zero correlations. |
high_col |
Colour for positive correlations. |
na_col |
Fill colour for missing values in heatmaps. |
line_size |
Numeric line width for line plots. |
point_size |
Numeric point size for significance markers and peak markers. |
alpha_sig |
Numeric transparency used for significance highlighting. |
... |
Unused. |
A ggplot2 object, returned invisibly.
S3 plot method for objects returned by
network.interpolation.
Depending on type, the method can display:
interpolated series through time,
uncertainty width,
reference-network availability,
summary diagnostics,
synthetic-gap validation metrics,
interval coverage,
actual versus interpolated validation points,
seasonal validation diagnostics.
Jump-corrected post-gap points are marked in the interpolation plot when
jump correction was enabled in network.interpolation.
## S3 method for class 'network_interpolation' plot( x, type = c("interpolation", "uncertainty", "availability", "summary", "validation", "coverage", "compare", "seasonal_error"), series = NULL, start = NULL, end = NULL, show_pi = TRUE, show_fit = FALSE, free_y = TRUE, ncol = 1, summary_metric = c("n_imputed", "n_remaining_na", "n_missing_input", "mean_pi_width", "median_pi_width", "mean_ref_n", "median_ref_n", "n_gap_jumps_removed", "max_abs_gap_jump"), validation_metric = c("MAE", "MAPE", "MdAPE", "RMSE", "Bias", "Success_rate", "Mean_PI_width", "Mean_ref_n", "End_value_abs_diff", "Max_abs_diff_within_gap"), seasonal_metric = c("mean_error", "mean_abs_error", "mean_abs_pct_error", "rmse", "coverage"), compare_colour = c("series", "gap_steps"), facet = TRUE, empty = c("plot", "error"), ... )## S3 method for class 'network_interpolation' plot( x, type = c("interpolation", "uncertainty", "availability", "summary", "validation", "coverage", "compare", "seasonal_error"), series = NULL, start = NULL, end = NULL, show_pi = TRUE, show_fit = FALSE, free_y = TRUE, ncol = 1, summary_metric = c("n_imputed", "n_remaining_na", "n_missing_input", "mean_pi_width", "median_pi_width", "mean_ref_n", "median_ref_n", "n_gap_jumps_removed", "max_abs_gap_jump"), validation_metric = c("MAE", "MAPE", "MdAPE", "RMSE", "Bias", "Success_rate", "Mean_PI_width", "Mean_ref_n", "End_value_abs_diff", "Max_abs_diff_within_gap"), seasonal_metric = c("mean_error", "mean_abs_error", "mean_abs_pct_error", "rmse", "coverage"), compare_colour = c("series", "gap_steps"), facet = TRUE, empty = c("plot", "error"), ... )
x |
Object returned by |
type |
Character. Plot type. One of |
series |
Optional character vector of focal series names to plot. |
start |
Optional start datetime for time-based plots. |
end |
Optional end datetime for time-based plots. |
show_pi |
Logical. If |
show_fit |
Logical. If |
free_y |
Logical. If |
ncol |
Integer. Number of facet columns. |
summary_metric |
Character metric used when
|
validation_metric |
Character metric used when
|
seasonal_metric |
Character metric used when
|
compare_colour |
Character. Colouring used when
|
facet |
Logical. If |
empty |
Character. Behavior when no suitable data are available:
|
... |
Further arguments passed through the generic. |
Plot types:
"interpolation"Shows original and interpolated focal series through time. Imputed points are highlighted. If jump correction was applied, corrected post-gap points are marked in green.
"uncertainty"Shows the width of the prediction interval through time.
"availability"Shows the number of valid reference sensors available at each step.
"summary"Shows per-series summary diagnostics produced by the interpolation run.
"validation"Shows synthetic-gap recovery metrics across tested gap lengths.
"coverage"Shows how often true values fall inside the nominal 95% prediction interval across gap lengths.
"compare"Scatter plot of actual versus interpolated values from synthetic-gap validation.
"seasonal_error"Shows how validation error varies through the season, summarized by day of year.
Validation-based plots require that
network.interpolation(..., assess = TRUE) was used to create
x.
A ggplot2 object.
#library(dendRoAnalyst) #data("gf_nepa17") #df1 <- gf_nepa17 #df1[40:50, "T2"] <- NA #ref <- cbind(gf_nepa17, gf_nepa17[, 2:3], gf_nepa17[, 2:3]) #colnames(ref) <- c("Time", "T1", "T2", "T3", "T4", "T5", "T6") #out <- network.interpolation( # df1, ref, # niMethod = "proportional", # n_boot = 100, # assess = TRUE, # assess_lengths_steps = c(1, 2, 4), # correct_gap_jumps = TRUE, # jump_threshold = 0.05 #) #plot(out) #plot(out, type = "uncertainty") #plot(out, type = "availability") #plot(out, type = "summary", summary_metric = "n_gap_jumps_removed") #plot(out, type = "validation", validation_metric = "MAPE") #plot(out, type = "coverage") #plot(out, type = "compare") #plot(out, type = "seasonal_error", seasonal_metric = "mean_abs_error")#library(dendRoAnalyst) #data("gf_nepa17") #df1 <- gf_nepa17 #df1[40:50, "T2"] <- NA #ref <- cbind(gf_nepa17, gf_nepa17[, 2:3], gf_nepa17[, 2:3]) #colnames(ref) <- c("Time", "T1", "T2", "T3", "T4", "T5", "T6") #out <- network.interpolation( # df1, ref, # niMethod = "proportional", # n_boot = 100, # assess = TRUE, # assess_lengths_steps = c(1, 2, 4), # correct_gap_jumps = TRUE, # jump_threshold = 0.05 #) #plot(out) #plot(out, type = "uncertainty") #plot(out, type = "availability") #plot(out, type = "summary", summary_metric = "n_gap_jumps_removed") #plot(out, type = "validation", validation_metric = "MAPE") #plot(out, type = "coverage") #plot(out, type = "compare") #plot(out, type = "seasonal_error", seasonal_metric = "mean_abs_error")
Unified S3 plotting method for objects returned by phase.sc().
Supports raw phase timelines, phase ribbons, transition diagnostics,
daily/monthly phase balance, cumulative increment, event frequency,
phase heatmaps, and daily/monthly boxplots of phase statistics.
For type = "balance", two plotting modes are available. With
balance_mode = "time_of_day", phases are drawn as continuous
within-day intervals, and the y-axis represents hour of day from 0 to 24.
This makes the timing of shrinkage, expansion, and increment visible. For
example, if shrinkage occurs from 00:00 to 05:00, expansion from 05:00 to
15:00, and shrinkage again from 15:00 to 24:00, these intervals are shown
as continuous coloured blocks along the y-axis.
With balance_mode = "duration", the older stacked-bar behaviour is
used. In that case, the y-axis represents the amount of time spent in each
phase. With temporal = "daily", the y-axis is hours per day. With
temporal = "monthly", the y-axis is hours per month.
## S3 method for class 'SC_output' plot( x, y = NULL, DOY = NULL, Year = NULL, type = c("points", "ribbon", "transition", "balance", "increment", "frequency", "heatmap", "boxplot"), temporal = c("raw", "daily", "monthly"), x_axis = c("time", "doy"), balance_mode = c("time_of_day", "duration"), stat = c("Duration_h", "Duration_m", "Magnitude", "rate"), phase = c("all", "Shrinkage", "Expansion", "Increment"), cols = c("#fee8c8", "#fdbb84", "#e34a33"), phNames = c("Shrinkage", "Expansion", "Increment"), transition_linetype = "dashed", transition_alpha = 0.55, singleton_as_points = TRUE, ... )## S3 method for class 'SC_output' plot( x, y = NULL, DOY = NULL, Year = NULL, type = c("points", "ribbon", "transition", "balance", "increment", "frequency", "heatmap", "boxplot"), temporal = c("raw", "daily", "monthly"), x_axis = c("time", "doy"), balance_mode = c("time_of_day", "duration"), stat = c("Duration_h", "Duration_m", "Magnitude", "rate"), phase = c("all", "Shrinkage", "Expansion", "Increment"), cols = c("#fee8c8", "#fdbb84", "#e34a33"), phNames = c("Shrinkage", "Expansion", "Increment"), transition_linetype = "dashed", transition_alpha = 0.55, singleton_as_points = TRUE, ... )
x |
Object of class |
y |
Unused. |
DOY |
Optional numeric vector of length 2 giving start and end day-of-year. |
Year |
Optional numeric year used together with |
type |
Plot type. One of
|
temporal |
Temporal scale: |
x_axis |
X-axis style for time-based plots. One of |
balance_mode |
For |
stat |
For |
phase |
For |
cols |
Vector of three colours for Shrinkage, Expansion, and Increment. |
phNames |
Vector of three labels for the three phase names. |
transition_linetype |
Line type used for transition markers in
|
transition_alpha |
Transparency of transition markers. |
singleton_as_points |
Logical. If |
... |
Unused. |
Plot types:
"points": dendrometer series with points coloured by phase.
"ribbon": dendrometer series with background ribbons for
contiguous phases.
"transition": dendrometer series with vertical lines at phase
changes.
"balance": phase balance through time. With
balance_mode = "time_of_day", phase intervals are drawn
continuously along the y-axis from 0 to 24 h, so the timing of
shrinkage, expansion, and increment within each day is visible.
With balance_mode = "duration", stacked bars show total time
spent in each phase per day or month.
"increment": cumulative increment, phase 3, over time.
"frequency": number of phase events starting per day or month.
"heatmap": dominant phase by hour-of-day across dates or months.
"boxplot": distribution of selected cycle statistics after
assembling cycle summaries to the chosen daily or monthly time scale.
The "frequency" plot uses SC_cycle.
The "heatmap" plot uses SC_phase.
The "transition" plot is especially useful for checking whether
smoothing reduced spurious phase switching.
A ggplot2 object, returned invisibly.
# data(gf_nepa17) # sc <- phase.sc(df = gf_nepa17, TreeNum = 1, smoothing = 12) # plot(sc) # plot(sc, type = "ribbon") # plot(sc, type = "transition") # Daily within-day phase timing # plot(sc, type = "balance", temporal = "daily") # Daily within-day phase timing for selected DOY range # plot(sc, type = "balance", temporal = "daily", # DOY = c(150, 160), Year = 2023) # Old stacked-duration balance plot # plot(sc, type = "balance", temporal = "daily", # balance_mode = "duration") # Monthly stacked duration # plot(sc, type = "balance", temporal = "monthly", # balance_mode = "duration") # Boxplots # plot(sc, type = "boxplot", stat = "Magnitude", temporal = "monthly") # plot(sc, type = "boxplot", stat = "Duration_h", # temporal = "daily", phase = "Shrinkage")# data(gf_nepa17) # sc <- phase.sc(df = gf_nepa17, TreeNum = 1, smoothing = 12) # plot(sc) # plot(sc, type = "ribbon") # plot(sc, type = "transition") # Daily within-day phase timing # plot(sc, type = "balance", temporal = "daily") # Daily within-day phase timing for selected DOY range # plot(sc, type = "balance", temporal = "daily", # DOY = c(150, 160), Year = 2023) # Old stacked-duration balance plot # plot(sc, type = "balance", temporal = "daily", # balance_mode = "duration") # Monthly stacked duration # plot(sc, type = "balance", temporal = "monthly", # balance_mode = "duration") # Boxplots # plot(sc, type = "boxplot", stat = "Magnitude", temporal = "monthly") # plot(sc, type = "boxplot", stat = "Duration_h", # temporal = "daily", phase = "Shrinkage")
S3 plotting method for objects of class SC_output_clim. This allows
climate-augmented stem-cycle outputs to be visualized directly with the
generic plot() function.
## S3 method for class 'SC_output_clim' plot( x, y = NULL, ..., climate_var = NULL, climate_vars = NULL, numeric_vars = NULL, compare = FALSE, temporal = NULL )## S3 method for class 'SC_output_clim' plot( x, y = NULL, ..., climate_var = NULL, climate_vars = NULL, numeric_vars = NULL, compare = FALSE, temporal = NULL )
x |
An object of class |
y |
Optional climate variable name passed as the second argument. |
... |
Additional arguments passed to |
climate_var |
Character. Name of one climate variable to plot. |
climate_vars |
Character vector of climate variables for comparison plots. |
numeric_vars |
Character vector of numeric variables used for correlation or regression heatmaps. |
compare |
Logical. If |
temporal |
Deprecated argument kept for compatibility with older examples. It is ignored. |
A ggplot2 object, returned invisibly.
# plot(sc_clim, climate_var = "temp_mean_phase", scale = "cycle", # type = "violin")# plot(sc_clim, climate_var = "temp_mean_phase", scale = "cycle", # type = "violin")
S3 plotting method for objects returned by summary.mov_cor_dm().
## S3 method for class 'summary_mov_cor_dm' plot( x, y = NULL, type = c("peak_corr", "prop_significant", "peak_time"), x_axis = c("time", "doy"), low_col = "red", mid_col = "white", high_col = "blue", show_window_label = TRUE, ... )## S3 method for class 'summary_mov_cor_dm' plot( x, y = NULL, type = c("peak_corr", "prop_significant", "peak_time"), x_axis = c("time", "doy"), low_col = "red", mid_col = "white", high_col = "blue", show_window_label = TRUE, ... )
x |
Object of class |
y |
Unused. |
type |
Plot type. One of |
x_axis |
X-axis style for |
low_col |
Colour for negative values. |
mid_col |
Colour for zero. |
high_col |
Colour for positive values. |
show_window_label |
Logical. If |
... |
Unused. |
A ggplot2 object, returned invisibly.
Unified S3 plotting method for objects returned by phase.zg().
It supports time-series views of GRO and TWD, phase ribbons and transitions,
TWD-only plots, ABr summaries, phase-balance views, and boxplots of
phase-level statistics. For boxplots, phase summaries are first assembled to
the requested daily or monthly time scale, and rows with missing x-axis
grouping labels are removed before plotting.
The plotting method operates on the two tables returned by
phase.zg():
ZG_phase: point-level time series with TIME,
dm, Phases, TWD, and GRO;
ZG_cycle: phase-level summaries including
max.twd, AUC.load, AUC.total, and
ABr.value.
## S3 method for class 'ZG_output' plot( x, y = NULL, DOY = NULL, Year = NULL, view = NULL, type = c("gro_twd", "phase_ribbon", "transition", "twd", "abr", "phase_summary", "balance", "boxplot"), temporal = c("raw", "daily", "monthly"), x_axis = c("time", "doy"), stat = c("Duration_h", "Magnitude", "rate", "max.twd", "Avg.twd", "STD.twd", "AUC.load", "AUC.total", "ABr.value"), phase = c("auto", "TWD", "GRO", "all"), box_group = c("period", "month_of_year", "doy"), twd_fun = c("mean", "max"), gro_fun = c("max", "mean"), transition_linetype = "dashed", transition_alpha = 0.55, cols = c(TWD = "red", GRO = "blue"), singleton_as_points = TRUE, balance_mode = c("time_of_day", "duration"), balance_gap = c("carry_forward", "observed_only"), ... )## S3 method for class 'ZG_output' plot( x, y = NULL, DOY = NULL, Year = NULL, view = NULL, type = c("gro_twd", "phase_ribbon", "transition", "twd", "abr", "phase_summary", "balance", "boxplot"), temporal = c("raw", "daily", "monthly"), x_axis = c("time", "doy"), stat = c("Duration_h", "Magnitude", "rate", "max.twd", "Avg.twd", "STD.twd", "AUC.load", "AUC.total", "ABr.value"), phase = c("auto", "TWD", "GRO", "all"), box_group = c("period", "month_of_year", "doy"), twd_fun = c("mean", "max"), gro_fun = c("max", "mean"), transition_linetype = "dashed", transition_alpha = 0.55, cols = c(TWD = "red", GRO = "blue"), singleton_as_points = TRUE, balance_mode = c("time_of_day", "duration"), balance_gap = c("carry_forward", "observed_only"), ... )
x |
Object of class |
y |
Unused. |
DOY |
Optional numeric vector of length 2 giving start and end day-of-year for truncating the plotting window. |
Year |
Optional numeric year used together with |
view |
Optional backward-compatible argument. Use |
type |
Plot type. One of |
temporal |
Temporal scale. One of |
x_axis |
X-axis style for time-based plots. One of |
stat |
For |
phase |
For |
box_group |
For |
twd_fun |
Aggregation function for point-level TWD when
|
gro_fun |
Aggregation function for point-level GRO when
|
transition_linetype |
Line type used for transition markers. |
transition_alpha |
Transparency of transition markers. |
cols |
Vector of two colours for TWD and GRO. It may be named
( |
singleton_as_points |
Logical. If |
balance_mode |
For |
balance_gap |
For |
... |
Unused. |
ABr formula shown by this plot method.
When type = "abr" or when stat = "ABr.value" is used in
boxplots, the displayed values come directly from phase.zg():
where
and
This function does not recompute ABr or AUC values; it only visualizes
the values already stored in the ZG_output object.
Aggregation behavior.
For temporal = "daily" or "monthly", point-level series
are aggregated before plotting. TWD and GRO can be summarized using
"mean" or "max", depending on twd_fun and
gro_fun.
For phase-level summaries in ZG_cycle, the plot method aggregates
statistics by daily or monthly period. In those aggregated summaries:
Duration_h, Magnitude, AUC.load,
AUC.total, and ABr.value are summed;
max.twd is taken as the maximum;
Avg.twd and STD.twd are averaged;
rate is recalculated from aggregated magnitude and duration.
Phase balance.
For type = "balance", two balance styles are available through
balance_mode. With balance_mode = "time_of_day", the plot
draws TWD and GRO intervals on a 0–24 hour y-axis, preserving the order in
which phases occurred within each day, similar to the balance option in
plot.SC_output(). With balance_mode = "duration", the plot
draws stacked bars showing the total number of hours spent in each phase.
Missing or irregular intervals can be handled with balance_gap.
Boxplot statistics.
The following phase-level variables can be visualized in
type = "boxplot". For box_group = "period", boxplots are
drawn on a continuous date axis spanning the selected multi-annual data
window, so empty days or months remain visible as gaps rather than being
removed from the x-axis:
"Duration_h"
"Magnitude"
"rate"
"max.twd"
"Avg.twd"
"STD.twd"
"AUC.load"
"AUC.total"
"ABr.value"
Phase handling.
For phase = "auto", TWD-specific statistics
(max.twd, Avg.twd, STD.twd, AUC.load,
AUC.total, ABr.value) automatically select TWD phases,
whereas GRO-specific variables (Magnitude, rate) select GRO
phases.
A ggplot2 object, returned invisibly.
# data(gf_nepa17) # zg <- phase.zg(df = gf_nepa17[1:500, ], TreeNum = 1, beta = 0.1) # Raw GRO and TWD time series # plot(zg) # Daily aggregated series # plot(zg, temporal = "daily") # Monthly TWD plot # plot(zg, temporal = "monthly", type = "twd") # ABr bar plot # plot(zg, temporal = "monthly", type = "abr") # Daily phase timing, similar to plot.SC_output balance # plot(zg, type = "balance", temporal = "daily", # balance_mode = "time_of_day") # Stacked phase-duration balance # plot(zg, type = "balance", temporal = "daily", # balance_mode = "duration") # Transition plot in day-of-year coordinates # plot(zg, type = "transition", x_axis = "doy", # DOY = c(50, 100), Year = 2017) # Boxplots of peak TWD # plot(zg, type = "boxplot", stat = "max.twd", # temporal = "daily", box_group = "doy") # Boxplots of AUC.load # plot(zg, type = "boxplot", stat = "AUC.load", # temporal = "monthly", box_group = "month_of_year") # Boxplots of ABr.value # plot(zg, type = "boxplot", stat = "ABr.value", # temporal = "monthly", box_group = "month_of_year") # plot(zg, view = "boxplot", stat = "ABr.value", temporal = "monthly")# data(gf_nepa17) # zg <- phase.zg(df = gf_nepa17[1:500, ], TreeNum = 1, beta = 0.1) # Raw GRO and TWD time series # plot(zg) # Daily aggregated series # plot(zg, temporal = "daily") # Monthly TWD plot # plot(zg, temporal = "monthly", type = "twd") # ABr bar plot # plot(zg, temporal = "monthly", type = "abr") # Daily phase timing, similar to plot.SC_output balance # plot(zg, type = "balance", temporal = "daily", # balance_mode = "time_of_day") # Stacked phase-duration balance # plot(zg, type = "balance", temporal = "daily", # balance_mode = "duration") # Transition plot in day-of-year coordinates # plot(zg, type = "transition", x_axis = "doy", # DOY = c(50, 100), Year = 2017) # Boxplots of peak TWD # plot(zg, type = "boxplot", stat = "max.twd", # temporal = "daily", box_group = "doy") # Boxplots of AUC.load # plot(zg, type = "boxplot", stat = "AUC.load", # temporal = "monthly", box_group = "month_of_year") # Boxplots of ABr.value # plot(zg, type = "boxplot", stat = "ABr.value", # temporal = "monthly", box_group = "month_of_year") # plot(zg, view = "boxplot", stat = "ABr.value", temporal = "monthly")
S3 plotting method for objects of class ZG_output_clim. This allows
climate-augmented zero-growth outputs to be visualized directly with the
generic plot() function.
## S3 method for class 'ZG_output_clim' plot( x, y = NULL, ..., climate_var = NULL, climate_vars = NULL, numeric_vars = NULL, compare = FALSE, temporal = NULL )## S3 method for class 'ZG_output_clim' plot( x, y = NULL, ..., climate_var = NULL, climate_vars = NULL, numeric_vars = NULL, compare = FALSE, temporal = NULL )
x |
An object of class |
y |
Optional climate variable name passed as the second argument. |
... |
Additional arguments passed to |
climate_var |
Character. Name of one climate variable to plot. |
climate_vars |
Character vector of climate variables for comparison plots. |
numeric_vars |
Character vector of numeric variables used for correlation or regression heatmaps. |
compare |
Logical. If |
temporal |
Deprecated argument kept for compatibility with older examples. It is ignored. |
A ggplot2 object, returned invisibly.
# plot(zg_clim, climate_var = "VPD_mean_phase", scale = "cycle", # type = "boxplot")# plot(zg_clim, climate_var = "VPD_mean_phase", scale = "cycle", # type = "boxplot")
Prints a compact overview of an object returned by [dm.growth.fit()] or [dm.growth.fit.double()].
## S3 method for class 'dm_growth_fit' print(x, ...)## S3 method for class 'dm_growth_fit' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods. |
The input object, invisibly.
Print method for running dendrometer-climate correlation objects
## S3 method for class 'mov_cor_dm' print(x, ...)## S3 method for class 'mov_cor_dm' print(x, ...)
x |
Object of class |
... |
Unused. |
The object, invisibly.
Print method for summaries of running dendrometer-climate correlation objects
## S3 method for class 'summary_mov_cor_dm' print(x, ...)## S3 method for class 'summary_mov_cor_dm' print(x, ...)
x |
Object of class |
... |
Unused. |
The summary object, invisibly.
Print summary of clim.twd.stats output
## S3 method for class 'summary.clim_twd_stats' print(x, ...)## S3 method for class 'summary.clim_twd_stats' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods. |
The input object, invisibly.
Print summary of clim.twd.test output
## S3 method for class 'summary.clim_twd_test' print(x, ...)## S3 method for class 'summary.clim_twd_test' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods. |
The input object, invisibly.
Print summary of a dm_epoch object
## S3 method for class 'summary.dm_epoch' print(x, ...)## S3 method for class 'summary.dm_epoch' print(x, ...)
x |
Object of class |
... |
Unused. |
The input object, invisibly.
Prints a formatted summary of a "summary.dm_growth_fit" object.
## S3 method for class 'summary.dm_growth_fit' print(x, ...)## S3 method for class 'summary.dm_growth_fit' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods. |
The input object, invisibly.
Print method for summary.dm_wavelet_reconstruct
## S3 method for class 'summary.dm_wavelet_reconstruct' print(x, digits = 4, ...)## S3 method for class 'summary.dm_wavelet_reconstruct' print(x, digits = 4, ...)
x |
An object of class |
digits |
Number of digits for rounded numeric printing. |
... |
Further arguments passed to or from other methods. |
The input object, invisibly.
A robust climate-data reader designed to be as flexible as read.dendrometer(). It accepts data frames and common file formats, auto-detects separators and decimal marks, parses many datetime formats, supports Excel serial dates, supports separate date + time columns, detects the time column automatically, sorts timestamps, removes duplicates, converts numeric-like climate variables, and returns a standardized tibble with a POSIXct TIME column.
read.climate( x, time_col = NULL, vars = NULL, sep = NULL, dec = NULL, header = TRUE, sheet = 1, tz = "UTC", drop_duplicate_time = TRUE, min_time_success = 0.6, verbose = TRUE, datetime_col = NULL, date_col = NULL, range = NULL, na = c("", "NA", "NaN", "nan", "null", "NULL", "-9999", "-999", "N/A"), assume_midnight = TRUE, orders = NULL, excel_dates = c("auto", "none", "1900", "1904"), drop_empty_cols = TRUE, trim_names = TRUE, detect_resolution = FALSE, return_report = FALSE, quiet = !verbose )read.climate( x, time_col = NULL, vars = NULL, sep = NULL, dec = NULL, header = TRUE, sheet = 1, tz = "UTC", drop_duplicate_time = TRUE, min_time_success = 0.6, verbose = TRUE, datetime_col = NULL, date_col = NULL, range = NULL, na = c("", "NA", "NaN", "nan", "null", "NULL", "-9999", "-999", "N/A"), assume_midnight = TRUE, orders = NULL, excel_dates = c("auto", "none", "1900", "1904"), drop_empty_cols = TRUE, trim_names = TRUE, detect_resolution = FALSE, return_report = FALSE, quiet = !verbose )
x |
A data frame or path to a file. Supported file extensions are csv, txt, tsv, tab, dat, xls, xlsx, rds, rda, and RData. |
time_col |
Backward-compatible explicit time/datetime column name or index. If date_col is also supplied, this is treated as the time-of-day column. |
vars |
Optional character vector of climate variables to keep. |
sep |
Optional field separator for text files. If NULL, it is auto-detected. |
dec |
Optional decimal mark for text files. If NULL, it is auto-detected. |
header |
Logical; passed to text-file readers. |
sheet |
Sheet name or index for Excel files. |
tz |
Time zone for parsed timestamps. |
drop_duplicate_time |
Logical; if TRUE, duplicated timestamps are removed. |
min_time_success |
Minimum parsing success proportion for automatic time detection. |
verbose |
Logical; print an import summary. |
datetime_col |
Optional explicit datetime column name or index. Prefer this when the file has one combined timestamp column. |
date_col |
Optional explicit date column name or index. Can be combined with time_col, or parsed alone with midnight appended when assume_midnight = TRUE. |
range |
Optional Excel cell range. |
na |
Strings to treat as missing values. |
assume_midnight |
Logical; if TRUE, date-only values are assigned 00:00:00. |
orders |
Optional lubridate parse_date_time() orders. |
excel_dates |
One of auto, none, 1900, or 1904. |
drop_empty_cols |
Logical; if TRUE, columns that are completely empty are removed. |
trim_names |
Logical; if TRUE, trim whitespace from column names. |
detect_resolution |
Logical; if TRUE, attach simple time-resolution diagnostics. |
return_report |
Logical; if TRUE, return list(data = ..., report = ...). |
quiet |
Logical; suppress messages. By default this is the inverse of verbose. |
A tibble of class dm_clim with TIME in the first column. An import report is attached as attr(x, "import_report").
Reads dendrometer data from .csv, .txt, .tsv, or .xlsx files,
automatically parsing the datetime information and converting it to
%Y-%m-%d %H:%M:%S in the requested timezone.
Supports:
automatic delimiter detection for text files,
real decimal-mark auto-detection for text files,
Excel serial date support (1900 / 1904 systems),
separate date_col + time_col,
optional import report output,
optional time-resolution diagnostics.
read.dendrometer( file, sep = NULL, dec = NULL, datetime_col = 1, date_col = NULL, time_col = NULL, tz = "UTC", sheet = NULL, range = NULL, na = c("", "NA", "NaN", "nan", "null", "NULL", "-9999"), assume_midnight = TRUE, orders = NULL, excel_dates = c("auto", "none", "1900", "1904"), drop_dup_times = TRUE, detect_resolution = FALSE, return_report = FALSE, quiet = TRUE )read.dendrometer( file, sep = NULL, dec = NULL, datetime_col = 1, date_col = NULL, time_col = NULL, tz = "UTC", sheet = NULL, range = NULL, na = c("", "NA", "NaN", "nan", "null", "NULL", "-9999"), assume_midnight = TRUE, orders = NULL, excel_dates = c("auto", "none", "1900", "1904"), drop_dup_times = TRUE, detect_resolution = FALSE, return_report = FALSE, quiet = TRUE )
file |
Path to file ( |
sep |
Optional delimiter for text files. If |
dec |
Optional decimal mark for text files. If |
datetime_col |
Integer or name of the datetime column (default |
date_col |
Optional integer or name of a date column. |
time_col |
Optional integer or name of a time column. Used together with
|
tz |
Time zone for parsed datetimes (default |
sheet |
Excel sheet name or index (for |
range |
Excel cell range (optional). |
na |
Character vector of strings to treat as NA. |
assume_midnight |
Logical; if |
orders |
Optional vector of lubridate orders to try. If |
excel_dates |
Character. One of |
drop_dup_times |
Logical; if |
detect_resolution |
Logical; if |
return_report |
Logical; if |
quiet |
Logical; if |
If return_report = FALSE, a tibble with a POSIXct first column and the
remaining data columns unchanged.
If return_report = TRUE, a list with:
$dataThe imported tibble.
$reportA structured import report.
Determines the average temporal resolution (in minutes) of a time series vector (e.g., dendrometer timestamps) and detects inconsistencies in time intervals. If the time column is character-formatted, it is automatically converted to POSIXct. Any inconsistent intervals are flagged and printed.
reso_dm(input_time)reso_dm(input_time)
input_time |
A vector of class |
This function is helpful for checking if a time series (especially dendrometer data) is regularly sampled. It handles both regular and irregular timestamps and gives feedback if the resolution changes.
A single integer: the estimated (rounded) average resolution in minutes. If multiple intervals are detected, a warning and index positions are printed.
## Not run: # Regular 30-minute time sequence time_seq <- seq.POSIXt(from = as.POSIXct("2023-06-01 00:00:00"), by = "30 min", length.out = 100) reso_dm(time_seq) # Should return 30 # With character time input time_char <- format(time_seq, format = "%Y-%m-%d %H:%M:%S") reso_dm(time_char) # Auto converts to POSIXct # Introduce an irregular step time_seq[51] <- time_seq[50] + 60 # One-time 1-hour jump reso_dm(time_seq) # Should print warning and irregular step index ## End(Not run)## Not run: # Regular 30-minute time sequence time_seq <- seq.POSIXt(from = as.POSIXct("2023-06-01 00:00:00"), by = "30 min", length.out = 100) reso_dm(time_seq) # Should return 30 # With character time input time_char <- format(time_seq, format = "%Y-%m-%d %H:%M:%S") reso_dm(time_char) # Auto converts to POSIXct # Introduce an irregular step time_seq[51] <- time_seq[50] + 60 # One-time 1-hour jump reso_dm(time_seq) # Should print warning and irregular step index ## End(Not run)
Applies various smoothing techniques to dendrometer (dm) time series data using a user-defined or automatically detected temporal resolution. The function supports several smoothing methods: robust median+mean, penalized spline, Savitzky-Golay filter, exponential moving average (EMA), and LOESS.
smooth_dm( time, dm, resolution_min = NULL, method = c("median_mean", "pspline", "sg", "ema", "loess"), window_hours = 3, sg_order = 2, ema_alpha = NULL )smooth_dm( time, dm, resolution_min = NULL, method = c("median_mean", "pspline", "sg", "ema", "loess"), window_hours = 3, sg_order = 2, ema_alpha = NULL )
time |
A POSIXct vector representing the time column. |
dm |
A numeric vector of dendrometer values corresponding to |
resolution_min |
Integer. The resolution of the time series in minutes. If |
method |
Smoothing method. One of: |
window_hours |
Numeric. Smoothing window length in hours. Converted to points using resolution. |
sg_order |
Integer. Polynomial order for Savitzky-Golay smoothing. Ignored unless |
ema_alpha |
Numeric. Smoothing factor (0–1) for exponential moving average. If |
The function is designed to smooth dendrometer time series (e.g., 10–60 min resolution) while preserving key features such as diurnal fluctuations or long-term growth, depending on the window size. It auto-detects the resolution (in minutes) if not provided.
A numeric vector of the same length as dm containing the smoothed values.
## Not run: # Example: Create synthetic dendrometer time series (30-min resolution) time_seq <- seq.POSIXt(from = as.POSIXct("2023-06-01 00:00:00"), to = as.POSIXct("2023-06-03 00:00:00"), by = "30 mins") set.seed(123) dm_raw <- cumsum(rnorm(length(time_seq), mean = 0.005, sd = 0.01)) + 0.1 * sin(2 * pi * as.numeric(difftime(time_seq, min(time_seq), units = "hours")) / 24) # Median plus moving mean smoothing (default robust filter) dm_medmean <- smooth_dm(time = time_seq, dm = dm_raw, method = "median_mean", window_hours = 3) # Penalized spline smoothing dm_pspline <- smooth_dm(time = time_seq, dm = dm_raw, method = "pspline", window_hours = 6) # Savitzky-Golay filter (requires 'signal' package) if (requireNamespace("signal", quietly = TRUE)) { dm_sg <- smooth_dm(time = time_seq, dm = dm_raw, method = "sg", window_hours = 2, sg_order = 2) } # Exponential moving average smoothing dm_ema <- smooth_dm(time = time_seq, dm = dm_raw, method = "ema", window_hours = 4) # LOESS smoothing dm_loess <- smooth_dm(time = time_seq, dm = dm_raw, method = "loess", window_hours = 3) # Plot raw and smoothed series plot(time_seq, dm_raw, type = "l", col = "gray", lwd = 1, main = "Smoothed Dendrometer Series", ylab = "DM", xlab = "Time") lines(time_seq, dm_medmean, col = "blue", lwd = 2) lines(time_seq, dm_pspline, col = "green", lwd = 2) lines(time_seq, dm_ema, col = "orange", lwd = 2) lines(time_seq, dm_loess, col = "purple", lwd = 2) legend("topright", legend = c("Raw", "Median+Mean", "P-spline", "EMA", "LOESS"), col = c("gray", "blue", "green", "orange", "purple"), lwd = 2) ## End(Not run)## Not run: # Example: Create synthetic dendrometer time series (30-min resolution) time_seq <- seq.POSIXt(from = as.POSIXct("2023-06-01 00:00:00"), to = as.POSIXct("2023-06-03 00:00:00"), by = "30 mins") set.seed(123) dm_raw <- cumsum(rnorm(length(time_seq), mean = 0.005, sd = 0.01)) + 0.1 * sin(2 * pi * as.numeric(difftime(time_seq, min(time_seq), units = "hours")) / 24) # Median plus moving mean smoothing (default robust filter) dm_medmean <- smooth_dm(time = time_seq, dm = dm_raw, method = "median_mean", window_hours = 3) # Penalized spline smoothing dm_pspline <- smooth_dm(time = time_seq, dm = dm_raw, method = "pspline", window_hours = 6) # Savitzky-Golay filter (requires 'signal' package) if (requireNamespace("signal", quietly = TRUE)) { dm_sg <- smooth_dm(time = time_seq, dm = dm_raw, method = "sg", window_hours = 2, sg_order = 2) } # Exponential moving average smoothing dm_ema <- smooth_dm(time = time_seq, dm = dm_raw, method = "ema", window_hours = 4) # LOESS smoothing dm_loess <- smooth_dm(time = time_seq, dm = dm_raw, method = "loess", window_hours = 3) # Plot raw and smoothed series plot(time_seq, dm_raw, type = "l", col = "gray", lwd = 1, main = "Smoothed Dendrometer Series", ylab = "DM", xlab = "Time") lines(time_seq, dm_medmean, col = "blue", lwd = 2) lines(time_seq, dm_pspline, col = "green", lwd = 2) lines(time_seq, dm_ema, col = "orange", lwd = 2) lines(time_seq, dm_loess, col = "purple", lwd = 2) legend("topright", legend = c("Raw", "Median+Mean", "P-spline", "EMA", "LOESS"), col = c("gray", "blue", "green", "orange", "purple"), lwd = 2) ## End(Not run)
Summarize clim.twd.stats output
## S3 method for class 'clim_twd_stats' summary(object, ...)## S3 method for class 'clim_twd_stats' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
An object of class "summary.clim_twd_stats".
Summarize clim.twd.test output
## S3 method for class 'clim_twd_test' summary(object, ...)## S3 method for class 'clim_twd_test' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
An object of class "summary.clim_twd_test".
Summarize a dm_epoch object
## S3 method for class 'dm_epoch' summary(object, ...)## S3 method for class 'dm_epoch' summary(object, ...)
object |
Object of class |
... |
Unused. |
An object of class "summary.dm_epoch".
Summarizes an object returned by [dm.growth.fit()] or [dm.growth.fit.double()].
## S3 method for class 'dm_growth_fit' summary(object, ...)## S3 method for class 'dm_growth_fit' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
An object of class "summary.dm_growth_fit".
Summarizes wavelet-analysis results produced by dm_wavelet().
For each analyzed series, the summary reports:
the dominant period in hours,
the corresponding maximum average wavelet power,
the analyzed period range in hours,
the detected temporal resolution.
## S3 method for class 'dm_wavelet' summary(object, top_n = 3, ...)## S3 method for class 'dm_wavelet' summary(object, top_n = 3, ...)
object |
An object of class |
top_n |
Integer. Number of strongest periods to report per series. |
... |
Further arguments passed to or from other methods. |
An object of class "summary.dm_wavelet".
Summarizes the output of dm_wavelet_reconstruct().
For each reconstructed series, the summary reports:
number of observations,
variance of the original series,
variance of the reconstructed component,
variance of the remaining component,
variance of the returned filtered series,
proportion of original variance represented by reconstructed and filtered series,
correlation and between original and reconstructed,
number and range of periods used in reconstruction.
## S3 method for class 'dm_wavelet_reconstruct' summary(object, ...)## S3 method for class 'dm_wavelet_reconstruct' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
An object of class "summary.dm_wavelet_reconstruct" with elements:
One-row summary of the reconstruction object.
Per-series summary table.
The table of periods actually used in the reconstruction.
The selection settings used for reconstruction.
Summarizes running dendrometer-climate correlations for both bootstrapped and non-bootstrapped outputs, and appends climate-specific settings to the summary tables.
## S3 method for class 'mov_cor_dm' summary(object, absolute = TRUE, top_n = 5, ...)## S3 method for class 'mov_cor_dm' summary(object, absolute = TRUE, top_n = 5, ...)
object |
Object of class |
absolute |
Logical. If |
top_n |
Integer. Number of top windows to return per climate variable. |
... |
Unused. |
A list of class "summary_mov_cor_dm" containing:
table: summary table for each climate variable
top_windows: top running windows per climate variable
metadata: metadata from the original object
call: original function call
This function detects the TWD phases, including their beginning (TWDb), using the phase.zg function. Then it calculates the number, time of occurance (Tm) and value of every local maximum within each TWD phase. In addition it calculates the time difference between 'TWDb' and each 'Tm' within each TWD phase.
twd.maxima(df, TreeNum, smoothing = 5)twd.maxima(df, TreeNum, smoothing = 5)
df |
data frame with first column containing date and time in the format |
TreeNum |
numerical value indicating the tree to be analysed. E.g. '1' refers to the first dendrometer data column in df. |
smoothing |
numerical value from 1 to 12 which indicates the length of the smoothing spline, i.e. 1 = 1 hour and 12 = 12 hours. Default is 5. |
A data frame with statistics of maxima in each TWD phase.
library(dendRoAnalyst) data(gf_nepa17) df1=gf_nepa17[2500:3500,] twd_max<-twd.maxima(df=df1, TreeNum=2) head(twd_max,10)library(dendRoAnalyst) data(gf_nepa17) df1=gf_nepa17[2500:3500,] twd_max<-twd.maxima(df=df1, TreeNum=2) head(twd_max,10)