ndvi2: Calculate and plot a 2-band NDVI.

Description Usage Arguments Details Value Examples

View source: R/ndvi2.R

Description

This function calculates a 2-band NDVI using the nsr function.

Usage

1
ndvi2(s, b1, b2)

Arguments

s

Spectral data in the format of visa's Spectra object, spectra.data.frame or spectra.matrix.

b1

A integer number which defines the wavelength of the 1st spectral band.

b2

A integer number which defines the wavelength of the 2nd spectral band.

Details

Calculate a NDVI with two specific bands of choice. The new NDVI follows the the standard formula

NDVI = (λ_i + λ_j)/(λ_i - λ_j)

. Bands i and j correspond to the b1 and b2 input arguments, respectively. Wavelength indexes are determined based on the first argument 's'.

Value

ndvi

The returned values are the new NDVI.

Examples

1
2
3
library(visa)
s <- NSpec.DF$spectra
ndvi2(s, 780, 680)

visa documentation built on April 20, 2021, 9:07 a.m.