get.quantiles.for.stripe: Compute Climdex thresholds for a subset / stripe

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

get.quantiles.for.stripeR Documentation

Compute Climdex thresholds for a subset / stripe

Description

Compute Climdex thresholds for a subset / stripe

Usage

get.quantiles.for.stripe(
  subset,
  ts,
  base.range,
  dim.axes,
  v.f.idx,
  variable.name.map,
  src.units,
  f
)

Arguments

subset

The subset to use.

ts

The associated time data, as created by nc.get.time.series.

base.range

The base range; a vector of two numeric years.

dim.axes

The dimension axes for the input data.

v.f.idx

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

variable.name.map

A mapping from standardized names (tmax, tmin, prec) to NetCDF variable names.

src.units

The source units to convert data from.

f

A list of objects of type ncdf4, consisting of the open input files. If missing, will be pulled from the global namespace.

dest.units

The destination units to convert to.

Details

Given a subset and ancillary data, load and convert data, get the out-of-base quantiles for the data for each point, and return the result.

Note

This function relies on an object named 'f' and containing the opened NetCDF files being part of the global namespace.

Examples


## 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(1991, 2000), f.meta$dim.size, f.meta$dim.axes,
                                      threshold.dat, author.data)

## Compute threshold quantiles for stripe
q <- get.quantiles.for.stripe(list(Y=1), 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, f)



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