ck_r95p: Very Wet Days Total (R95p)

View source: R/precipitation.R

ck_r95pR Documentation

Very Wet Days Total (R95p)

Description

ETCCDI canonical index R95p. Annual total precipitation on days where daily precipitation exceeds the 95th percentile of wet-day precipitation in a reference period (default 1961 to 1990). A wet day is one with precipitation at or above 1 mm. The threshold is a single value derived from all wet days in the reference period (not calendar-day specific).

Usage

ck_r95p(precip, dates, ref_start = 1961L, ref_end = 1990L, period = "annual")

Arguments

precip

Numeric vector of daily precipitation (mm).

dates

Date vector of the same length as precip. Must contain data covering the reference period.

ref_start, ref_end

Integer. Reference period boundary years (inclusive). Defaults to 1961 and 1990.

period

Character. Aggregation period: "annual" (default) or "monthly".

Value

A data frame with columns period, value, index, and unit.

Examples

set.seed(1)
dates <- seq(as.Date("1961-01-01"), as.Date("1991-12-31"), by = "day")
precip <- pmax(rgamma(length(dates), shape = 0.4, scale = 8) - 1, 0)
tail(ck_r95p(precip, dates))

climatekit documentation built on May 9, 2026, 5:08 p.m.