anomalies: Compute anomalies with respect to reference period

Description Usage Arguments Details Examples

View source: R/anomalies.R

Description

This function computes anomalies with respect to a given reference period. For the function to work, the reference period must be fully in the time series provided.

Usage

1
2
anomalies(x, anomaly = c(1961, 1990), relative = FALSE, na.thresh = 0.8,
  rel.thresh = 1e+06, zero.thresh = 1)

Arguments

x

object of type NetCDF

anomaly

start and end year of reference period

relative

logical, should relative anomalies (in percent) be computed?

na.thresh

minimum fraction of non-missing values in reference period

rel.thresh

if relative anomalies larger than rel.thresh occur, no relative anomalies for this time series is computed

zero.thresh

maximum fraction of zeroes in reference period (see details)

Details

If relative anomalies are computed, both rel.thresh and zero.thresh can be used to deal with cases for which the reference period climatology is close to zero. rel.thresh masks all seasonal time series for which there is at least one relative anomaly larger than the indicated threshold. zero.thresh on the other hand uses the fraction of zeroes in the reference period, and masks seasonal time series with more than the indicated fraction of zeroes in the reference period as missing. For example, if set to 1 (the default), only time series with a reference climatology of zero (all values equal zero in the reference period) will be masked.

Examples

1
2
3
4
5
6
7
8
tas <- readNetCDF(system.file("extdata", "annual_CRUTEMv3_1961-90.nc", package="geoutils"), varname="temp")
## compute anomalies wrt first year of series
tasanom <- anomalies(tas, c(1961,1961))
## get a grid point with many obs
si <- which.max(apply(!is.na(tasanom), 1, sum))
## plot time series of anomalies
plot(tasanom, type='ts', si=si)
abline(h=0, lty=2)

jonasbhend/geoutils documentation built on May 19, 2019, 7:27 p.m.