as_terra | R Documentation |
Function to coerce (convert) an LPJmLData
object into a
rast object that allows GIS-based raster operations.
Read more about the terra package at https://rspatial.org/.
as_terra(x, subset = NULL, aggregate = NULL, ...)
x |
LPJmLData object. |
subset |
List of array dimension(s) as name/key and
corresponding subset vector as value, e.g. |
aggregate |
List of array dimension(s) as name/key and
corresponding aggregation function as value, e.g. |
... |
Arguments passed to the aggregate function(s), e.g.
|
The $grid
attribute is required for spatial transformation. When
using file_type = "meta"
, grid data are usually read automatically via
add_grid()
if the grid file is present in the same directory. Otherwise,
add_grid()
has to be called explicitly with the path to a matching grid
file. Supports either multiple bands or multiple time steps. Use subset
or
aggregate
to reduce data with multiple bands and time steps.
A rast object with spatial extent and coordinates based
on internal $grid
attribute and containing a lon/lat representation of
x$data
. Further meta information such as the lon/lat resolution is
extracted from $meta
.
## Not run:
vegc <- read_io(filename = "./vegc.bin.json")
# Returns a SpatRaster for all data
as_terra(vegc)
# ...
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.