indexGrid: Climate Indices in Climate4R

View source: R/indexGrid.R

indexGridR Documentation

Climate Indices in Climate4R

Description

Calculation of indices.

Usage

indexGrid(
  tn = NULL,
  tx = NULL,
  tm = NULL,
  pr = NULL,
  any = NULL,
  baseline = NULL,
  index.code,
  time.resolution = "year",
  ...,
  parallel = FALSE,
  max.ncores = 16,
  ncores = NULL
)

Arguments

tn

A climate4R dataset of daily minimum temperature (degrees C)

tx

A climate4R dataset of daily maximum temperature (degrees C)

tm

A climate4R dataset of daily maximum temperature (degrees C)

pr

A climate4R dataset of daily precipitation (mm)

any

A climate4R dataset of any variable.

baseline

Optional climate4R dataset. Only used if index.code = "P", for calculating the relevant percentiles.

index.code

Character string, indicating the specific code of the index (see Details).

time.resolution

Output time resolution. Choices are "month", "year" (default) and "climatology".

...

Optional. A list of arguments internally passed to the functions displayed by indexShow.

parallel

Logical. Should parallel execution be used?

max.ncores

Integer. Upper bound for user-defined number of cores.

ncores

Integer number of cores used in parallel computation. Self-selected number of cores is used when ncpus = NULL (the default), or when maxcores exceeds the default ncores value.

Details

indexShow will display on screen the full list of available indices and their codes. The names of the internal functions calculating each index is also displayed, whose help files can aid in the definition of index-specific arguments.

Parallel Processing

Parallel processing is enabled using the parallel package. Parallelization is undertaken by a FORK-type parallel socket cluster formed by ncores. If ncores is not specified (default), ncores will be one less than the autodetected number of cores. The maximum number of cores used for parallel processing can be set with the max.ncores argument, although this will be reset to the auto-detected number of cores minus 1 if this number is exceeded. Note that not all code, but just some critical loops within the function are parallelized.

In practice, parallelization does not always result in smaller execution times, due to the parallel overhead. However, parallel computing may potentially provide a significant speedup for the particular case of large multimember datasets or large grids.

Parallel computing is currently not available for Windows machines.

Author(s)

M. Iturbide

Examples

require(climate4R.datasets)
data("EOBS_Iberia_tas")
data("CFS_Iberia_tas")
fd <- indexGrid(tn = EOBS_Iberia_tas,
                time.resolution = "year",
                index.code = "FD")
per1 <- indexGrid(tn = EOBS_Iberia_tas,
                 time.resolution = "year",
                 index.code = "P",
                 percent = 90)
per2 <- indexGrid(tn = CFS_Iberia_tas,
                time.resolution = "year",
                index.code = "P",
                baseline = CFS_Iberia_tas,
                percent = 90)
hdd <- indexGrid(tn = CFS_Iberia_tas,
                 tx = CFS_Iberia_tas,
                 tm = CFS_Iberia_tas,
                 time.resolution = "year",
                 index.code = "HDD")

SantanderMetGroup/climate4R.indices documentation built on July 3, 2023, 11:02 p.m.