Learn R Programming

sits (version 1.12.0)

sits_classify_raster: Classify a set of spatio-temporal raster bricks using multicore machines

Description

Takes a set of spatio-temporal raster bricks, whose metadata is described by tibble (created by sits_coverage), a set of samples used for training a classification model, a prediction model (created by sits_train), and produces a classified set of RasterLayers. This function is similar to sits_classify which is applied to time series stored in a sits tibble. There are two parameters for optimizing processing of large data sets. These parameters are "memsize" and "multicores". The "multicores" parameter defines the number of cores used for processing. The "memsize" parameter controls the amount of memory available for classification.

Usage

sits_classify_raster(file = NULL, coverage = NULL, ml_model = NULL,
  interval = "12 month", filter = NULL, memsize = 4,
  multicores = NULL)

Arguments

file

File name prefix to store the output. For each time interval, one file will be created.

coverage

Tibble with information about a coverage of space-time raster bricks.

ml_model

An R model trained by sits_train.

interval

Interval between two sucessive classifications, expressed in months.

filter

Smoothing filter to be applied (if desired).

memsize

Memory available for classification (in GB).

multicores

Number of cores to be used for classification.

Value

A tibble with the metadata for the vector of classified RasterLayers.

Examples

Run this code
# NOT RUN {
# Retrieve the set of samples for the Mato Grosso region (provided by EMBRAPA)
data(samples_mt_ndvi)

# Build a machine learning model based on the samples
svm_model <- sits_train(samples_mt_ndvi, sits_svm())

# read a raster file and put it into a vector
file <- system.file("extdata/raster/mod13q1/sinop-crop-ndvi.tif", package = "sits")

# define the timeline
data(timeline_modis_392)

# create a raster coverage file based on the information about the files
raster.tb <- sits_coverage(service = "RASTER", name  = "Sinop-crop",
  timeline = timeline_modis_392, bands = "ndvi", files = file)

# classify the raster file
raster_class.tb <- sits_classify_raster("raster-class", raster.tb,
  ml_model = svm_model, memsize = 4, multicores = 1)
# plot the resulting classification
sits_plot_raster(raster_class.tb[1,], title = "SINOP class 2000-2001")
# }

Run the code above in your browser using DataLab