% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dm_join_phase_clim.R
\name{dm_join_phase_clim}
\alias{dm_join_phase_clim}
\title{Join climate summaries to dendrometer phase windows}
\usage{
dm_join_phase_clim(
  x,
  clim_df,
  mean_vars = NULL,
  min_vars = NULL,
  max_vars = NULL,
  sum_vars = NULL,
  median_vars = NULL,
  suffix = "_phase"
)
}
\arguments{
\item{x}{Object returned by \code{phase.zg()} or \code{phase.sc()}.}

\item{clim_df}{Climate input. This can be a standardized climate object
returned by \code{read.climate()}, a raw climate data frame, or a valid
climate file path.}

\item{mean_vars}{Character vector of climate variables to summarize by mean
within each phase window.}

\item{min_vars}{Character vector of climate variables to summarize by minimum
within each phase window.}

\item{max_vars}{Character vector of climate variables to summarize by maximum
within each phase window.}

\item{sum_vars}{Character vector of climate variables to summarize by sum
within each phase window.}

\item{median_vars}{Character vector of climate variables to summarize by median
within each phase window.}

\item{suffix}{Character suffix appended to the generated climate summary
columns. Default is \code{"_phase"}.}
}
\value{
The same phase object with climate summaries appended to \code{ZG_cycle} or
\code{SC_cycle}. The returned object has class
\code{c("ZG_output_clim", "ZG_output", ...)} or
\code{c("SC_output_clim", "SC_output", ...)}.
}
\description{
Summarizes climate conditions within each phase window of
\code{phase.zg()} or \code{phase.sc()} output and appends those summaries to
\code{ZG_cycle} or \code{SC_cycle}.

The climate input can be:
\itemize{
  \item the output of \code{read.climate()}
  \item a raw climate data frame
  \item a valid climate file path readable by \code{read.climate()}
}

Climate variables are summarized over each phase interval defined by the
\code{Start} and \code{End} columns of the phase-cycle table.
}
\examples{
\donttest{
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)
}

}
