View source: R/get.quantiles.for.stripe.R
get.quantiles.for.stripe | R Documentation |
Compute Climdex thresholds for a subset / stripe
get.quantiles.for.stripe( subset, ts, base.range, dim.axes, v.f.idx, variable.name.map, src.units, f )
subset |
The subset to use. |
ts |
The associated time data, as created by |
base.range |
The base range; a vector of two numeric years. |
dim.axes |
The dimension axes for the input data. |
v.f.idx |
A mapping from variables to files, as created by |
variable.name.map |
A mapping from standardized names (tmax, tmin, prec) to NetCDF variable names. |
src.units |
The source units to convert data from. |
f |
A list of objects of type |
dest.units |
The destination units to convert to. |
Given a subset and ancillary data, load and convert data, get the out-of-base quantiles for the data for each point, and return the result.
This function relies on an object named 'f' and containing the opened NetCDF files being part of the global namespace.
## Establish basic inputs. author.data <- list(institution="Looney Bin", institution_id="LBC") input.files <- c("pr_NAM44_CanRCM4_ERAINT_r1i1p1_1989-2009.nc") ## Prepare derived inputs. f <- lapply(input.files, ncdf4::nc_open) variable.name.map <- c(tmax="tasmax", tmin="tasmin", prec="pr") f.meta <- create.file.metadata(f, variable.name.map) threshold.dat <- get.thresholds.metadata(names(f.meta$v.f.idx)) ## Create output file thresh.file <- create.thresholds.file("thresh.nc", f, f.meta$ts, f.meta$v.f.idx, variable.name.map, c(1991, 2000), f.meta$dim.size, f.meta$dim.axes, threshold.dat, author.data) ## Compute threshold quantiles for stripe q <- get.quantiles.for.stripe(list(Y=1), f.meta$ts, c(1991, 2000), f.meta$dim.axes, f.meta$v.f.idx, variable.name.map, f.meta$src.units, f.meta$dest.units, f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.