# Extremes() examples
# Extremes(data, threshold, op = ">", min.length = 6, spells.can.span.years = TRUE, max.missing.days = 5, dates = NULL, timedim = NULL, ncores = NULL) 
Extremes()
Extremes(data = NULL)
Extremes(data = NULL, threshold = NULL)
Extremes(data = "a", threshold = NULL)
Extremes(data = "a", threshold = "b")
Extremes(data = 1, threshold = 1)
Extremes(data = 1, threshold = 1, timedim = NULL)
Extremes(data = 1, threshold = 1, timedim = 1)
Extremes(data = 1, threshold = 1, dates = ISOdate(1900, 1, 1), timedim = NULL)
time = ISOdate(1900, 1, 1)
metadata <- list(time = list(standard_name = 'time', long_name = 'time', 
                             calendar = 'standard',
                             units = 'days since 1970-01-01 00:00:00', prec = 'double', 
                             dim = list(list(name ='time', unlim = FALSE))))
attr(time, "variables") <- metadata
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL)
Extremes(data = 1, threshold = 1, dates = time, timedim = 1)
Extremes(data = 1, threshold = 1, dates = time, timedim = 2)
Extremes(data = 1, threshold = 1, dates = time, timedim = 2:3)
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL, min.length = 2:3)
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL, min.length = 2:3, spells.can.span.years = NULL)
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL, min.length = 2:3, spells.can.span.years = TRUE)
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL, min.length = 2:3, spells.can.span.years = c(TRUE, FALSE))
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL, min.length = 2:3, spells.can.span.years = c(TRUE, FALSE), 
         max.missing.days = 2)
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL, min.length = 2:3, spells.can.span.years = c(TRUE, FALSE), 
         max.missing.days = NULL)
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL, min.length = 2:3, spells.can.span.years = c(TRUE, FALSE), 
         max.missing.days = T)
Extremes(data = 1, threshold = 1, dates = time, timedim = NULL, min.length = 2:3, spells.can.span.years = c(TRUE, FALSE), 
         max.missing.days = 2:3)
Extremes(data = 1, threshold = 1, dates = time, min.length = NULL)


data = 1 : (2 * 3 * 4)
dim(data) <- c(2, 3, 4)
threshold = rep(2, 2 * 3 * 4)
dim(threshold) = c(2, 3, 4)
time = seq(ISOdate(1900, 1, 1), ISOdate(1900, 1, 4), "day")
attr(time, "variables") <- metadata
Extremes(data, threshold, dates = time, timedim = 3, min.length = 1)
dim(threshold) = c(lat = 2, lon = 3, jdays = 4)
Extremes(data, threshold, dates = time, timedim = 3, min.length = 1)