setGridUnits | R Documentation |
Set the "units"
attribute of a grid
setGridUnits(grid, unit.string, var = NULL)
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). |
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.
Retunrs (invisible) the same input grid with the new "units"
attribute in "$Variable"
list element.
J Bedia
Other get.helpers unit.helpers:
getGridUnits()
require(climate4R.datasets)
data(NCEP_Iberia_hus850, NCEP_Iberia_psl, NCEP_Iberia_ta850)
getGridUnits(NCEP_Iberia_hus850)
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("hus@850", "psl"))
getGridUnits(mf3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.