Handling spectra

Description

Returning and setting spectra in Speclib

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## S4 method for signature 'Speclib'
spectra(object, i, j, ...)

## S4 replacement method for signature 'Speclib,data.frame'
spectra(object) <- value

## S4 replacement method for signature 'Speclib,matrix'
spectra(object) <- value

## S4 replacement method for signature 'Speclib,numeric'
spectra(object) <- value

## S4 replacement method for signature 'Speclib,RasterBrick'
spectra(object) <- value

Arguments

object

Object of class Speclib.

i

Index of spectra to return. If missing all spectra are returned.

j

Index of bands to return. If missing all bands are returned.

...

Passed to internal function. Currently only one parameter is accepted: return_names: Logical indicating, if names of columns and rows should be set to bandnames and idSpeclib.

value

Matrix or RasterBrick-object containing spectral values. If value is a matrix, columns are band values and rows are spectra.

Details

For spectra<-, the function does not check if dimensions of spectra match dimensions of Speclib. Additionally, no conversion into matrix is performed! If spectra are not correctly stored, errors in other functions may arise. Thus check always carefully, if spectra are modified by hand.

Value

For spectra<-, the updated object. Otherwise a matrix of the spectra in x is returned.

Author(s)

Lukas Lehnert

See Also

Speclib

Examples

1
2
3
4
data(spectral_data)

## Manual plot of the first spectrum
plot(wavelength(spectral_data), spectra(spectral_data)[1,], type="l")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.