Learn R Programming

sits (version 1.5.3)

sits_as_terra: Convert a data cube into a Spatial Raster object from terra

Description

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 raster_cube sits_as_terra(cube, tile = cube[1L, ]$tile, ..., bands = NULL, date = NULL)

# S3 method for probs_cube sits_as_terra(cube, tile = cube[1L, ]$tile, ...)

# S3 method for class_cube sits_as_terra(cube, tile = cube[1L, ]$tile, ...)

# S3 method for variance_cube sits_as_terra(cube, tile = cube[1L, ]$tile, ...)

# S3 method for uncertainty_cube sits_as_terra(cube, tile = cube[1L, ]$tile, ...)

Value

An Spatial Raster object from terra.

Arguments

cube

A sits cube.

tile

Tile of the data cube.

...

Other parameters for specific types of data cubes.

bands

Bands of the data cube to be part of terra object.

date

Date of the data cube to be part of terra object.

Author

Gilberto Camara, gilberto.camara.inpe@gmail.com

Examples

Run this code
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)
}

Run the code above in your browser using DataLab