checkVarNames: Variable name check

View source: R/helpers.R

checkVarNamesR Documentation

Variable name check

Description

Check the consistency of variable (short)names across grids/multigrids

Usage

checkVarNames(..., check.order = TRUE)

Arguments

...

Input grids to be compared

check.order

Check if the order is consistent across input grids. This is the default. When set to TRUE, the function does not only check that the variable names match, but also that their order is the same (in case of multigrids)

Value

In case of inconsistency of any of the inputs grids, the function stops the execution of the current expression, with an error message.

Author(s)

J Bedia

See Also

getVarNames

Other check.helpers: checkDim(), checkGrid(), checkSeason(), checkTemporalConsistency()

Examples

 
require(climate4R.datasets)
data("NCEP_Iberia_hus850", "NCEP_Iberia_psl", "NCEP_Iberia_ta850")
#' # Testing grids that contain different variables:
try(checkVarNames(NCEP_Iberia_hus850, NCEP_Iberia_psl))
# Testing multigrid contents:
mg <- makeMultiGrid(NCEP_Iberia_hus850, NCEP_Iberia_psl, NCEP_Iberia_ta850)
mg1 <- makeMultiGrid(NCEP_Iberia_hus850, NCEP_Iberia_ta850, NCEP_Iberia_psl)
mg2 <- makeMultiGrid(NCEP_Iberia_ta850, NCEP_Iberia_psl, NCEP_Iberia_hus850)
# The input grids contains the same variables, but their ordering is different:
checkVarNames(mg, mg1, mg2, check.order = FALSE) # OK
# If we do check.order = TRUE (the default), it gives an error:
try(checkVarNames(mg, mg1, mg2, check.order = TRUE)) # Error


SantanderMetGroup/transformeR documentation built on Oct. 28, 2023, 5:26 a.m.