Package {remote}


Title: Empirical Orthogonal Teleconnections in R
Version: 1.3.0
Maintainer: Tim Appelhans <tappelhans@tutamail.com>
Description: Empirical orthogonal teleconnections in R. 'remote' is short for 'R(-based) EMpirical Orthogonal TEleconnections'. It implements a collection of functions to facilitate empirical orthogonal teleconnection analysis. Empirical Orthogonal Teleconnections (EOTs) denote a regression based approach to decompose spatio-temporal fields into a set of independent orthogonal patterns. They are quite similar to Empirical Orthogonal Functions (EOFs) with EOTs producing less abstract results. In contrast to EOFs, which are orthogonal in both space and time, EOT analysis produces patterns that are orthogonal in either space or time.
License: GPL (≥ 3) | file LICENSE
Depends: Rcpp (≥ 0.10.3), methods, R (≥ 3.5)
Imports: grDevices, stats, terra, utils
Suggests: checkmate, maps, raster, tinytest
LinkingTo: Rcpp
Encoding: UTF-8
Config/roxygen2/version: 8.1.1
LazyData: true
NeedsCompilation: yes
Packaged: 2026-11-30 09:09:44 UTC; tim
Author: Tim Appelhans [cre, aut], Florian Detsch [aut], Thomas Nauss [ctb]
Repository: CRAN
Date/Publication: 2026-11-30 15:00:02 UTC

R EMpirical Orthogonal TEleconnections

Description

A collection of functions to facilitate empirical orthogonal teleconnection analysis. Some handy functions for preprocessing, such as deseasoning, denoising, lagging are readily available for ease of usage.

Details

R EMpirical Orthogonal TEleconnections

Author(s)

Tim Appelhans, Florian Detsch, Thomas Nauss

Maintainer: Tim Appelhans tappelhans@tutamail.com

References

Empirical Orthogonal Teleconnections
H. M. van den Dool, S. Saha, A. Johansson (2000)
Journal of Climate, Volume 13, Issue 8 (April 2000) pp. 1421 - 1435

Empirical methods in short-term climate prediction
H. M. van den Dool (2007)
Oxford University Press, Oxford, New York (2007)

See Also

remote is built upon the terra package, which is the direct successor of the raster package. The terra package is used for raster data handling and processing, while raster is still supported but not actively developed anymore. For more information on raster data handling, please refer to the documentation of the terra package and its functions.


Calculate a single EOT

Description

Calculates a single EOT and is controlled by the main eot() function.

Usage

EotCycle(
  x,
  y,
  n = 1,
  standardised,
  orig.var,
  write.out,
  path.out,
  prefix,
  type = c("rsq", "ioa"),
  verbose,
  ...
)

Arguments

x, y, n, standardised, write.out, path.out, prefix, type, verbose

See eot().

orig.var

original variance of the response domain

...

Further arguments passed to writeEot() if write.out = TRUE.


Class EotMode

Description

Class EotMode

Slots

mode

the number of the identified mode

name

the name of the mode

eot

the EOT (time series) at the identified base point. Note, this is a simple numeric vector

coords_bp

the coordinates of the identified base point

cell_bp

the cell number of the indeified base point

cum_exp_var

the cumulative explained variance of the considered EOT mode

r_predictor

SpatRaster of the correlation coefficients between the base point and each pixel of the predictor domain

rsq_predictor

as above but for the coefficient of determination of the predictor domain

rsq_sums_predictor

as above but for the sums of coefficient of determination of the predictor domain

int_predictor

SpatRaster of the intercept of the regression equation for each pixel of the predictor domain

slp_predictor

as above but for the slope of the regression equation for each pixel of the predictor domain

p_predictor

SpatRaster of the significance (p-value) of the regression equation for each pixel of the predictor domain

resid_predictor

SpatRaster of the reduced data for the predictor domain

r_response

SpatRaster of the correlation coefficients between the base point and each pixel of the response domain

rsq_response

as above but for the coefficient of determination of the response domain

int_response

SpatRaster of the intercept of the regression equation for each pixel of the response domain

slp_response

as above but for the slope of the regression equation for each pixel of the response domain

p_response

SpatRaster of the significance (p-value) of the regression equation for each pixel of the response domain

resid_response

SpatRaster of the reduced data for the response domain


Class EotStack

Description

Class EotStack

Slots

modes

a list containing the individual 'EotMode's of the 'EotStack'

names

the names of the modes


Create an anomaly raster series

Description

The function creates an anomaly raster series either based on the overall mean of the original series, or a supplied reference raster. For the creation of seasonal anomalies use deseason().

Usage

anomalize(x, reference = NULL, ...)

Arguments

x

A SpatRaster (or ⁠Raster*⁠) series.

reference

An optional single-layer SpatRaster (or RasterLayer) to be used as the reference. Uses the overall mean of the original series if NULL (default).

...

If reference = NULL, additional arguments passed to terra::app() when calculating the overall mean (except for 'fun').

Value

An anomaly SpatRaster series.

See Also

deseason(), denoise()

Examples

pcp = terra::unwrap(australiaGPCP)
pcp_anom = anomalize(pcp)

opar = par(mfrow = c(1,2))
plot(pcp[[10]], main = "original")
plot(pcp_anom[[10]], main = "anomalized")
par(opar)


Monthly GPCP precipitation data for Australia

Description

Monthly Gridded Precipitation Climatology Project precipitation data for Australia from 1982/01 to 2010/12

Usage

australiaGPCP

Format

A PackedSpatRaster with the following attributes:

size        : 12, 20, 348  (nrow, ncol, nlyr)
resolution  : 2.5, 2.5  (x, y)
extent      : 110, 160, -40, -10  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs

Details

Monthly Gridded Precipitation Climatology Project precipitation data for Australia from 1982/01 to 2010/12

References

The Version-2 Global Precipitation Climatology Project (GPCP) Monthly Precipitation Analysis (1979 - Present)
Adler et al. (2003)
Journal of Hydrometeorology, Volume 4, Issue 6, pp. 1147 - 1167
doi:10.1175/1525-7541(2003)004<1147:TVGPCP>2.0.CO;2

Examples

terra::unwrap(australiaGPCP)

Calculate space-time variance of a raster series

Description

The function calculates the (optionally standardised) space-time variance of a raster series.

Usage

calcVar(x, standardised = FALSE, ...)

Arguments

x

A SpatRaster (or ⁠Raster*⁠) series.

standardised

logical, defaults to FALSE.

...

Currently not used.

Value

The mean (optionally standardised) space-time variance as numeric.

Examples

sst = terra::unwrap(pacificSST)

calcVar(sst) # default non-standardised
calcVar(sst, standardised = TRUE)


Create a weighted covariance matrix

Description

Create a weighted covariance matrix

Usage

covWeight(m, weights, ...)

Arguments

m

A matrix, e.g. as returned by terra::values().

weights

A numeric vector of weights. For lat/lon data this can be produced with getWeights().

...

Additional arguments passed to stats::cov.wt()

Value

See stats::cov.wt().


Shorten a raster series

Description

The function cuts a specified number of layers off a raster series in order to create a lagged stack.

Usage

cutStack(x, tail = TRUE, n = NULL)

Arguments

x

A SpatRaster (or ⁠Raster*⁠) series.

tail

logical. If TRUE (default) the layers will be taken off the end of the stack. If FALSE layers will be taken off the beginning.

n

The number of layers to take away as integer. If NULL (default), 'x' is returned unchanged.

Value

A SpatRaster series shortened by 'n' layers either from the beginning or the end, depending on the specification of 'tail'.

Examples

pcp = terra::unwrap(australiaGPCP)

# 6 layers from the beginning
cutStack(pcp, tail = FALSE, n = 6)
# 8 layers from the end
cutStack(pcp, tail = TRUE, n = 8)


Convert degrees to radians

Description

Converts a series of degrees to radians.

Usage

deg2rad(deg)

Arguments

deg

A series of degrees to be converted to radians.

Value

A vector of radians.

Examples

## latitude in degrees
gph = terra::unwrap(vdendool)

degrees = terra::crds(gph)[, 2]
head(degrees)

## latitude in radians
radians = deg2rad(degrees)
head(radians)

## `SpatRaster` input, e.g. useful for topographic operations
tmp = gph[[1L]]
terra::values(tmp) = degrees

tmp_rad = deg2rad(tmp)

opar = par(mfrow = c(1, 2))
plot(tmp, main = "lat (degrees)")
plot(tmp_rad, main = "lat (radians)")
par(opar)


Noise filtering through principal components

Description

Filter noise from a raster series by decomposing into principal components and subsequent reconstruction using only a subset of components.

Usage

denoise(
  x,
  k = NULL,
  expl.var = NULL,
  weighted = TRUE,
  use.cpp = TRUE,
  verbose = TRUE,
  ...
)

Arguments

x

A SpatRaster (or ⁠Raster*⁠) series to be filtered.

k

The number of components to be kept for reconstruction (ignored if 'expl.var' is supplied).

expl.var

Minimum amount of variance to be kept after reconstruction (should be set to NULL or omitted if 'k' is supplied).

weighted

logical. If TRUE the covariance matrix will be geographically weighted using the cosine of latitude during decomposition (only important for lat/lon data).

use.cpp

logical. Determines whether to use Rcpp functionality, defaults to TRUE.

verbose

logical. If TRUE some details about the calculation process will be output to the console.

...

Additional arguments passed to stats::princomp().

Value

A denoised SpatRaster series.

Note

Either 'k' or 'expl.var' must be specified. If both are supplied, 'k' will be ignored. If none are supplied, an error will be thrown.

See Also

anomalize(), deseason()

Examples

gph = terra::unwrap(vdendool)
gph_dns = denoise(gph, expl.var = 0.8)

opar = par(mfrow = c(1,2))
plot(gph[[1]], main = "original")
plot(gph_dns[[1]], main = "denoised")
par(opar)


Create seasonal anomalies

Description

The function calculates anomalies of a raster object by supplying a suitable seasonal window. E.g. to create monthly anomalies of a raster stack of 12 layers per year, use cycle.window = 12.

Usage

## S4 method for signature 'SpatRaster'
deseason(x, cycle.window = 12L, use.cpp = FALSE, filename = "", ...)

## S4 method for signature 'numeric'
deseason(x, cycle.window = 12L)

Arguments

x

A SpatRaster (or ⁠Raster*⁠) object or, alternatively, a numeric time series.

cycle.window

integer, defaults to 12. The window for the creation of the anomalies.

use.cpp

logical, defaults to FALSE. Determines whether or not to use Rcpp functionality. Only applies if x is a raster object.

filename

character. Output filename (optional).

...

Additional arguments passed to terra::writeRaster(). Only considered if 'filename' is specified.

Value

If 'x' is a raster object, a deseasoned SpatRaster; else a deseasoned numeric vector.

See Also

anomalize(), denoise()

Examples

pcp = terra::unwrap(australiaGPCP)
pcp_dsn = deseason(pcp, cycle.window = 12)

opar = par(mfrow = c(1, 2))
plot(pcp[[1]], main = "original")
plot(pcp_dsn[[1]], main = "deseasoned")
par(opar)

EOT analysis of a predictor and (optionally) a response raster series

Description

Calculate a given number of EOT modes either internally or between raster series.

Usage

eot(
  x,
  y = NULL,
  n = 1,
  standardised = TRUE,
  write.out = FALSE,
  path.out = ".",
  prefix = "remote",
  reduce.both = FALSE,
  type = c("rsq", "ioa"),
  verbose = TRUE,
  ...
)

Arguments

x

A SpatRaster (or ⁠Raster*⁠) object used as predictor.

y

A SpatRaster (or ⁠Raster*⁠) object used as response. If 'y' is NULL (default), 'x' is used as response.

n

The number of EOT modes to calculate as integer, defaults to 1.

standardised

logical, default TRUE. If FALSE the calculated r-squared values will be multiplied by the variance.

write.out

logical, default FALSE. If TRUE results will be written to disk using 'path.out'.

path.out

The file path for writing results if 'write.out' is TRUE. Defaults to current working directory.

prefix

optional prefix to be used for naming of results if 'write.out' is TRUE.

reduce.both

logical, default FALSE. If TRUE both 'x' and 'y' are reduced after each iteration. If FALSE only 'y' is reduced.

type

The type of the link function. Defaults to "rsq" as in original proposed method from van den Dool 2000. If set to "ioa" index of agreement is used instead.

verbose

logical, default FALSE. If TRUE some details about the calculation process will be output to the console.

...

Currently not used.

Details

For a detailed description of the EOT algorithm and the mathematics behind it, see the References section. In brief, the algorithm works as follows: First, the temporal profiles of each pixel xp of the predictor domain are regressed against the profiles of all pixels xr in the response domain. The calculated coefficients of determination are summed up and the pixel with the highest sum is identified as the 'base point' of the first/leading mode. The temporal profile at this base point is the first/leading EOT. Then, the residuals from the regression are taken to be the basis for the calculation of the next EOT, thus ensuring orthogonality of the identified teleconnections. This procedure is repeated until a predefined amount of n EOTs is calculated. In general, remote implements a 'brute force' spatial data mining approach to identify locations of enhanced potential to explain spatio-temporal variability within the same or another geographic field.

Value

If ⁠n = 1`` an ⁠EotMode⁠, if n > 1 an ⁠EotStack⁠of 'n'⁠EotMode⁠s. Each ⁠EotMode' has the following components:

Apart from rsq_sums_predictor, all *_predictor fields are also returned for the *_response domain, even if predictor and response domain are equal. This is due to that fact, that if not both fields are reduced after the first EOT is found, these SpatRasters will differ.

References

Empirical Orthogonal Teleconnections
H. M. van den Dool, S. Saha, A. Johansson (2000)
Journal of Climate, Volume 13, Issue 8, pp. 1421-1435
doi:10.1175/1520-0442(2000)013<1421:EOT>2.0.CO;2

Empirical Methods in Short-Term Climate Prediction
H. M. van den Dool (2007)
Oxford University Press, Oxford, New York
doi:10.1093/oso/9780199202782.001.0001

Examples

### EXAMPLE I
### a single field

gph = terra::unwrap(vdendool)

## calculate 2 leading modes
nh_modes <- eot(x = gph, y = NULL, n = 2, 
                standardised = FALSE, 
                verbose = TRUE)




Geographic weighting

Description

The function performs geographic weighting of non-projected long/lat data. By default it uses the cosine of latitude (in radians) to compensate for the area distortion, though the user can supply other weighting functions.

Usage

geoWeight(x, f = cos, ...)

Arguments

x, f, ...

See getWeights().

Value

A weighted SpatRaster.

Examples

gph <- terra::unwrap(vdendool)
wgtd <- geoWeight(gph)

opar <- par(mfrow = c(1,2))
plot(gph[[1]], main = "original")
plot(wgtd[[1]], main = "weighted")
par(opar)


Calculate weights from latitude

Description

Calculate weights using the cosine of latitude to compensate for area distortion of non-projected lat/lon data.

Usage

getWeights(x, f = cos, ...)

Arguments

x

A non-projected SpatRaster (or ⁠Raster*⁠) object.

f

A function applied to the latitude (in radians) to compute weights. Defaults to cos.

...

Additional arguments passed to 'f'.

Value

A numeric vector of weights for non-NA cells in 'x'.

Examples

pcp = terra::unwrap(australiaGPCP)

wghts = getWeights(pcp)
utils::head(wghts)

wghts_rst = terra::setValues(pcp[[1]], wghts)

opar = par(mfrow = c(1,2))
plot(pcp[[1]], main = "data")
plot(wghts_rst, main = "weights")
par(opar)


Create lagged raster series

Description

The function is used to produce two lagged raster series. The second is cut from the beginning, the first from the tail to ensure equal output lengths (provided that input lengths were equal).

Usage

lagalize(x, y, lag = NULL, freq = 12L, ...)

Arguments

x

A SpatRaster (or ⁠Raster*⁠) series to be cut from tail.

y

A SpatRaster (or ⁠Raster*⁠) series to be cut from beginning.

lag

The desired lag in the native frequency of the series passed to cutStack().

freq

The frequency of the raster series as integer.

...

Currently not used.

Value

A list with the two raster series lagged by 'lag'.

Examples

sst = terra::unwrap(pacificSST)
pcp = terra::unwrap(australiaGPCP)

# lag GPCP by 4 months
lagged = lagalize(sst, pcp, lag = 4, freq = 12)
lagged[[1]][[1]] # check names to see date of layer
lagged[[2]][[1]] # -"-


Calculate long-term means from a raster series

Description

Calculate long-term means from an input raster series. Ideally, the number of input layers should be divisable by the supplied 'cycle.window'. For instance, if 'x' consists of monthly layers, 'cycle.window' should be a multiple of 12.

Usage

longtermMeans(x, cycle.window = 12L)

Arguments

x

A SpatRaster (or ⁠Raster*⁠) series.

cycle.window

integer, defaults to 12. See deseason().

Value

A SpatRaster with 'cycle.window' layers, each containing the mean across all corresponding time steps.

Author(s)

Florian Detsch

See Also

deseason().

Examples

pcp = terra::unwrap(australiaGPCP)

longtermMeans(pcp)


Number of EOTs needed for variance explanation

Description

The function identifies the number of modes needed to explain a certain amount of variance within the response field.

Usage

## S4 method for signature 'EotStack'
nXplain(x, var = 0.9)

Arguments

x

An EotStack.

var

The minimum amount of variance to be explained by the modes as numeric, defaults to 0.9.

Value

The number of EOTs needed to explain 'var'.

Note

This is a post-hoc function. It needs an EotStack created as returned by eot(). Depending on the potency of the identified EOTs, it may be necessary to compute a high number of modes in order to be able to explain a large enough part of the variance.

Examples

gph <- terra::unwrap(vdendool)

nh_modes <- eot(x = gph, y = NULL, n = 3, 
                standardised = FALSE, 
                verbose = TRUE)
             
### How many modes are needed to explain 25% of variance?              
nXplain(nh_modes, 0.25)


Names of Eot* objects

Description

Get or set names of Eot* objects

Usage

## S4 method for signature 'EotStack'
names(x)

## S4 replacement method for signature 'EotStack'
names(x) <- value

## S4 method for signature 'EotMode'
names(x)

## S4 replacement method for signature 'EotMode'
names(x) <- value

Arguments

x

a EotMode or EotStack

value

name to be assigned

Value

if x is a EotStack, the names of all mdoes, if x is a EotMode, the name the respective mode

Examples

gph <- terra::unwrap(vdendool)

nh_modes <- eot(gph, n = 2)

## mode names
names(nh_modes)
names(nh_modes) <- c("vdendool1", "vdendool2")

names(nh_modes)
names(nh_modes[[2]])


Number of modes of an EotStack

Description

Retrieves the number of modes of an EotStack.

Usage

nmodes(x)

Arguments

x

An EotStack.

Value

The number of modes as integer.

Examples

gph = terra::unwrap(vdendool)
nh_modes = eot(gph, n = 2)
nmodes(nh_modes)


Monthly SSTs for the tropical Pacific Ocean

Description

Monthly NOAA sea surface temperatures for the tropical Pacific Ocean from 1982/01 to 2010/12

Usage

pacificSST

Format

A PackedSpatRaster with the following attributes:

size        : 30, 140, 348  (nrow, ncol, nlyr)
resolution  : 1, 1  (x, y)
extent      : 150, 290, -15, 15  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs

Details

Monthly NOAA sea surface temperatures for the tropical Pacific Ocean from 1982/01 to 2010/12

References

Daily High-Resolution-Blended Analyses for Sea Surface Temperature
Reynolds et al. (2007)
Journal of Climate, Volume 20, Issue 22, pp. 5473 - 5496
doi:10.1175/2007JCLI1824.1

Examples

terra::unwrap(pacificSST)

Plot an Eot* object

Description

This is the standard plotting routine for the results of eot(). Three panels will be drawn i) the predictor domain, ii) the response domain, iii) the time series at the identified base point

Usage

## S4 method for signature 'EotMode,ANY'
plot(
  x,
  y,
  pred.prm = "rsq",
  resp.prm = "r",
  show.bp = FALSE,
  anomalies = TRUE,
  add.map = TRUE,
  ts.vec = NULL,
  arrange = c("wide", "long"),
  clr = NULL,
  locations = FALSE,
  ...
)

## S4 method for signature 'EotStack,ANY'
plot(
  x,
  y,
  pred.prm = "rsq",
  resp.prm = "r",
  show.bp = FALSE,
  anomalies = TRUE,
  add.map = TRUE,
  ts.vec = NULL,
  arrange = c("wide", "long"),
  clr = NULL,
  locations = FALSE,
  ...
)

Arguments

x

either an object of EotMode or EotStack as returned by eot()

y

integer or character of the mode to be plotted (e.g. 2 or "mode_2")

pred.prm

the parameter of the predictor to be plotted.
Can be any of "r", "rsq", "rsq.sums", "p", "int" or "slp"

resp.prm

the parameter of the response to be plotted.
Can be any of "r", "rsq", "rsq.sums", "p", "int" or "slp"

show.bp

logical. If TRUE a grey circle will be drawn in the predictor image to indicate the location of the base point

anomalies

logical. If TRUE a reference line will be drawn a 0 in the EOT time series

add.map

logical. If TRUE country outlines will be added to the predictor and response images

ts.vec

an (optional) time series vector of the considered EOT calculation to be shown as the x-axis in the time series plot

arrange

whether the final plot should be arranged in "wide" or "long" format

clr

an (optional) color palette for displaying of the predictor and response fields

locations

logical. If x is an EotStack, set this to TRUE to produce a map showing the locations of all modes. Ignored if x is an EotMode

...

further arguments to be passed to sp::spplot()

Methods (by class)

Examples

gph <- terra::unwrap(vdendool)

## calculate 2 leading modes
nh_modes <- eot(x = gph, y = NULL, n = 2, 
                standardised = FALSE, 
                verbose = TRUE)

## default settings 
plot(nh_modes, y = 1) # is equivalent to

## Not run: 
plot(nh_modes[[1]]) 

plot(nh_modes, y = 2) # shows variance explained by mode 2 only
plot(nh_modes[[2]]) # shows cumulative variance explained by modes 1 & 2

## showing the location of the mode but without map overlay
plot(nh_modes, y = 1, show.bp = TRUE, add.map = FALSE)

## changing parameters
plot(nh_modes, y = 1, show.bp = TRUE,
     pred.prm = "r", resp.prm = "p")
        
## change plot arrangement
plot(nh_modes, y = 1, show.bp = TRUE, arrange = "long") 

## plot locations of all base points
plot(nh_modes, locations = TRUE)

## End(Not run)


EOT based spatial prediction

Description

Make spatial predictions using the fitted model returned by eot(). A (user-defined) set of 'n' modes will be used to model the outcome using the identified link functions of the respective modes which are added together to produce the final prediction.

Usage

## S4 method for signature 'EotStack'
predict(object, newdata, n = 1L, filename = "", ...)

## S4 method for signature 'EotMode'
predict(object, newdata, n = 1L, filename = "", ...)

Arguments

object

An ⁠Eot*⁠ object.

newdata

The data to be used as predictor.

n

The number of modes to be used for the prediction. See nXplain() for calculating the number of modes based on their explanatory power.

filename

character, output filenames (optional). If specified, this must be of the same length as nlayers(newdata).

...

Further arguments passed to terra::app(), and hence, terra::writeRaster().

Value

A SpatRaster of nlayers(newdata).

See Also

terra::app(), terra::writeRaster().

Examples

### not very useful, but highlights the workflow

sst = terra::unwrap(pacificSST)
pcp = terra::unwrap(australiaGPCP)

## train data using eot()
train <- eot(x = sst[[1:10]],
             y = pcp[[1:10]],
             n = 1)

## predict using identified model
pred <- predict(train,
                newdata = sst[[11:20]],
                n = 1)

## compare results
opar <- par(mfrow = c(1,2))
plot(pcp[[13]], main = "original", zlim = c(0, 10))
plot(pred[[3]], main = "predicted", zlim = c(0, 10))
par(opar)


Read ⁠Eot*⁠ files from disk

Description

Read ⁠Eot*⁠ related files from disk, e.g. for further use with predict() or plot().

Usage

readEot(x, prefix = "remote", suffix = ".grd")

Arguments

x

character, search path for ⁠Eot*⁠ related files passed to list.files().

prefix

character, see writeEot() for details. Should be the same 'prefix' as used during file creation in eot() or writeEot().

suffix

character, default .grd for native "RRASTER" format. File extension depending on the output file type of locally stored ⁠Eot*⁠ files.

Value

An EotMode if a single mode is found on disk, or an EotStack otherwise.

Author(s)

Florian Detsch

See Also

writeEot()

Examples

## Not run: 
## calculate 3 leading modes
gph <- terra::unwrap(vdendool)
nh_modes <- eot(x = gph, n = 3, standardised = FALSE, 
                write.out = TRUE, path.out = tempdir())
                
## reimport related files
rm(nh_modes)
nh_modes <- readEot(tempdir())
nh_modes

## End(Not run)


Subset modes in an EotStack

Description

Extract a set of modes from an EotStack.

Usage

## S4 method for signature 'EotStack'
subset(x, subset, drop = FALSE, ...)

## S4 method for signature 'EotStack,ANY,ANY'
x[[i]]

Arguments

x

EotStack to be subset

subset

integer or character. The modes to extract (either by their indexes or names).

drop

If TRUE, a single selected mode is returned as an EotMode. Defaults to FALSE, which always returns an EotStack.

...

Currently not used.

i

Index(es) or name(s) to be subset, delegated to subset().

Value

An EotMode if a single mode is selected and drop = TRUE, otherwise an EotStack.

Examples

gph <- terra::unwrap(vdendool)

nh_modes <- eot(x = gph, y = NULL, n = 3, 
                standardised = FALSE, 
                verbose = TRUE)
                
subs <- subset(nh_modes, 2:3) # is the same as
subs <- nh_modes[[2:3]]

## effect of 'drop=FALSE' when selecting a single layer
subs <- subset(nh_modes, 2)
class(subs)
subs <- subset(nh_modes, 2, drop = TRUE)
class(subs)

## similarly to `drop = TRUE` above:
nh_modes[[2L]]
nh_modes[["mode_02"]]


Mean seasonal (DJF) 700 mb geopotential heights

Description

NCEP/NCAR reanalysis data of mean seasonal (DJF) 700 mb geopotential heights from 1948 to 1998

Usage

vdendool

Format

A PackedSpatRaster with the following attributes:

size        : 14, 36, 50  (nrow, ncol, nlyr)
resolution  : 10, 5  (x, y)
extent      : -180, 180, 20, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs

Details

NCEP/NCAR reanalysis data of mean seasonal (DJF) 700 mb geopotential heights from 1948 to 1998

Source

https://psl.noaa.gov/data/gridded/data.ncep.reanalysis.derived.pressure.html
Original Source: NOAA National Center for Environmental Prediction

References

The NCEP/NCAR 40-year reanalysis project
Kalnay et al. (1996)
Bulletin of the American Meteorological Society, Volume 77, Issue 3, pp 437 - 471
doi:10.1175/1520-0477(1996)077<0437:TNYRP>2.0.CO;2

Examples

terra::unwrap(vdendool)

Write ⁠Eot*⁠ objects to disk

Description

Write ⁠Eot*⁠ objects to disk. This is merely a wrapper around terra::writeRaster() so see respective help section for details.

Usage

## S4 method for signature 'EotMode'
writeEot(x, path.out = ".", prefix = "remote", overwrite = TRUE, ...)

## S4 method for signature 'EotStack'
writeEot(x, ...)

Arguments

x

An ⁠Eot*⁠ object.

path.out

The path to the folder to write the files to.

prefix

A prefix to be added to the file names (see Details).

overwrite

See terra::writeRaster(). In writeEot(), this defaults to TRUE.

...

Further arguments passed to terra::writeRaster() for EotMode input, or to the underlying EotMode method for EotStack input. If 'filetype' is not specified, the default "RRASTER" format (.grd) is used.

Details

writeEot() will write the results of either an EotMode or an EotStack to disk. For each mode the following files will be written:

Apart from pred_rsq_sums, all these files are also created for the response domain as resp_*. These will be pasted together with the prefix & the respective mode so that the file names will look like, e.g.:

prefix_mode_n_pred_r.grd

for the SpatRaster of the predictor correlation coefficient of mode n using the standard raster file type (.grd).

Functions

See Also

terra::writeRaster()

Examples

## Not run: 
gph <- terra::unwrap(vdendool)

nh_modes <- eot(x = gph, y = NULL, n = 2, 
                standardised = FALSE, 
                verbose = TRUE)

## write the complete EotStack
writeEot(nh_modes, prefix = "vdendool")

## write only one EotMode
writeEot(nh_modes[[2]], prefix = "vdendool")

## End(Not run)

mirror server hosted at Truenetwork, Russian Federation.