as: Conversion to esd objects.

Description Usage Arguments Value Author(s) Examples

Description

Various methods for converting objects from one shape to another. These methods do the house keeping, keeping track of attributes and metadata.

as.field.station uses regrid to generate a field based on bi-linear interpolation of station values and their coordinates. Unfinished...

Usage

 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
as.4seasons(x,FUN='mean',...)
as.4seasons.default(x,FUN='mean',...)
as.4seasons.station(x,FUN='mean',...)
as.4seasons.day(x,FUN='mean',na.rm=TRUE,dateindex=TRUE,...)
as.4seasons.field(x,FUN='mean',...)
as.4seasons.spell(x,FUN=mean,...)
as.seasons(x,start='01-01',end='12-31',FUN='mean', ...)
as.annual(x,...)
as.annual.default(x, ...)
as.annual.numeric(x, ...)
as.annual.integer(x, ...)
as.annual.yearqtr(x, frac = 0, ...)
as.annual.spell(x, ...)
as.annual.station(x, ...)
as.anomaly(x,...)
as.anomaly.default(x,ref=NULL,monthly=NULL,na.rm=TRUE)
as.anomaly.station(x,ref=NULL,monthly=NULL,na.rm=TRUE)
as.anomaly.field(x,ref=NULL,monthly=NULL,na.rm=TRUE)
as.anomaly.zoo(x,ref=NULL,monthly=NULL,na.rm=TRUE)
as.appended(x,...)
as.appended.ds.comb(x,iapp=1)
as.appended.eof.comb(x,iapp=1)
as.appended.field.comb(x,iapp=1)
as.eof(x,...)
as.eof.zoo(x,...)
as.eof.eof(x,iapp=NULL)
as.eof.comb(x,iapp=NULL)
as.eof.field(x,iapp=NULL,...)
as.eof.appendix(x,iapp=1)
as.calibrationdata(x)
as.calibrationdata.ds(x)
as.calibrationdata.station(x)
as.climatology(x,...)
as.comb(x,...)
as.comb.eof(x,...)
as.ds(x)
as.field(x,...)
as.field.zoo(x,lon,lat,param,unit,
             longname=NA,quality=NA,src=NA,url=NA,
             reference=NA,info=NA,calendar='gregorian',
             greenwich=TRUE, method= NA,type=NA,aspect=NA)
as.field.default(x,index,lon,lat,param,unit,
                 longname=NA,quality=NA,src=NA,url=NA,
                 reference=NA,info=NA,calendar='gregorian',
                 greenwich=TRUE, method= NA,type=NA,aspect=NA)
as.field.eof(x,...)
as.field.comb(x,iapp=NULL,...)
as.field.station(x,...)
as.fitted.values(x)
as.fitted.values.ds(x)
as.fitted.values.station(x)
as.monthly(x,fun='mean')
as.observed.station(x)
as.original.data(x)
as.original.data.ds(x)
as.original.data.station(x)
as.pattern(x)
as.pattern.ds(x)
as.pattern.eof(x)
as.pattern.cca(x)
as.pattern.mvr(x)
as.pattern.field(x)
as.pattern.trend(x)
as.pattern.corfield(x)
as.pca(x)
as.pca.ds(x)
as.pca.station(x)
as.residual(x)
as.residual.ds(x)
as.residual.station(x)
as.station(x,...)
as.station.zoo(x,loc=NA,param=NA,unit=NA,lon=NA,lat=NA,alt=NA,
                      cntr=NA,longname=NA,stid=NA,quality=NA,src=NA,url=NA,
                      reference=NA,info=NA, method= NA)
as.station.data.frame(x,location=NA,param=NA,unit=NA,lon=NA,lat=NA,alt=NA,
                      cntr=NA,longname=NA,stid=NA,quality=NA,src=NA,url=NA,
                      reference=NA,info=NA, method= NA)
as.station.zoo(x,location=NA,param=NA,unit=NA,lon=NA,lat=NA,alt=NA,
                      cntr=NA,longname=NA,stid=NA,quality=NA,src=NA,url=NA,
                      reference=NA,info=NA, method= NA,type=NA,aspect=NA)
as.station.list(x)
as.station.ds(x)
as.station.pca(x)
as.station.field(x)
as.station.spell(x)
as.station.eof(x,pattern=1:10)
as.pca.ds(x)
as.pca.station(x)

Arguments

x

Data object

location

define location attribute attr(x,'location')

param

define variable attribute attr(x,'variable')

unit

define unit attribute attr(x,'unit')

lon

define longitude attribute attr(x,'longitude')

lat

define latitude attribute attr(x,'latitude')

alt

define altitude attribute attr(x,'altitude')

cntr

define country attribute attr(x,'country')

longname

define long-name attribute attr(x,'loongname')

stid

define station ID attribute attr(x,'station_id')

quality

define quality attribute attr(x,'quality')

src

define source attribute attr(x,'source')

url

define URL attribute attr(x,'URL')

reference

define reference attribute attr(x,'reference')

info

define info attribute attr(x,'info')

method

define method attribute attr(x,'method')

FUN

function

na.rm

TRUE: ignore NA's

dateindex
monthly
aspect
iapp

For values greater than 1, select the corresponding appended field in 'comb' objects (e.g. 1 gives attr(x,'appendix.1'))

pattern

Which EOF pattern (mode) to extract as a series for PC

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
52
53
54
55
56
57
58
59
60
# Example: how to generate a new station object.
data <- round(matrix(rnorm(20*12),20,12),2); colnames(data) <- month.abb
x <- data.frame(year=1981:2000,data)
X <- as.station.data.frame(x,loc="",param="noise",unit="none")

# Example: how to generate a new field object.
year <- sort(rep(1991:2000,12))
month <- rep(1:12,length(1991:2000))
n <-length(year)
lon <- seq(-30,40,by=5); nx <- length(lon)
lat <- seq(40,70,by=5); ny <- length(lat)
# Time dimension should come first, space second.
y <- matrix(rnorm(nx*ny*n),n,nx*ny)
index <- as.Date(paste(year,month,1,sep="-"))
Y <- as.field(y,index,lon,lat,param="noise",unit="none")
map(Y)
plot(EOF(Y))

data(Oslo)
plot(as.anomaly(Oslo))

data(ferder)
plot(annual(ferder,FUN=min))
plot(annual(ferder,FUN=IQR,na.rm=TRUE))
plot(as.4seasons(ferder))

data(bjornholt)
plot(annual(bjornholt,FUN="exceedance",fun="counts"))
plot(annual(bjornholt,FUN="exceedance",fun="freq"))
plot(annual(bjornholt,FUN="exceedance"))

# Test the as.4seasons function:
data(ferder)
#Daily data:
yd <- ferder
# Monthly data:
ym <- aggregate(ferder,as.yearmon)
ym <- zoo(coredata(ym),as.Date(index(ym)))
ym <- attrcp(ferder,ym)
plot(ym)

#Monthly reanalyses:
t2m <- t2m.ERAINT(lon=c(-30,40),lat=c(50,70))
T2m <- as.4seasons(t2m)
#Extract the grid point with location corresponding to that of the station:
x <- regrid(t2m,is=ferder)
x4s <- as.4seasons(x)
X4s <- regrid(T2m,is=ferder)
y4s1 <- as.4seasons(yd)
y4s2 <- as.4seasons(ym)
plot.zoo(y4s1,lwd=2,xlim=as.Date(c("1980-01-01","2000-01-01")),ylim=c(-10,20))
lines(y4s2,col="red",lty=2)
lines(x4s,col="darkblue",lwd=2)
lines(X4s,col="lightblue",lty=2)

# Select a random season
data(bjornholt)
data(ferder)
plot(as.seasons(ferder,FUN='CDD'))
plot(as.seasons(ferder,start='05-17',end='11-11',FUN='HDD'))

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