View source: R/speclib_get_reflectance.R
| get_reflectance | R Documentation |
Returns weighted or unweighted reflectance values at wavelength position.
get_reflectance(spectra, wavelength, position, weighted = FALSE, ...)
spectra |
Object of class |
wavelength |
Vector with wavelength values. May be missing if spectra is object of class |
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 |
... |
Arguments to be passed to specific functions. Currently ignored. |
A vector with reflectance values for each spectrum is returned. If position falls outside of spectral range of input values, NA values are returned.
Lukas Lehnert \& Hanna Meyer
spectra
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)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.