View source: R/create.ncdf.output.files.R
| create.ncdf.output.files | R Documentation |
Creates output files for Climdex variables.
create.ncdf.output.files( cdx.dat, f, v.f.idx, variable.name.map, ts, time.origin, base.range, out.dir, author.data, metadata.config )
cdx.dat |
The variable description data, as created by |
f |
The file(s) being used as input. |
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. |
ts |
The associated time data, as created by |
time.origin |
The time origin, as specified in the source NetCDF file(s). |
base.range |
The base range; a vector of two numeric years. |
out.dir |
The output directory name. |
author.data |
A vector containing named elements describing the author; see |
This function creates a set of output files for the set of variable parameters passed in cdx.dat, as created by get.climdex.variable.metadata. It copies metadata from input files as appropriate and adds new metadata as required.
A list of objects of type 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)
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])
## Create output files
cdx.ncfile <- create.ncdf.output.files(cdx.meta, f, f.meta$v.f.idx, variable.name.map,
f.meta$ts, get.time.origin(f, f.meta$dim.axes),
c(1981,1990), "/foo", author.data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.