Skip to contents

Calculate band ratio

Usage

hsi_calc_ratio(
  x,
  bands,
  index_name = NULL,
  filename = "",
  overwrite = FALSE,
  ...
)

Arguments

x

A SpatRaster with hyperspectral data.

bands

Numeric vector of length 2. Wavelengths in nm.

index_name

Character. Name for the output layer. Default NULL.

filename

Character. Output filename. Default "" keeps result in memory.

overwrite

Logical. Overwrite existing file. Default FALSE.

...

Additional arguments passed to terra::writeRaster().

Value

A SpatRaster with band ratio values.

Examples

if (FALSE) { # \dontrun{
x <- terra::rast("REFLECTANCE_testdata.tif")

x_ratio <- hsi_calc_ratio(
  x,
  bands = c(570, 690)
)

x_ratio <- hsi_calc_ratio(
  x,
  bands = c(570, 690),
  index_name = "ratio570690",
  filename = "output_ratio.tif",
  overwrite = TRUE
)
} # }