Uses the information about files, bands and dates
in a data cube to produce an object of class terra
.
User has to select a tile and a date from the data cube. By default,
all bands are included in the terra
object.
Users can select bands.
Usage
sits_as_terra(cube, tile = cube[1L, ]$tile, ...)
# S3 method for class 'raster_cube'
sits_as_terra(cube, tile = cube[1L, ]$tile, ..., bands = NULL, date = NULL)
# S3 method for class 'probs_cube'
sits_as_terra(cube, tile = cube[1L, ]$tile, ...)
# S3 method for class 'class_cube'
sits_as_terra(cube, tile = cube[1L, ]$tile, ...)
# S3 method for class 'variance_cube'
sits_as_terra(cube, tile = cube[1L, ]$tile, ...)
# S3 method for class 'uncertainty_cube'
sits_as_terra(cube, tile = cube[1L, ]$tile, ...)
Author
Gilberto Camara, gilberto.camara.inpe@gmail.com
Examples
if (sits_run_examples()) {
# convert sits cube to an sf object (polygon)
data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
cube <- sits_cube(
source = "BDC",
collection = "MOD13Q1-6.1",
data_dir = data_dir
)
spat_raster <- sits_as_terra(cube)
}