rtsa.eof: EOF (Empirical Orthogonal Functions analysis)

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/rtsa.eof.R

Description

This function conducts an Empirical Orthogonal Function analysis (EOF) via a covariance matrix (cov4gappy function) using "sinkr" package especially designed to handle gappy raster time series

Usage

1
2
3
rtsa.eof(rasterts, rastermask = NULL, nu = NULL, gapfill = "none",
  centered = TRUE, scaled = FALSE, method = "svds", recursive = FALSE,
  cores = 1L, verbose = FALSE)

Arguments

rasterts

Input raster time series as RasterStackTS or RasterBrickTS object.

rastermask

Either a RasterLayer or "compute". Raster layer to use as a mask. When "compute" is set raster mask is computed to remove all pixels with incomplete time series.

nu

Numeric. Defines the number of EOFs to return. Defaults to return the full set of EOFs.

gapfill

Character. Defines the algorithm to be used to interpolate pixels with incomplete temporal profiles. Accepts argument supported as method in function rtsa.gapfill.

centered

Logical. If TRUE center the input data before EOF computation. Argument is passed through to function eof.

scaled

Logical. If TRUE scale the input data before EOF computation. Argument is passed through to function eof.

cores

Integer. Defines the number of CPU to be used for multicore processing. Default to "1" core for singlecore processing. Applies only to the masking step.

...

Additional arguments to be passed through to function eof.

Value

Object of class EOFstack containing the following components:

eof.modes EOF modes as RasterBrick object
expansion_coefficients EOF Expansion Coefficients (EC) as xts object
total_variance Numeric. Total variance of input raster time series
explained_variance Numeric vector. Percentage of variance explained by each EOF mode with respect to the total variance of input raster time series
center Center values from each pixel temporal profile as RasterLayer object (only computed if centered = TRUE)
scale Scale values from each pixel temporal profile as RasterLayer object (only computed if scaled = TRUE)

Author(s)

Federico Filipponi

References

Bjoernsson, H. and Venegas, S.A. (1997). "A manual for EOF and SVD analyses of climate data", McGill University, CCGCR Report No. 97-1, Montreal, Quebec, 52pp.

Marc, T.H., Losch, M., Wenzel, M., Schroeter, J. (2013). On the Sensitivity of Field Reconstruction and Prediction Using Empirical Orthogonal Functions Derived from Gappy Data. Journal of Climate, 26, 9194-9205. pdf

See Also

eof, rtsa.scaleEOF, rtsa.gapfill

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
## create raster time series using the 'pacificSST' data from 'remote' package
require(remote)

data(pacificSST)
pacificSST[which(getValues(pacificSST == 0))] <- NA # set NA values
# create rts object
rasterts <- rts(pacificSST, seq(as.Date('1982-01-15'), as.Date('2010-12-15'), 'months'))

## generate raster mask
raster_mask <- pacificSST[[1]] # create raster mask
names(raster_mask) <- "mask"
values(raster_mask) <- 1 # set raster mask values
raster_mask[which(is.na(getValues(pacificSST[[1]])))] <- 0 # set raster mask values

## compute EOF
# compute the first 10 EOFs
eof_result <- rtsa.eof(rasterts=rasterts, nu=10)
# recursively compute the first 10 EOFs using raster mask
eof_result_recursive <- rtsa.eof(rasterts=rasterts, rastermask=raster_mask, nu=10, recursive=T)
# compute the first 10 EOFs applying centering, scaling 
# and raster mask computing before eof computation
eof_res_masked <- rtsa.eof(rasterts=rasterts, rastermask="compute", nu=10, centered=T, scaled=T)

## End(Not run)

ffilipponi/rtsa documentation built on Oct. 18, 2019, 12:37 a.m.