sk_validate {snapKrig} | R Documentation |
Check compatibility of entries in a sk grid object, and fill in any missing ones
Description
This constructs the object and fills missing entries. It then does some sanity checks
and computes the index of NA points (in list entry is_obs
).
Usage
sk_validate(g, res_tol = 1e-06)
Arguments
g |
a "sk" object or a list accepted by |
res_tol |
positive numeric, tolerance validating resolution (see details) |
Details
The function removes/introduces idx_grid
depending on whether gval
is a vector
(single-layer case) or a matrix (usually a multi-layer case). If idx_grid
is missing
and gval
is a matrix, it is assumed to contain all grid-points (including NAs)
The function also assigns dimension names in the order 'y', 'x' (unless otherwise
specified) for gdim
, gres
, and gyx
.
res_tol
is used to check if the resolution gres
is consistent with the spacing
of the grid lines. Only the spacing of the first two lines is computed - if the
relative error along either dimensions is greater res_tol
, the function throws
an error.
Value
a validated "sk" object
Examples
sk_validate(list(gdim=10, gres=0.5))
sk_validate(list(gval=stats::rnorm(10^2), gdim=10, gres=0.5))