View source: R/create.thresholds.from.file.R
get.thresholds.chunk | R Documentation |
Retrieve thresholds for a subset
get.thresholds.chunk( subset, cdx.funcs, thresholds.netcdf, t.f.idx, thresholds.name.map )
subset |
The subset to use. |
cdx.funcs |
The functions to be applied to the data, as created by |
thresholds.netcdf |
One or more NetCDF files containing thresholds. |
t.f.idx |
A mapping from threshold variables to threshold files, as created by |
thresholds.name.map |
A mapping from standardized names (tx10thresh, tn90thresh, etc) to NetCDF variable names. |
Given a subset, a set of Climdex functions (as created by get.climdex.functions
), and ancillary data, load the thresholds required for the functions being called and return them.
## Define mappings and filenames. thresholds.name.map <- c(tx10thresh="tx10thresh", tn10thresh="tn10thresh", tx90thresh="tx90thresh", tn90thresh="tn90thresh", r95thresh="r95thresh", r99thresh="r99thresh") thresh.files <- "thresholds.nc" ## Open files, etc. cdx.funcs <- get.climdex.functions(get.climdex.variable.list("tmax")) thresholds.netcdf <- lapply(thresh.files, nc_open) t.f.idx <- get.var.file.idx(thresholds.name.map, lapply(thresholds.netcdf, ncdf4.helpers::nc.get.variable.list, min.dims=2)) ## Get thresholds chunk. dat <- get.thresholds.chunk(list(Y=1), cdx.funcs, thresholds.netcdf, t.f.idx, thresholds.name.map)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.