threshold.exceedance.duration.index: Sum of spell lengths exceeding daily threshold

View source: R/indices.R

threshold.exceedance.duration.indexR Documentation

Sum of spell lengths exceeding daily threshold

Description

This function returns the number of spells of more than min.length days which exceed or are below the given threshold.

This routine compares data to the thresholds using the given operator, generating a series of TRUE or FALSE values; these values are then filtered to remove any sequences of less than min.length days of TRUE values. It then computes the lengths of the remaining sequences of TRUE values (spells) and sums their lengths.

The spells.can.span.years option controls whether spells must always terminate at the end of a period, or whether they may continue until the criteria ceases to be met or the end of the data is reached. The default for fclimdex is FALSE.

Usage

threshold.exceedance.duration.index(daily.temp, date.factor, jdays, thresholds,
  op = ">", min.length = 6, spells.can.span.years = TRUE,
  max.missing.days)

Arguments

daily.temp

Data to compute index on.

date.factor

Date factor to split by.

jdays

Timeseries of days of year.

thresholds

The thresholds to compare to.

op

The operator to use to compare data to threshold.

min.length

The minimum spell length to be considered.

spells.can.span.years

Whether spells can span years.

max.missing.days

Maximum number of NA values per time period.

Value

A timeseries of maximum spell lengths for each period.

See Also

climdex.wsdi.

Examples


prec.dat <- c(0.1, 3.0, 4.3, 1.9, 1.3, 6.0, 0, 0, 4.0, 1)
phony.date.factor <- factor(rep(1:2, each=5))

## With spells spanning years...
alttedi <- threshold.exceedance.duration.index(prec.dat,
phony.date.factor, rep(1:5, 2), rep(1, 5), ">=", 2, TRUE, 1)

## Without spells spanning years...
tedi <- threshold.exceedance.duration.index(prec.dat, phony.date.factor,
rep(1:5, 2), rep(1, 5), ">=", 2, FALSE, 1)


ECA-D/climind documentation built on Nov. 26, 2022, 10:20 a.m.