View source: R/create.thresholds.file.R
create.thresholds.file | R Documentation |
Creates Climdex thresholds output file.
create.thresholds.file( thresholds.file, f, ts, v.f.idx, variable.name.map, base.range, dim.size, dim.axes, threshold.dat, author.data )
thresholds.file |
The filename to be used for the thresholds file. |
f |
The file(s) being used as sources for metadata. |
ts |
The associated time data, as created by |
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. |
base.range |
The base range; a vector of two numeric years. |
dim.size |
Dimension sizes for the input. |
dim.axes |
Dimension axes for the input. |
threshold.dat |
Threshold metadata, as provided by |
author.data |
A vector containing named elements describing the author; see |
This function creates a file suitable for outputting thresholds to, with all variables that can be created with the input data present in the file.
An object of class ncdf4
.
## 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(1981,1990), f.meta$dim.size, f.meta$dim.axes, threshold.dat, author.data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.