Speclib-class: * Speclib class

Description Details Note Author(s) See Also


Class to store and handle hyperspectral data in R


Spectral data

The spectral data (usually reflectance values) are stored in an object of class '.Spectra'. This object may eiter contain the spectral data as a RasterBrick or as a matrix with columns indicating spectral bands and rows different samples, respectively. The Speclib-class provides converting routines to and from RasterBrick-class allowing to read and write geographic raster data via brick. Since R is in general not intended to be used for VERY large data sets, this functionality should be handled with care. If raster files are large, one should split them in multiple smaller ones and process each of the small files, separately. See the excellent tutorial 'Writing functions for large raster files' available on https://CRAN.R-project.org/package=raster and section '2.2.2 Speclibs from raster files' in 'hsdar-intro.pdf'.

Spectral information

Speclib contains wavelength information for each band in spectral data. This information is used for spectral resampling, vegetation indices and plotting etc. Since spectra can be handled either as continuous lines or as discrete values like for satellite bands, spectral information is handled in two principle ways:

The kind of data may be chosen by the user by setting the flag "continuousdata" (attr(x, "continuousdata")) or passing continuousdata = TRUE/FALSE, when initially converting data to Speclib-class. Take care of doing so, because some functions as spectralResampling may only work correctly with continuous data!

The internal and recommended wavelength unit is nm. If Speclibs are created with wavelength values in other units than nm as passed by wlunit-argument, wavelength values are automatically converted to nm. In this case, functions requiring to pass wavelength information (e.g., mask etc) expect the unit to match the one initially set. The only exception is the Nri-class which always uses and expects nm as unit of passed wavelength values. The following units are automatically detected: mu, ┬Ám, nm, mm, cm, dm, m.

Technical description

An object of class Speclib contains the following slots:


See figure in hsdar-package for an overview of classes in hsdar.


Lukas Lehnert

See Also

plot, readGDAL, mask, idSpeclib,

dim, spectra, SI

hsdar documentation built on Aug. 4, 2020, 5:06 p.m.