Learn R Programming

sits (version 1.5.3)

sits_get_probs: Get values from probability maps

Description

Given a set of lat/long locations and a probability cube, retrieve the prob values of each point. This function is useful to estimate probability distributions and to assess the differences between classifiers.

Usage

sits_get_probs(cube, samples, window_size = NULL)

# S3 method for csv sits_get_probs(cube, samples, window_size = NULL)

# S3 method for shp sits_get_probs(cube, samples, window_size = NULL)

# S3 method for sf sits_get_probs(cube, samples, window_size = NULL)

# S3 method for sits sits_get_probs(cube, samples, window_size = NULL)

# S3 method for data.frame sits_get_probs(cube, samples, window_size = NULL)

# S3 method for default sits_get_probs(cube, samples, window_size = NULL)

Value

A tibble of with columns <longitude, latitude, values> in case no windows are requested and <longitude, latitude, neighbors> in case windows are requested

Arguments

cube

Probability data cube.

samples

Location of the samples to be retrieved. Either a tibble of class "sits", an "sf" object with POINT geometry, the location of a POINT shapefile, the location of csv file with columns "longitude" and "latitude", or a data.frame with columns "longitude" and "latitude"

window_size

Size of window around pixel (optional)

Author

Gilberto Camara, gilberto.camara@inpe.br

Examples

Run this code
if (sits_run_examples()) {
    # create a random forest 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.1",
        data_dir = data_dir
    )
    # classify a data cube
    probs_cube <- sits_classify(
        data = cube, ml_model = rfor_model, output_dir = tempdir()
    )
    # obtain the a set of points for sampling
    ground_truth <- system.file("extdata/samples/samples_sinop_crop.csv",
        package = "sits"
    )
    # get the classification values for a selected set of locations
    probs_samples <- sits_get_probs(probs_cube, ground_truth)
}

Run the code above in your browser using DataLab