Learn R Programming

hsdar (version 0.5.1)

Speclib-class: * Speclib class

Description

Class to store and handle hyperspectral data in R

Arguments

Details

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 and its extension HyperSpecRaster-class. 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:

  • Continuous spectra: Data of spectrometers or hyperspectral (satellite) sensors. This data is plotted as lines with dotted lines indicating standard deviations by default.
  • Non-continuous spectra: Data of multispectral satellite sensors. Here, data is plotted as solid lines and error bars at the mean position of each waveband indicating standard deviations by default.

The kind of data may be chosen by the user by setting the attribute 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 unit of spectral data must be set initially, when converting data to speclib. Note that the package currently supports only "nm" as unit. This is particularly important for function like vegindex, which need to get correct bands out of the spectral data.

Technical description An object of class Speclib contains the following slots:

  • wavelength: Vector with wavelength information.
  • fwhm: Vector or single numerical value giving the full-width-half-max value(s) for each band.
  • spectra: Object of class '.Spectra' with three slots:
    • fromRaster: logical, indicating if spectral data is read from a RasterBrick-object.
    • spectra_ma: Matrix with ncol = number of bands and nrow = number. Used if fromRaster == FALSE
    • spectra_ra: RasterBrick-object which is used if fromRaster == TRUE.

Contains reflectance, transmittance or absorbance values. Handle with function spectra.

  • attributes: Data frame containing additional data to each spectrum. May be used for linear regression etc. Handle with function attribute.
  • usagehistory: Vector giving information on history of usage of speclib. Handle with function usagehistory.
  • See Also

    plot, readGDAL, mask, idSpeclib,

    dim, spectra, attribute