dm_standardize: Standardize dendrometer series within seasonal years

View source: R/dm_normalize.R

dm_standardizeR Documentation

Standardize dendrometer series within seasonal years

Description

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.

Usage

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
)

Arguments

df

A data frame whose first column contains date-time (yyyy-mm-dd HH:MM:SS, POSIXct, or Date) and all remaining columns are dendrometer series.

season_type

One of "NH", "SH", or "CS".

CS_doys

Optional numeric vector of length 2 defining the start and end DOY for season_type = "CS".

method

Standardization method. One of:

  • "center": subtract seasonal reference value

  • "amplitude": subtract reference and divide by seasonal range

  • "robust_amplitude": subtract reference and divide by Q_high - Q_low

  • "minmax": rescale to (x - min)/(max - min)

  • "zscore": seasonal z-score

  • "robust_zscore": robust seasonal z-score using median and MAD

  • "percentile": convert seasonal values to percentiles in [0,1]

ref_type

Reference-value definition for methods that need a reference ("center", "amplitude", "robust_amplitude"). One of:

  • "first_value": first non-missing value in the seasonal year

  • "first_n_days": mean of the first ref_n_days unique days

  • "ref_window": mean of values within ref_doys

ref_n_days

Number of initial days used when ref_type = "first_n_days".

ref_doys

Optional numeric vector of length 2 defining a DOY reference window when ref_type = "ref_window".

q_low

Lower quantile used by method = "robust_amplitude".

q_high

Upper quantile used by method = "robust_amplitude".

Value

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.

Examples


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)



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