get_reflectance: Get reflectance values

Description Usage Arguments Value Author(s) See Also Examples

View source: R/speclib_get_reflectance.R

Description

Returns weighted or unweighted reflectance values at wavelength position.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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 Nov. 17, 2017, 4:35 a.m.