% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/extract_pheno.R
\name{extract_pheno}
\alias{extract_pheno}
\title{Extract phenological metrics}
\usage{
extract_pheno(data, method = "trs", trs = 0.5, ...)
}
\arguments{
\item{data}{List of fitted time series as generated by function \code{fit_curve()}.}

\item{method}{Thresholding method among \code{"trs"}, \code{"derivatives"},
\code{"klosterman"} and \code{"gu"} (see \code{phenopix::PhenoExtract()}).}

\item{trs}{Argument passed to \code{phenopix::PhenoExtract()} if \code{method = "trs"}.
It is valid also for \code{method = "derivatives"} thanks to a \code{{sen2rts}}
implementation (it will be documented soon).
Other methods do not make use of this argument.}

\item{...}{Additional arguments passed to \code{phenopix::PhenoExtract()}.}
}
\value{
A data table with the following fields:
\itemize{
\item \code{id}: the time series ID (see \code{s2ts});
\item \code{year}: the year (integer);
\item \code{cycle}: the cycle ID (integer);
\item \code{begin}, \code{end}, \code{maxval}: the dates of begin, end and maximum value in
the cycle as computed by \code{cut_cycles()};
\item other phenology metrics, depending on \code{method}:
\itemize{
\item if \code{method = "trs"} or \code{"derivatives"}: \code{sos}, \code{eos}, \code{los}, \code{pop},
\code{mgs}, \code{rsp}, \code{rau}, \code{peak}, \code{msp}, \code{mau} (see
\code{phenopix::PhenoTrs()} or \code{phenopix::PhenoDeriv()});
\item if \code{method = "gu"}: \code{UD}, \code{SD}, \code{DD}, \code{RD}, \code{maxline}, \code{baseline},
\code{prr}, \code{psr}, \code{plateau.slope} (see \code{phenopix::PhenoGu()});
\item if \code{method = "klosterman"}: \code{Greenup}, \code{Maturity}, \code{Senescence},
\code{Dormancy} (see \code{phenopix::PhenoKl()}).
}
}
}
\description{
Extract phenological metrics from a fitted time series.
}
\examples{
# Load input data
data("cf")
data("ts_filled") # used for plots

# Default extraction ("trs" method with 50\% threshold)
dt_pheno <- extract_pheno(cf)
plot(ts_filled, fitted = cf, pheno = dt_pheno, plot_dates = TRUE)

\donttest{
# Customize parameters (e.g. "derivatives" method with 30\% threshold)
dt_pheno_2 <- extract_pheno(cf, method = "derivatives", trs = 0.3)
plot(ts_filled, fitted = cf, pheno = dt_pheno_2, plot_dates = TRUE)

# Other methods: Klosterman
dt_pheno_kl <- extract_pheno(cf, method = "klosterman")
plot(ts_filled, fitted = cf, pheno = dt_pheno_kl, plot_dates = TRUE)

# Other methods: Gu
dt_pheno_gu <- extract_pheno(cf, method = "gu")
plot(ts_filled, fitted = cf, pheno = dt_pheno_gu, plot_dates = TRUE)
}
}
\author{
Luigi Ranghetti, PhD (2020) \email{luigi@ranghetti.info}
}
