create.thresholds.from.file: Create Climdex thresholds used for computing threshold-based...

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

create.thresholds.from.fileR Documentation

Create Climdex thresholds used for computing threshold-based indices

Description

Create Climdex thresholds used for computing threshold-based indices

Usage

create.thresholds.from.file(
  input.files,
  output.file,
  author.data,
  axis.to.split.on = "Y",
  base.range = c(1961, 1990),
  parallel = 4,
  verbose = FALSE,
  max.vals.millions,
  cluster.type = "SOCK"
)

Arguments

input.files

A list of filenames of NetCDF files to be used as input. A NetCDF file may contain one or more variables.

output.file

The name of the file to be created.

author.data

A vector containing named elements describing the author; see create.indices.from.files.

axis.to.split.on

The axis to split up the data on for parallel / incremental processing.

base.range

Vector of two numeric years specifying the start and end years.

parallel

The number of parallel processing threads, or FALSE if no parallel processing is desired.

verbose

Whether to be chatty.

max.vals.millions

The number of data values to process at one time (length of time dim * number of values * number of variables).

cluster.type

The cluster type, as used by the snow library.

Details

For many applications, one may want to compute thresholds on one data set, then apply them to another. This is usually the case when comparing GCM (Global Climate Model) results for future time periods to either historical reanalysis data or historical / pre-industrial control runs from models. The purpose of this function is to compute these thresholds on the data supplied, saving them to the file specified. Then these thresholds can be used with create.indices.from.files to compute indices using the thresholds computed using this code.

The metadata is stored in JSON files that are included with the pacakge. Right now, the metadata relevant to EOBS is used by default. To switch to another set of metadata, use the metadata.id global option:

options(metadata.id = 'eobs')

Note that currently only EOBS metadata is available (metadata.id = 'eobs').

Note

NetCDF input files may contain one or more variables, named as per variable.name.map (read from config json file). The code will search the files for the named variables.

Examples

## Not run: 
## Prepare input data and calculate thresholds for file.
input.files <- c("pr_NAM44_CanRCM4_ERAINT_r1i1p1_1989-2009.nc")
author.data <- list(institution="Looney Bin", institution_id="LBC")
create.thresholds.from.file(input.files, "thresh.nc", author.data,
                            base.range=c(1991, 2000), parallel=FALSE)

## End(Not run)


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