Threshold: Daily thresholds based on quantiles for n-dimensional arrays

Description Usage Arguments Value Examples

View source: R/Threshold.R

Description

This function computes the threshold based on a quantile value for each day of the year of the daily data input.

Usage

1
2
Threshold(data, dates = NULL, calendar = NULL, base.range = NULL,
  qtiles = 0.9, ncores = NULL, na.rm = FALSE)

Arguments

data

A numeric n-dimensional array containing daily data.

dates

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

calendar

A character indicating the calendar type.

base.range

The years used for computing the threshold.

qtiles

Numeric vector with values between 0 and 1 indicating the quantiles to be computed.

ncores

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

na.rm

A logical value. If TRUE, any NA and NaN's are removed before the quantiles are computed (default as FALSE).

Value

An array with similar dimensions as the data input, but without 'time' dimension, and a new 'jdays' dimension.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
##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))))
attr(time, "variables") <- metadata
attr(data, 'Variables')$dat1$time <- time

a <- Threshold(data, dates = NULL, base.range = NULL, qtiles = 0.9, ncores = NULL)
str(a)

ClimProjDiags documentation built on Jan. 7, 2021, 5:10 p.m.