Skip to content

Examples

abdelkaderm edited this page Sep 18, 2014 · 13 revisions

Predefined time series in the package.

The esd package comes with a number of sample datasets that you can experiment with. Use data() to see the available datasets from this package as

data(package="esd")

Example 1 : Monthly mean temperature recorded at Oslo

Use data() to load, for instance, Oslo time series as

data(Oslo)

Use class() to check what type of oject "Oslo" is as

class(Oslo)

[1] "station" "month" "zoo"

This means that "Oslo" dataset is a time series with monthly data.

Get the list of all attributes as

> names(attributes(Oslo))

Get the variable name as short and longname, respectively,

> attr(Oslo,'variable') ; attr(Oslo,'longname')

[1] "T2m"

[1] "temperature at 2m"

To get the full description of Oslo i.e. the str*ucture of the object use str

str(Oslo)

then use plot() to visualize the time series

plot(Oslo)

Then, get a summary of the coredata as follow

summary(coredata(Oslo))

Example 2 - Global mean temperature anomalies from CMIP3 and CMIP5 experiments.

The datasets have been produced within the esd package, then included as data. There are two data sets correponding to the global mean 2m-temperature from both CMIP3 and CMIP5 experiments, these are global.t2m.cmip3 and global.t2m.cmip5. The size of the two data sets is different as there are more GCMs included in the CMIP5 than the CMIP3. Thus, to plot the global mean temperature anomaly from the reference period 1986-2005, and for the whole CMIP3 GCM ensemble type

> data(global.t2m.cmip3)

> plot(global.t2m.cmip3,plot.type="single")

To get more suitable or fancy plots, use the predefined fig0.zoo() where you can specify or highlight one or several models or use fig1.zoo() to plot the enveloppe of the whole ensemble such as

>fig0.zoo(global.t2m.cmip3,select=25)

>fig1.zoo(global.t2m.cmip3,error=1) # error = 1 means one standard deviation from the ensemble mean.

An interesting exercice would be to compare the global mean temperature anomalies from both CMIP3 and CMIP5 experiments with the observed global mean temperature anomaly. For this purpose, a more detailed script has been made available in the Demo. Type demo(package="esd") to see all available demo scripts (e.g. global_tas_anomaly_cmip3).

Clone this wiki locally