1 R PACKAGES

The following R packages (R Core Team 2017) are required to follow the examples. Note the last Session Information Section of this manual, where the specific package versions used to build these examples are indicated.

All the climate4R packages are currently under active development. Due to their inter-dependence, and in order to ensure the reproducibility of these examples, it is recommend to install the same versions of the packages that produced this document, even though in most cases more recent versions exist. The package versions used are indicated in the Session Information Section at the end of this document. The function install_github from package devtools (Wickham and Chang 2016) is recommended to install a particular package version from the GitHub repositories. For, instance, to install transformeR v0.0.14, it suffices with pointing to the specific version tag after the @ symbol:

devtools::install_github(c("SantanderMetGroup/transformeR@v0.0.14",
                           "SantanderMetGroup/loadeR@v1.0.9",
                           "SantanderMetGroup/loadeR.ECOMS@v1.2.3"))


If prefered, and in order to create a reproducible software environment as much as possible, a packrat bundle containing the whole R project (~180 Mb) producing this vignette is available for download.

1.1 R packages for data loading

The R package loadeR.ECOMS will perform the data loading task, including authentication against the UDG server (see the installation instructions). In addition, a quick overview of all datasets and variables available in the ECOMS-UDG is available in this table

The loadeR.ECOMS package extends the capabilities of the loadeR package for data access, and enables access to any remote dataset via OPeNDAP (more details in the loadeR’s wiki page), as well as creating and accesing datasets locally. An example of remote access to a public dataset outside the ECOMS-UDG is provided in Section 4.

library(loadeR.ECOMS)

1.2 R package for data post-processing and plotting

In addition, the R package transformeR (Bedia and Iturbide 2017) enables climate data transformation (plotting, aggregation, subsetting, PCA/EOF analysis …). Further details are available in the wiki page. It is seamlessly integrated with the data structures provided by loadeR.ECOMS.

library(transformeR)

1.3 R packages for verification

Two packages for verification have been developed in the frame of ECOMS: SpecsVerification (Siegert 2017), in SPECS, and easyVerification (MeteoSwiss 2017), in EUPORIAS. Both packages are available on CRAN. The former is a dependency of the latter, so installing easyVerification will also install SpecsVerification if not already present:

if (!require("easyVerification")) install.packages("easyVerification")
library(easyVerification)

1.4 Additional packages

The package RColorBrewer is used to replicate the spectral color palette used in the paper in the correlation maps. Next, the palette veri.colors is defined, that will be used in the verification maps:

library(RColorBrewer)
cols <- brewer.pal(n = 11, name = "Spectral")
veri.colors <- colorRampPalette(rev(cols))

2 ANALYSIS OF THE WINTER NAO INDEX

2.1 Data Loading


NOTE: the already post-processed datasets used in this section are available for direct download (skip this section and jump to Section 2.2 if directly loaded with the next lines)

## NCEP reanalysis SLP
url <- "http://meteo.unican.es/work/UDG/NCEP_psl_DJF_annual_1949_2010_LD.Rdata"
temp_file <- tempfile()
download.file(url, destfile = temp_file)
load(temp_file, .GlobalEnv, verbose = TRUE)
## CFSv2 SLP
url <- "http://meteo.unican.es/work/UDG/CFS_24_lm1_psl_DJF_annual_1983_2010_LD.Rdata"
temp_file <- tempfile()
download.file(url, destfile = temp_file)
load(temp_file, .GlobalEnv, verbose = TRUE)

Prior to data access, authentication is required to access the UDG. The authentication is performed in one step:

loginUDG(username = "jDoe", password = "*****")

2.1.1 NCEP Reanalysis1 data

The spatial domain to compute the PC-based NAO index is indicated in NCAR’s Climate Data Guide

lonLim = c(-90,40)
latLim = c(20,80)
var = "psl"

Note that "psl" is the standard name defined in the UDG vocabulary for sea-level pressure. The UDG vocabulary can be inspected by typing UDG.vocabulary(). The sea-level pressure data from the NCEP reanalysis (dataset = "NCEP_reanalysis1") is loaded in order to reconstruct the observed winter NAO index (season = c(12,1,2)) for the entire reanalysis period (1950-2010) (years = NULL, the default, which retrieves all available years. This is equivalent to years = 1950:2010 in this case). As the original data are 6-hourly, data are aggregated on-the-fly by loadeR.ECOMS by introducing the arguments time = "DD" (to conver the data from 6-h to daily), aggr.d = "mean" (to indicate the aggregation function) and aggr.m = "mean" (which indicates that daily data will be monthly averaged).

ncep.psl <- loadECOMS(dataset = "NCEP_reanalysis1",
                      var = var,
                      lonLim = lonLim,
                      latLim = latLim,
                      season = c(12,1,2),
                      years = NULL,
                      time = "DD",
                      aggr.d = "mean",
                      aggr.m = "mean")

Next we represent the mean sea-level pressure winter climatology:

plotClimatology(climatology(ncep.psl),
                backdrop.theme = "coastline",
                main = "NCEP mean DJF SLP (1950-2010)")