Learn R Programming

sits (version 1.4.0)

sits_variance: Calculate the variance of a probability cube

Description

Takes a probability cube and estimate the local variance of the logit of the probability, to support the choice of parameters for Bayesian smoothing.

Usage

sits_variance(
  cube,
  window_size = 9,
  neigh_fraction = 0.5,
  multicores = 2,
  memsize = 4,
  output_dir,
  version = "v1"
)

Value

A variance data cube.

Arguments

cube

Probability data cube.

window_size

Size of the neighborhood.

neigh_fraction

Fraction of neighbors with highest probability to be used in Bayesian inference.

multicores

Number of cores to run the smoothing function

memsize

Maximum overall memory (in GB) to run the smoothing.

output_dir

Output directory for image files

version

Version of resulting image (in the case of multiple tests)

Author

Gilberto Camara, gilberto.camara@inpe.br

Rolf Simoes, rolf.simoes@inpe.br

Examples

Run this code
if (sits_run_examples()) {
    # create a ResNet model
    rfor_model <- sits_train(samples_modis_ndvi, sits_rfor())
    # create a data cube from local files
    data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
    cube <- sits_cube(
        source = "BDC",
        collection = "MOD13Q1-6",
        data_dir = data_dir
    )
    # classify a data cube
    probs_cube <- sits_classify(
        data = cube, ml_model = rfor_model, output_dir = tempdir()
    )
    # plot the probability cube
    plot(probs_cube)
    # smooth the probability cube using Bayesian statistics
    var_cube <- sits_variance(probs_cube, output_dir = tempdir())
    # plot the variance cube
    plot(var_cube)
}

Run the code above in your browser using DataLab