grid2PCs: Projection of a grid onto an EOF

View source: R/grid2PCs.R

grid2PCsR Documentation

Projection of a grid onto an EOF

Description

Projection of a grid onto a user-defined EOF

Usage

grid2PCs(prinCompObj, grid, n.pcs = NULL)

Arguments

prinCompObj

An object created by prinComp

grid

Input grid to project. Multigrids are not allowed.

n.pcs

Number of principal components to be retained. Default to the number of EOFs contained in the input prinCompObj.

Details

The function is intended to project a grid onto user specified EOFs, contained in prinCompObj. Note that the grid should have the same spatial extent and resolution than the original EOF, so input grids from different models should be first interpolated. Also, to ensure consistency, both objects should contain the same variable name.

Note that the function is not currently implemented to deal with decadal predictions (i.e., 'runtime' dimension is not handled)

Value

A list, each component corresponding to a member (a list of length 1 if the projected grid is not multimember), containing a matrix of PCs, being the number of columns defined by n.pcs, and the number of rows by the length of the time dimension.

Author(s)

J Bedia

See Also

prinComp for EOF analysis.

Other pca: PC2grid(), gridFromPCA(), prinComp()

Examples


require(climate4R.datasets) 
# Obtain the Sea-level pressure PCs of CFSv2 forecast using the NCEP reanalysis EOF:
data("NCEP_Iberia_psl")
NCEP_psl_PCAobject <- prinComp(NCEP_Iberia_psl, v.exp = .95)
data("CFS_Iberia_psl")
# Need to be in the same spatial coordinates
CFS_psl_grid <- interpGrid(CFS_Iberia_psl, new.coordinates = getGrid(NCEP_Iberia_psl))
# Need to have the same short name of the variable
CFSv2_PCs <- grid2PCs(NCEP_psl_PCAobject, grid = CFS_psl_grid)
str(CFSv2_PCs)


SantanderMetGroup/transformeR documentation built on Nov. 25, 2024, 1:25 p.m.