spectralResampling: Spectral resampling

spectralResamplingR Documentation

Spectral resampling

Description

Resample spectra to (satellite) sensors

Usage

spectralResampling(x, sensor, rm.NA = TRUE, continuousdata = "auto",
                   response_function = TRUE)

Arguments

x

Object of class Speclib. Data to be spectrally resampled.

sensor

Character or data.frame containing definition of sensor characteristics. See details section for further information.

rm.NA

If TRUE, channels which are not covered by input data wavelength are removed

continuousdata

Definition if returned Speclib is containing continuous data or not.

response_function

If TRUE, the spectral response function of the sensor is used for integration, if FALSE a Gaussian distribution is assumed and if NA the mean value of spectra[min(ch):max(ch)] is calculated. If response_function is an object of class Speclib the function assumes that the spectra in the object are spectral response values. In this case the wavelength dimension determines the spectral response values for the respective wavelength and the sample dimension separates between the different bands. Note that if response_function is an object of class Speclib, sensor may be missing. In this case the function calculates the central wavelength and the fwhm-values from the spectral response functions.

Details

The characteristics of (satellite) sensor to integrate spectra can be chosen from a list of already implemented sensors. See get.sensor.characteristics for available sensors.

Otherwise the characteristics can be passed as a data.frame with two columns: first column with lower bounds of channels and second column with upper bounds. Alternatively, the data.frame may encompass band centre wavelength and full-width-half-maximum values of the sensor. Function will check the kind of data passed by partially matching the names of the data frame: If any column is named "fwhm" or "center", it is assumed that data are band centre and full-width-half-maximum values.

The third option is to use a Speclib containing the spectral response values instead of reflectances. In this case, the sensor-argument may be missing and the function automatically determines the sensor's central wavelength and the fwhm-values based on the spectral response values. See examples.

If sensor characteristics are defined manually and no Speclib with spectral response values is passed, a Gaussian response is assumed.

Value

Object of class Speclib

Note

The spectral response functions are kindly provided by the operators of the satellites. See hsdardocs("Copyright") for copyright information on spectral response functions.

  • Quickbird: Copyright by DigitalGlobe, Inc. All Rights Reserved

  • RapidEye: Copyright by RapidEye AG

  • WorldView-2: Copyright by DigitalGlobe, Inc. All Rights Reserved

Author(s)

Lukas Lehnert

See Also

get.sensor.characteristics, get.gaussian.response

Examples

## Load example data  
data(spectral_data)

## Resample to RapidEye
data_RE <- spectralResampling(spectral_data, "RapidEye", 
                              response_function = TRUE)

## Plot resampled spectra
plot(data_RE)

## Compare different methods of spectral resampling
par(mfrow=c(1,3))
ga <- spectralResampling(spectral_data, "RapidEye", 
                         response_function = FALSE)
plot(ga)
re <- spectralResampling(spectral_data, "RapidEye", 
                         response_function = TRUE)
plot(re)
no <- spectralResampling(spectral_data, "RapidEye", 
                         response_function = NA)
plot(no)

## Usage of Speclib with spectral response values
## Define 3 bands (RGB)
center <- c(460, 530, 600)
fwhm   <- 70
wl     <- c(310:750)

## Create spectral response with gaussian density function
response <- speclib(t(sapply(center, function(center, wl, fwhm)
{
  a <- dnorm(wl, mean = center, sd = fwhm/2)
  a <- (a-min(a))/(max(a) - min(a))
  return(a)
}, wl, fwhm)), wl)

## Plot response functions
for (i in 1:3)
  plot(response[i,], new = i == 1, col = c("blue", "green", "red")[i])
  
## Perform resampling
rgb_data <- spectralResampling(spectral_data, response_function = response)

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