View source: R/compute.indices.for.stripe.R
compute.indices.for.stripe | R Documentation |
Compute Climdex indices for a subset / stripe
compute.indices.for.stripe( subset, metadata.config, cdx.funcs, ts, base.range, dim.axes, v.f.idx, variable.name.map, src.units, t.f.idx, thresholds.name.map, projection = NULL, f, thresholds.netcdf )
subset |
The subset to use. |
cdx.funcs |
The functions to be applied to the data, as created by |
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. |
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. |
projection |
A proj4 string representing the projection the data is in. |
f |
A list of objects of type |
thresholds.netcdf |
A list of objects of type |
dest.units |
The destination units to convert to. |
Given a subset, a set of Climdex functions (as created by get.climdex.functions
), and ancillary data, load and convert data, create a climdexInput object for each point, run all of the functions in cdx.funcs
on that data, and return the result.
This function relies on an object named 'f' and containing the opened NetCDF files being part of the global namespace.
## Define mappings and filenames. author.data <- list(institution="Looney Bin", institution_id="LBC") input.files <- c("pr_NAM44_CanRCM4_ERAINT_r1i1p1_1989-2009.nc") variable.name.map <- c(tmax="tasmax", tmin="tasmin", prec="pr") ## Open files, etc. cdx.funcs <- get.climdex.functions(get.climdex.variable.list("tmax")) f <- lapply(input.files, ncdf4::nc_open) f.meta <- create.file.metadata(f, variable.name.map) climdex.var.list <- get.climdex.variable.list(names(f.meta$v.f.idx), "all", NULL) cdx.meta <- get.climdex.variable.metadata(climdex.var.list, input.files[1]) ## Compute indices for stripe cdx <- compute.indices.for.stripe(list(Y=1), cdx.funcs, f.meta$ts, c(1981, 1990), f.meta$dim.axes, f.meta$v.f.idx, variable.name.map, f.meta$src.units, f.meta$dest.units, t.f.idx, NULL, f=f, thresholds.netcdf=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.