get_reflectance: Get reflectance values

View source: R/speclib_get_reflectance.R

get_reflectanceR Documentation

Get reflectance values

Description

Returns weighted or unweighted reflectance values at wavelength position.

Usage

get_reflectance(spectra, wavelength, position, weighted = FALSE, ...)

Arguments

spectra

Object of class Speclib or data.frame with reflectance values.

wavelength

Vector with wavelength values. May be missing if spectra is object of class Speclib.

position

Numeric value passing the position of reflectance values to be returned in dimensions of the wavelength values.

weighted

Logical indicating if reflectance values should be interpolated to fit wavelength position. If FALSE the reflectance values of nearest neighbour to passed position are returned.

...

Arguments to be passed to specific functions. Currently ignored.

Value

A vector with reflectance values for each spectrum is returned. If position falls outside of spectral range of input values, NA values are returned.

Author(s)

Lukas Lehnert \& Hanna Meyer

See Also

spectra

Examples

data(spectral_data)

## Simulate multispectral sensor encompassing two bands 
## to show effect of weighted and unweighted modes
spectral_data_res <- spectralResampling(spectral_data, 
  sensor = data.frame(lb = c(400, 600), ub = c(500, 700)))

## Compare reflectance at 520 nm (in between both bands to 
## show the difference between weighted and unweighted modes)
weighted_reflectance   <- get_reflectance(spectral_data_res, 
                                          520, weighted = TRUE)
unweighted_reflectance <- get_reflectance(spectral_data_res, 
                                          520, weighted = FALSE)

## Plot result
plot(weighted_reflectance, unweighted_reflectance, 
     ylab = "Reflectance at 520 nm (unweighted)", 
     xlab = "Reflectance at 520 nm (weighted)")

hsdar documentation built on March 18, 2022, 6:35 p.m.