setGridUnits: Set grid units

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

View source: R/helpers.R

Description

Set the "units" attribute of a grid

Usage

1
setGridUnits(grid, unit.string, var = NULL)

Arguments

grid

An input grid

unit.string

Character string: a udunits-parseable character string vector. See details.

var

In case of multigrids, the names of the variables whose units attribute is to be updated (see examples).

Details

The length of the unit.string vector should match the number of variables within the grid (in case of multiGrids), i.e., that of getVarNames(grid) or the length of var, in case the latter is used.

Value

Retunrs (invisible) the same input grid with the new "units" attribute in "$Variable" list element.

Author(s)

J Bedia

See Also

Other get.helpers unit.helpers: getGridUnits

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(NCEP_Iberia_hus850)
getGridUnits(NCEP_Iberia_hus850)
data(NCEP_Iberia_psl)
getGridUnits(NCEP_Iberia_psl)
mf <- makeMultiGrid(NCEP_Iberia_hus850, NCEP_Iberia_psl, NCEP_Iberia_ta850)
getGridUnits(mf)
mf2 <- setGridUnits(mf, unit.string = c("1", "Pa", "Kelvin"))
getGridUnits(mf2)
# Arbitrary subsets of variables within the multigrid can be updated:
getVarNames(mf)
mf3 <- setGridUnits(mf, unit.string = c("1", "Pa"), var = c("[email protected]", "psl"))
getGridUnits(mf3)

SantanderMetGroup/transformeR documentation built on Nov. 23, 2019, 12:28 p.m.