% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dm_join_subdaily_clim.R
\name{dm_join_subdaily_clim}
\alias{dm_join_subdaily_clim}
\title{Join subdaily climate features to point-level dendrometer output}
\usage{
dm_join_subdaily_clim(x, clim_sub)
}
\arguments{
\item{x}{Object returned by \code{phase.zg()} or \code{phase.sc()}.}

\item{clim_sub}{Climate input. This can be a subdaily climate-feature table,
a standardized climate object returned by \code{read.climate()}, a raw
climate data frame, or a valid climate file path.}
}
\value{
The same phase object with climate features appended to \code{ZG_phase} or
\code{SC_phase}. The returned object has class
\code{c("ZG_output_clim", "ZG_output", ...)} or
\code{c("SC_output_clim", "SC_output", ...)}.
}
\description{
Joins timestamp-level subdaily climate features to point-level output from
\code{phase.zg()} or \code{phase.sc()}.

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

If the supplied climate input is not already a subdaily climate-feature table,
the function attempts to standardize it with \code{read.climate()} and then
joins by exact timestamp using the \code{TIME} column.
}
\examples{
\donttest{
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)
}

}
