clim.twd: Calculate relative dendrometer change during adverse climate...

View source: R/clim.twd.R

clim.twdR Documentation

Calculate relative dendrometer change during adverse climate periods and the following normal phase

Description

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.

Usage

clim.twd(
  df,
  Clim,
  dailyValue = "max",
  thresholdClim = "<10",
  thresholdDays = ">5",
  showPlot = TRUE
)

Arguments

df

A data frame with the first column containing date-time stamps (yyyy-mm-dd HH:MM:SS, convertible to POSIXct) and subsequent columns containing dendrometer series.

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 "max", "min", "mean", or "sum". Default is "max".

thresholdClim

Character string defining the climate threshold. Supported forms are:

  • "<5", "<=5", ">5", ">=5", "==5"

  • "between(5,10)"

  • "5:10"

thresholdDays

Character string defining the minimum duration threshold for consecutive adverse days. Must use a single-threshold form such as ">5" or ">=3".

showPlot

Logical. If TRUE, diagnostic plots are produced and the user can interactively choose IDs and phase type ("adverse", "normal", or "both"). Default is TRUE.

Details

The algorithm works as follows:

  1. Climate data are thresholded to identify adverse days.

  2. Consecutive adverse days are grouped into candidate adverse runs.

  3. Only runs satisfying thresholdDays are retained as true adverse events.

  4. 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).

  5. Dendrometer data are resampled to daily resolution using dendro.resample.

  6. 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".

Value

A list of class "clim_twd_output" containing:

adverse_change

A data frame of relative dendrometer change during adverse phases only.

normal_change

A data frame of relative dendrometer change during the following normal phases only.

full_period_change

A data frame of relative dendrometer change across adverse + following normal phase, reset to 0 at each adverse start.

continuous_full_period_change

A data frame similar to full_period_change, but values continue from the end of the previous full period instead of resetting to 0.

period_info

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.

phase_table

A data frame with adverse and normal phase boundaries for each ID.

Note

If the dendrometer and climate datasets have different time spans, analysis is automatically restricted to their common overlap.

References

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3389/fpls.2019.00342")}

See Also

dendro.resample, phase.zg, phase.sc

Examples


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
)



dendRoAnalyst documentation built on May 20, 2026, 5:07 p.m.