View source: R/get.quantiles.for.stripe.R
| get.quantiles.object | R Documentation |
Extract a single quantiles object from a set of thresholds.
get.quantiles.object(thresholds, idx, metadata.config)
thresholds |
The thresholds, as extracted by |
idx |
The index to extract. |
From a set of thresholds as retrieved from one or more NetCDF files containing thresholds, this function extracts a single point and converts the format to one suitable for passing to climdexInput.raw.
A quantiles object suitable for passing to climdexInput.raw as the quantiles argument.
## 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)
## Get quantiles object for index 2
q <- get.quantiles.object(dat, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.