pa_compute_vi {pacu}R Documentation

Compute vegetation indices from a zipped Sentinel 2 file

Description

Compute vegetation indices from a zipped Sentinel 2 file.

Usage

pa_compute_vi(
  satellite.images,
  vi = c("ndvi", "ndre", "gcvi", "reci", "evi", "bsi"),
  aoi = NULL,
  check.clouds = FALSE,
  buffer.clouds = 100,
  downscale.to = NULL,
  pixel.res = c("default", "10m", "20m", "60m"),
  img.formats = c("jp2", "tif"),
  verbose = TRUE
)

Arguments

satellite.images

list of file paths to the Sentinel 2 zip files

vi

the vegetation index to be computed

aoi

NULL or an sf object used to crop the vegetation index raster to an area of interest

check.clouds

whether to check for clouds over the area of interest. If clouds are found, the function will skip cloudy images.

buffer.clouds

distance in meters around the area of interest within a cloud would be considered to interfere with the index calculation. This is useful to eliminate the effect of cloud shading from the analysis.

downscale.to

the resolution in meters to downscale the resolution of the vegetation index raster layer

pixel.res

pixel resolution used to compute the vegetation index. Can be one of 10m, 20m, 30m

img.formats

image formats to search for in the zipped file

verbose

whether to display information on the progress of operations

Details

This is script that unzips the Sentinel 2 zipped file into a temporary folder, searches for the index-relevant bands, and then computes the index. If no ‘aoi’ is provided, the script will compute the vegetation index for the area covered by the image. The vegetation indices are computed as follows:

BSI = \frac{(SWIR + RED) - (NIR + BLUE)}{(SWIR + RED) + (NIR + BLUE)}

EVI = \frac{2.5 \times (NIR - RED)}{(NIR + (6 \times RED) - (7.5 \times BLUE) - 1) }

GCVI = \frac{(NIR)}{(GREEN)} - 1

NDRE = \frac{(NIR - RED edge)}{(NIR + RED edge)}

NDVI = \frac{(NIR - RED)}{(NIR + RED)}

RECI = \frac{(NIR)}{(RED edge)} - 1

Value

an object of class veg.index and stars

Author(s)

Caio dos Santos and Fernando Miguez

Examples


extd.dir <- system.file("extdata", package = "pacu")
## List of zipped Sentinel files in a directory
s2a.files <- list.files(extd.dir, '\\.zip', full.names = TRUE)
area.of.interest <- sf::st_read(file.path(extd.dir, 'cobs_a_aoi.shp'))
ndvi <- pa_compute_vi(satellite.images = s2a.files,
                            vi = 'ndvi',
                            aoi = area.of.interest,
                            check.clouds = TRUE)

ndre <- pa_compute_vi(satellite.images = s2a.files,
                            vi = 'ndre',
                            aoi = area.of.interest,
                            check.clouds = TRUE)





[Package pacu version 0.1.44 Index]