checkDim: Spatial check of input grids

View source: R/helpers.R

checkDimR Documentation

Spatial check of input grids

Description

Checks that the input grids have the same lon/lat shape

The function simply compares the size of the dimension across input grids for structural consistency of their respective data arrays. It does not make any additional checks on the metadata, so equal array shapes do not entail full temporal/spatial consistency.

Usage

checkDim(..., dimensions = c("var", "member", "time", "lat", "lon"))

Arguments

...

Input grids to be compared

dimension

Character vector. Dimensions to check for consistency. Several dimensions can be tested at once. Possible values are: "var", "member", "time", "lat" and "lon".

Value

In case of spatial 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

getShape

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

Examples

 
require(climate4R.datasets)
data("VALUE_Iberia_tas")
data("VALUE_Iberia_pr")
checkDim(VALUE_Iberia_tas, VALUE_Iberia_pr) # ok, go on
data("EOBS_Iberia_tas")
data("EOBS_Iberia_pr")
checkDim(EOBS_Iberia_tas, EOBS_Iberia_pr) # ok, go on
data("NCEP_Iberia_psl")
try(checkDim(EOBS_Iberia_tas, EOBS_Iberia_pr, NCEP_Iberia_psl)) # inconsistent dimensions
data("CFS_Iberia_tas")
try(checkDim(NCEP_Iberia_psl, CFS_Iberia_tas, dimensions = "member")) 
checkDim(VALUE_Iberia_tas, VALUE_Iberia_pr) # ok, go on


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