cluster2plot: Convert a grid of clusters into a C4R grid for plotting

View source: R/cluster2plot.R

cluster2plotR Documentation

Convert a grid of clusters into a C4R grid for plotting

Description

This function allows to prepare a grid of clusters (included in 'time' dimension) for plotting. A subset of a variable and/or member is also performed in multimember or multigrid objects.

Usage

cluster2plot(cluster, members = 1, var = getVarNames(cluster)[1])

Arguments

cluster

A grid (gridded or station dataset), multigrid, multimember grid or multimember multigrid object, as returned by clusterGrid, with clusters in the 'time' dimension.

members

(optional) Integer value indicating the position of the member to be subset. Default: 1. If input grid has no member dimension, this argument is ignored.

var

(optional) Character vector indicating the variable name to be extracted. Default: first variable. See subsetGrid.

Value

A new C4R grid object that contains the clusters from the specified variable and/or member. This subset grid of clusters is ready to be plotted with C4R plotting tools, e.g. spatialPlot, since clusters are intrepreted as variables (see makeMultiGrid).

Author(s)

J. A. Fernandez

See Also

makeMultiGrid, subsetGrid, subsetDimension.

Examples


require(climate4R.datasets)
#Example 1: 'cluster' is a 3D grid of clusters.
data(NCEP_Iberia_psl)
clusters<- clusterGrid(NCEP_Iberia_psl, type = "kmeans", centers = 10)
mg <- cluster2plot(clusters)
require(visualizeR)
spatialPlot(mg, backdrop.theme = "coastline", rev.colors = TRUE,
            layout = c(2,ceiling(attr(clusters, "centers")/2)),
             as.table = TRUE)


SantanderMetGroup/transformeR documentation built on Nov. 25, 2024, 1:25 p.m.