get.thresholds.chunk: Retrieve thresholds for a subset

View source: R/create.thresholds.from.file.R

get.thresholds.chunkR Documentation

Retrieve thresholds for a subset

Description

Retrieve thresholds for a subset

Usage

get.thresholds.chunk(
  subset,
  cdx.funcs,
  thresholds.netcdf,
  t.f.idx,
  thresholds.name.map
)

Arguments

subset

The subset to use.

cdx.funcs

The functions to be applied to the data, as created by get.climdex.functions.

thresholds.netcdf

One or more NetCDF files containing thresholds.

t.f.idx

A mapping from threshold variables to threshold files, as created by get.var.file.idx.

thresholds.name.map

A mapping from standardized names (tx10thresh, tn90thresh, etc) to NetCDF variable names.

Details

Given a subset, a set of Climdex functions (as created by get.climdex.functions), and ancillary data, load the thresholds required for the functions being called and return them.

Examples


## 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)



ECA-D/ecad_indices_grid documentation built on Nov. 23, 2022, 6:04 a.m.