% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/temperature.R
\name{ck_warm_spell}
\alias{ck_warm_spell}
\title{Warm Spell Days (Series-Quantile Approximation)}
\usage{
ck_warm_spell(tmax, dates, threshold = 0.9, period = "annual")
}
\arguments{
\item{tmax}{Numeric vector of daily maximum temperatures (degrees C).}

\item{dates}{Date vector of the same length as \code{tmax}.}

\item{threshold}{Numeric. Quantile threshold (default 0.9, i.e. 90th
percentile).}

\item{period}{Character. Aggregation period: \code{"annual"} (default) or
\code{"monthly"}.}
}
\value{
A data frame with columns \code{period}, \code{value}, \code{index}, and \code{unit}.
}
\description{
Count the number of days in warm spells, where a warm spell is defined
as at least six consecutive days with Tmax above the \code{threshold}
quantile of the full input series. This is a quick approximation
driven by a single series-wide quantile, and does not require a
reference period.
}
\details{
For the canonical ETCCDI WSDI definition (1961-1990 calendar-day base,
six-day spell rule), use \code{\link[=ck_wsdi]{ck_wsdi()}}.
}
\examples{
dates <- as.Date("2024-01-01") + 0:364
set.seed(42)
tmax <- rnorm(365, mean = 20, sd = 5)
ck_warm_spell(tmax, dates)
}
