get.quantiles.object: Extract a single quantiles object from a set of thresholds.

View source: R/get.quantiles.for.stripe.R

get.quantiles.objectR Documentation

Extract a single quantiles object from a set of thresholds.

Description

Extract a single quantiles object from a set of thresholds.

Usage

get.quantiles.object(thresholds, idx, metadata.config)

Arguments

thresholds

The thresholds, as extracted by get.thresholds.chunk.

idx

The index to extract.

Details

From a set of thresholds as retrieved from one or more NetCDF files containing thresholds, this function extracts a single point and converts the format to one suitable for passing to climdexInput.raw.

Value

A quantiles object suitable for passing to climdexInput.raw as the quantiles argument.

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)

## Get quantiles object for index 2
q <- get.quantiles.object(dat, 2)



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