plotClimatology: Lattice plot methods for climatological grids

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/plotClimatology.R

Description

A wrapper for the lattice (trellis) plot methods for spatial data in sp::spplot

Usage

1
2
plotClimatology(grid, backdrop.theme = "none", set.min = NULL,
  set.max = NULL, lonCenter = NULL, ...)

Arguments

grid

Input grid

backdrop.theme

Reference geographical lines to be added to the plot. See Details.

set.min

Numeric value indicating an absolute minimum value (default to NULL). All grid values below this are mapped to set.min. See details.

set.max

Same as set.min argument, but to force a ceiling.

lonCenter

Value of the longitude to be centered in the plot.

...

Further arguments passed to spplot

Details

The function applies the spplot method after conversion of the climatological map(s) to a SpatialGridDataFrame.

The set.min and set.max options are useful in order to preserve adequate ranges for map representation, avoiding the influence of extreme values. Note that this is different than setting a range of values with an interval using the at argument. The latter choice, that overrides set.min and set.max, leaves blank grid points for outlying values.

Multigrids

Multigrids of climatologies can be created using makeMultiGrid for trellis visualization of different variables, or for instance, for the comparison of raw and corrected/downscaled scenarios side to side. In case of multimember multigrids, the function will internally compute the ensemble mean of each variable in the multigrid for representation (with a message).

Backdrop theme

Current implemented options are "none" and "coastline", which contains a simplied vector theme delineating the world coastlines. Any other themes can be introduced by the user using the sp.layout options in spplot.

Controlling graphical parameters

Many different aspects of the map can be controlled passing the relevant arguments to spplot. Fine control of graphical parameters for the trellis display can be also controlled using trellis.par.set.

Value

As spplot, plotClimatology returns a lattice plot of class “trellis”. If you fail to “see” it, explicitly call print(plotClimatology(...)).

Author(s)

J. Bedia

References

See Also

climatology for details on climatology calculation. map.stippling, for adding a custom point layer on top of the map. map.lines, to add lines and polygons to climatological maps Also see spplot in package sp for further information on plotting capabilities and options

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
data("CFS_Iberia_tas")
# Climatology is computed:
clim <- climatology(CFS_Iberia_tas, by.member = TRUE)
plotClimatology(clim)
# Geographical lines can be added using the argument 'backdrop.theme':
plotClimatology(clim, backdrop.theme = "coastline")
plotClimatology(clim, backdrop.theme = "coastline", center = 180)

# Further arguments can be passed to 'spplot'...

# ... a subset of members to be displayed, using 'zcol':
plotClimatology(clim,
                backdrop.theme = "coastline",
                zcol = 1:4)

# ... regional focuses (e.g. the Iberian Peninsula).
plotClimatology(clim,
                backdrop.theme = "countries",
                xlim = c(-10,5), ylim = c(35,44),
                zcol = 1:4,
                scales = list(draw = TRUE))

# Changing the default color palette and ranges:
plotClimatology(clim,
                backdrop.theme = "coastline",
                zcol = 1:4,
                col.regions = cm.colors(27), at = seq(10,37,1))

# For ensemble means climatology should be called with 'by.member' set to FALSE:
clim <- climatology(CFS_Iberia_tas, by.member = FALSE)

# Adding contours to the plot is direct with argument 'contour':
plotClimatology(clim,
                scales = list(draw = TRUE),
                contour = TRUE,
                main = "tas Predictions July Ensemble Mean")


## Example of multigrid plotting
data("NCEP_Iberia_psl")
## Winter data are split into monthly climatologies
monthly.clim.grids <- lapply(getSeason(NCEP_Iberia_psl), function(x) {
      climatology(subsetGrid(NCEP_Iberia_psl, season = x))
})
## Skip the temporal checks, as grids correspond to different time slices
mg <- do.call("makeMultiGrid",
              c(monthly.clim.grids, skip.temporal.check = TRUE))
              ## We change the panel names
plotClimatology(mg,
                backdrop.theme = "coastline",
                names.attr = c("DEC","JAN","FEB"),
                main = "Mean PSL climatology 1991-2010",
                scales = list(draw = TRUE))

# Station data:
data("VALUE_Iberia_pr")
plotClimatology(climatology(VALUE_Iberia_pr), backdrop.theme = "countries")

SantanderMetGroup/transformeR documentation built on Feb. 14, 2020, 5:55 p.m.