subset: Subsetting esd objects

Description Usage Arguments Value Author(s) Examples

Description

The subset method tries to be 'intelligent', and if the list has no names, then the list contains two vectors of length 2, then this is interpreted as a region, e.g. argument is = list( c(lon.min,lon.max),c(lat.min,lat.max) ). If, on the other hand, is = list( lon=1:50,lat=55:65 ), then the function picks the longitudes and latitudes which match these. This makes it flexible so that one can pick any irregular sequence.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
subset(x,it=NULL,is=NULL,...)
subset.station(x,loc=NULL , param = NULL,  stid = NULL ,lon = NULL,
               lat = NULL, alt = NULL, cntr = NULL, src = NULL , it = NULL ,
               nmin = NULL, is = NULL)
subset.eof(x,it=NULL,is=NULL,verbose=FALSE)
subset.cca(x,it=NULL,is=NULL)
subset.mvr(x,it=NULL,is=NULL)
subset.pca(x,it=NULL,is=NULL)
subset.trend(x,it=NULL,is=NULL)
subset.corfield(x,it=NULL,is=NULL)
subset.comb(x,it=NULL,is=NULL) 
subset.field(x,it=NULL,is=NULL)
subset.spell(x,is=NULL,it=NULL) 
subset.ds(x,it=NULL,is=NULL)
subset.trend(x,it=NULL,is=NULL)
subset.dsensemble(x,it=NULL,is=NULL)
matchdate(x,it)
station.subset(x,it=NULL,is=NULL)

Arguments

x

Data object from which the subset is taken

it

A list or data.frame providing time index, e.g. month

is

A list or data.frame providing space index, e.g. station record

dimension

qualifier for field objects: tme or space?

Value

A field object

Author(s)

R.E. Benestad and A. Mezghanil

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
data(Oslo)

# January months:
jan <- subset(Oslo,1)

# The last 10 years:
recent <- subset(Oslo,2003:2012)

gcm <- t2m.NorESM.M()
# Extract July months from a field:
gcm.jul <- subset(gcm,it=7)

# Extract a period from a field:
gcm.short <- subset(gcm.jul,it=1950:2030)

# Extract data for the region 0-50E/55-65N
X <-  subset(gcm,is=list(c(0,50),c(55,65)))

# Extract data for a specific set of longitudes and latitudes
Z <-  subset(gcm,is=list(lon=1:30,lat=58:63))

t2m <- t2m.NCEP(lon=c(-10,30),lat=c(50,70))
cal <- subset(t2m,it=c("1948-01-01","1980-12-31"))

# Example on how to split the data into two parts for
# split-sample test...

T2M <- as.annual(t2m.NCEP(lon=c(-10,30),lat=c(50,70)))
cal <- subset(T2M,it=c("1948","1980"))
pre <- subset(T2M,it=c("1981","2012"))
comb <- combine(cal,pre) 
X <- EOF(comb)
plot(X)

data(ferder)
y <- as.annual(ferder)
z <- DS(y,X)
plot(z)

# Test of subset the commutative property of subset and combine: 
T2M <- as.4seasons(t2m.NCEP(lon=c(-10,30),lat=c(50,70)))
GCM <- as.4seasons(t2m.NorESM.M(lon = c(-10, 30), lat = c(50, 70)))
XY <- combine(T2M,GCM)
X1 <- subset(XY,it=3)
X2 <- combine(subset(T2M,it=3),subset(GCM,it=3))
eof1 <- EOF(X1)
eof2 <- EOF(X2)
eof3 <- biasfix(eof2)
plot(merge(eof1[,1],eof2[,1],eof3[,1]),plot.type='single',
     col=c('red','blue','green'),lty=c(1,1,2),lwd=c(4,2,2))
# OK - identical results

metno/esd.test documentation built on May 22, 2019, 7:49 p.m.