anomaly: Anomalies of a satin object

View source: R/anomaly.R

anomalyR Documentation

Anomalies of a satin object

Description

This function returns ocean data anomalies of a satin object. Anomalies are calculated subtracting a conforming average satin object.

Usage

anomaly(X, Y)

Arguments

X

a satin object obtained with satinMean for which anomalies are to be calculated. It must have identifying labels in the slot attribs.

Y

also a satin object returned by satinMean with the means to be subtracted from X. It must have the same labels as X.

Details

The anomalies of a satin object represent, for every pixel, the values above and below a reference average. A typical example can be monthly sea surface temperature anomalies for various years. These are calculated subtracting the corresponding average month for the whole period (see example below).

In principle, anomalies can be calculated for other ocean variables and time periods, but is up to the user to determine if that makes sense. For example, let say that Z is a satin object with daily chlorophyll-a concentration data for several years. In order to calculate quarterly anomalies, we will need first to obtain X <- satinMean(Z, "%Y-%qtr") and Y <- satinMean(Z, "%qtr").

Value

An object of class "satin" (see satin-class for details) where the third dimension in the data array accomodates the calculated anomalies. An extra element (labels) is included in the slot attribs to identify the time period of the anomalies.

Author(s)

Héctor Villalobos and Eduardo González-Rodríguez

See Also

satinMean for calculating ocean data averages needed, and climatology for climatologies.

Examples

if(interactive()){
# Calculate monthly sea surface temperature from weekly data.
# sst contains 240 weekly images for five years.

# This will produce the 12 average months for the five years
sst.m <- satinMean(sst, by="%m") 

# and here we have 60 monthly periods, 12 for each one of the five years
sst.ym <- satinMean(sst, by="%Y-%m") 

# monthly sea surface temperature anomalies
anom <- anomaly(X = sst.ym, Y = sst.m)

# the dimensions of the data slots in sst.ym and anom are the same.
dim(sst.ym@data); dim(anom@data)

# plots of the first 24 months
lab <- paste(month.name, rep(2014:2018, each=12))
for (m in 1:24){
  plot(anom, period = m, zlim=c(-10, 10), col.sep = 0.2, main = lab[m],
       scheme = c("blue", "cyan", "white", "yellow", "red"))
}
}

satin documentation built on Sept. 23, 2022, 1:06 a.m.