View source: R/write.results.R
write.climdex.results | R Documentation |
Write out computed climdex results
write.climdex.results( climdex.results, chunk.subset, cdx.ncfile, dim.size, cdx.varname )
climdex.results |
The results to write out. |
chunk.subset |
The corresponding subset. |
cdx.ncfile |
The list of NetCDF files to write the results out to. |
dim.size |
The overall size of the input data. |
cdx.varname |
The list of NetCDF variable names for the files in |
Given a set of Climdex results, a subset, a set of files, and dimension sizes, write out the data to the appropriate files.
## 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("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]) ## 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) ## Compute indices for stripe cdx <- compute.indices.for.stripe(list(Y=1), cdx.funcs, f.meta$ts, c(1991, 2000), 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) ## Write out indices write.climdex.results(cdx, list(Y=1), cdx.ncfile, f.meta$dim.size, cdx.meta$varname)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.