bk_make | R Documentation |
bk$gval
At minimum, a "bk" object contains three items:
bk_make(g)
g |
list with any of the six named arguments mentioned above ( |
gdim: vector of two positive integers, the number of grid lines (n = their product)
gres: vector of two positive scalars, the resolution (in distance between grid lines)
gyx: list of two numeric vectors (lengths matching gdim), the grid line intercepts
This defines the grid dimensions, their spacing (resolution), and the grid extent. All
are in the order y, x, so that gdim is consistent with base::dim
if we interpret the
data grid as a matrix.
gval: numeric vector or matrix, the grid data
In the single layer case, data are stored as a vector (the column-vectorization), with NAs representing missing data. In the multi-layer case, the data are stored in a matrix, with layers in columns. For the matrix case only, we use a sparse representation and omit the NAs. This requires an additional indexing vector:
idx_grid: length-n numeric vector mapping rows of multi-layer to grid points
Lastly, for geo-referenced data we store the projection info as a WKT CRS
crs: character, the CRS for the grid
CONSTRUCTOR
Make a bk grid object
This constructs a "bk" object from a named list containing at least the element gdim
.
Users can optionally provide other list elements gyx
, gres
, gval
, crs
, and
idx_grid
(which must have one non-NA index for each row in gval
. See description).
Typical usage is to pass the results of bk_make
to bk_validate
. This fills in any
missing and checks that all entries are valid and compatible with one another.
Input classes and lengths are checked before returning. gdim
and gres
are length-2
vectors (with y and x elements) but they can each be specified by a single number, as
shorthand to use the same value for y and x. gval
should be a matrix or vector of grid
data, and crs
should be a character string (the WKT representation).
a "bk" object
# auto-print reminds users to validate
bk_make(list(gdim=10, gres=0.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.