get_departures: Calculate climate departures

View source: R/new_functions.R

get_departuresR Documentation

Calculate climate departures

Description

Calculates univariate or multivariate climate departures from baseline conditions

Usage

get_departures(
  vars,
  baseline.years,
  comparison.years,
  dist.method = c("mahalanobis", "sed"),
  yearbounds = NULL
)

Arguments

vars

a list of matrices with equal dimensions containing climate or weather data; nrow is the number of cells or points and ncol is the number of years

baseline.years

an integer vector of which years should be used for the historical period

comparison.years

an integer vector of which years should be the future period relative to baseline

dist.method

a character vector indicating if Mahalanobis ("mahalanobis") or Standardized Euclidean ("sed") distance should be used

yearbounds

a numeric vector of length 2 indicating the first and last year in the data

Details

This function makes all sorts of assumptions about your data, like that each column represents an individual year and that those years are sequential with the earliest year in the first column and no gaps between years.

If multiple variables are passed to the function (i.e. the list of vars has length > 2), it calculates a multivariate departure; if only one variable is passed to the function it returns a univariate departure.

Value

a matrix of climate departures where each row is a cell or point and each column is a year in the comparison period


elizagrames/climetric documentation built on Nov. 1, 2022, 6:26 a.m.