calculateNDIcombinations: Calculate Normalized Difference Index (NDI) combinations

View source: R/SOptim_ExtractFeaturesIndices.R

calculateNDIcombinationsR Documentation

Calculate Normalized Difference Index (NDI) combinations

Description

Calculates (all or some) NDI combinations based on an input SpatRaster stack with n>1 layers. Combinations are obtained using the combn function (for combinations of n layers, taken 2 at a time).

Usage

calculateNDIcombinations(
  rst,
  bandNames = NULL,
  subsetBands = NULL,
  getSpatRaster = TRUE,
  scale10k = FALSE,
  filename = NULL,
  writeSingleBandRaster = FALSE,
  verbose = TRUE,
  ...
)

Arguments

rst

An input SpatRaster object with n > 1 layers.

bandNames

A character vector defining band names (e.g., c("Bl","Gr","Rd","NIR")).

subsetBands

An integer vector defining which bands to be used.

getSpatRaster

Should the function return a final SpatRaster object with all NDI combinations? (default: TRUE) If many layers exist in rst then it is advisable that this option is set to FALSE otherwise lack of memory problems may happen.

scale10k

Should data be scaled/multiplied by a factor of 10000 (default: FALSE). If TRUE then the raster data type is set to "INT4S" (otherwise "FLT4S" is used). Used to prevent out-of-memory problems.

filename

A base filename used to export NDI combinations as a multiband (if writeSingleBandRaster=FALSE) or single-band (if otherwise).

writeSingleBandRaster

If an output filename is defined should each NDI raster be written separetely? (default: FALSE) This is used to save up memory by not having to stack up each NDI raster. If writeSingleBandRaster is set to TRUE then a filename must be defined. The final filename will have the band indices or names as suffix.

verbose

Should the function print out progress messages? (default: TRUE)

...

Additional arguments passed to

Value

A SpatRaster object is returned if getSpatRaster=TRUE.


joaofgoncalves/SegOptim documentation built on Feb. 5, 2024, 11:10 p.m.