Extremes {ClimProjDiags}R Documentation

Sum of spell lengths exceeding daily threshold for n-dimensional arrays


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


Extremes(data, threshold, op = ">", min.length = 6,
  spells.can.span.years = TRUE, max.missing.days = 5, dates = NULL,
  timedim = NULL, calendar = NULL, ncores = NULL)



A n-dimensional array containing daily data.


A n-dimensional array with the threshold to be/not to be reach, usually given by the a percentile computed with the Threshold function.


The operator to use to compare data to threshold.


The minimum spell length to be considered.


Whether spells can span years.


Maximum number of NA values per time period.


A vector of dates with a calendar attributes. If NULL (by default), the 'time' attributes of parameter 'data' are considered.


An integer number indicating the position of the time dimension in the parameter data. If NULL (by default), the dimension called 'time' in parameter data.


A character indicating the calendar type.


The number of cores to be used when computing the extreme.


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.spa .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.


A list of length 2:


##Example synthetic data:
data <- 1:(2 * 3 * 372 * 1)
dim(data) <- c(time = 372, lon = 2, lat = 3, model = 1)
time <- as.POSIXct(paste(sort(rep(1900:1911, 31)), 1, 1:31, sep = "-"), tz = "CET")
metadata <- list(time = list(standard_name = 'time', long_name = 'time',  calendar = 'noleap', 
                            units = 'days since 1970-01-01 00:00:00', prec = 'double', 
                            dim = list(list(name = 'time', unlim = FALSE))))
threshold = rep(40, 31)
attr(time, "variables") <- metadata
attr(data, 'Variables')$dat1$time <- time

a <- Extremes(data, threshold = threshold, op = ">", min.length = 6, spells.can.span.years = TRUE, 
             max.missing.days = 5, ncores = NULL)

[Package ClimProjDiags version 0.1.1 Index]