getVarNames | R Documentation |
Get the names of the variables of a (multi)grid
getVarNames(grid, type = c("short", "long"), append.level = TRUE)
grid |
A grid or station data |
type |
Character. Should either the |
append.level |
Append the vertical level to the short name string?. Default to |
About short names
Note that for variables with vertical levels, if the option append.level
is set to TRUE
(the default),
the function will "construct" the shortname following the climate4R convention,
that defines the code of the variable plus its vertical level, separated by a “@” symbol.
This way, when querying grid variable names, the behaviour of getVarNames
is different than directly accessing
the varName
element of the grid structure as in, e.g.: grid$Variable$varName
. Using getVarNames
with append.level = TRUE
is recommended in most applications when the variable string is needed.
About long names
The long name is an optional attribute of a grid (not so the short name), and it is sometimes undefined (particularly in station datasets).
In this case, the function returns NULL
.
A character vector with the variable name(s) in the indicated type
format.
J Bedia
Other get.helpers:
get2DmatCoordinates()
,
getCoordinates()
,
getDim()
,
getGrid()
,
getGridProj()
,
getGridVerticalLevels()
,
getRefDates()
,
getSeason()
,
getShape()
,
getStationID()
,
getWT()
,
getYearsAsINDEX()
,
setGridProj()
,
typeofGrid()
,
which.leap()
require(climate4R.datasets)
data("CFS_Iberia_pr")
getVarNames(CFS_Iberia_pr)
grid <- CFS_Iberia_pr
getVarNames(CFS_Iberia_pr, "long")
## Example with a multigrid
data(NCEP_Iberia_hus850, NCEP_Iberia_psl, NCEP_Iberia_ta850)
mg <- makeMultiGrid(NCEP_Iberia_hus850, NCEP_Iberia_psl, NCEP_Iberia_ta850)
getVarNames(mg)
# The level can be removed id needed:
getVarNames(mg, append.level = FALSE)
data("CFS_Iberia_tas", "CFS_Iberia_pr")
mg <- makeMultiGrid(CFS_Iberia_tas, CFS_Iberia_pr)
getVarNames(mg)
getVarNames(mg, "long")
## Example with station data
data("VALUE_Iberia_tas")
## The long name is an optional attribute, and might be undefined:
getVarNames(VALUE_Iberia_tas, "long")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.