speclib: Methods to create objects of class Speclib

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Methods to create objects of class Speclib from various data sources such as matrixes and raster files (e.g. GeoTiff).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## S4 method for signature 'matrix,numeric'
speclib(spectra, wavelength, ...)

## S4 method for signature 'SpatialGridDataFrame,numeric'
speclib(spectra, wavelength, ...)

## S4 method for signature 'numeric,numeric'
speclib(spectra, wavelength, ...)

## S4 method for signature 'matrix,data.frame'
speclib(spectra, wavelength, ...)

## S4 method for signature 'SpatialGridDataFrame,data.frame'
speclib(spectra, wavelength, ...)

## S4 method for signature 'numeric,data.frame'
speclib(spectra, wavelength, ...)

## S4 method for signature 'matrix,matrix'
speclib(spectra, wavelength, ...)

## S4 method for signature 'SpatialGridDataFrame,matrix'
speclib(spectra, wavelength, ...)

## S4 method for signature 'numeric,matrix'
speclib(spectra, wavelength, ...)

## S4 method for signature 'hyperSpec'
speclib(spectra, wavelength, ...)

## S4 method for signature 'character,numeric'
speclib(spectra, wavelength, ...)

## S4 method for signature 'Speclib,numeric'
speclib(spectra, wavelength, ...)

## S4 method for signature 'Speclib'
print(x)

## S4 method for signature 'Speclib'
show(object)

is.speclib(x)

Arguments

spectra

Data frame, matrix of raster object of class 'RasterBrick' or 'SpatialGridDataFrame' with spectral data. Alternatively, spectra may be the path to a raster file containing hyperspectral data.

x,object

Object to be converted to or from Speclib. For conversion to Speclib it can be a of class 'data frame', 'matrix', 'list' or 'character string'. In the latter case x is interpreted as path to raster object and read by readGDAL. For conversion from Speclib the object must be of class Speclib.

wavelength

Vector with corresponding wavelength for each band. A matrix or data.frame may be passed giving the upper and lower limit of each band. In this case, the first column is used as lower band limit and the second as upper limit, respectively.

...

Further arguments passed to specific (generic) functions. Theey encompass particularly the following additional parameters:

  • fwhm: Vector containing full-width-half-max values for each band. Default: NULL

  • SI: Data frame with supplementary information to each spectrum. Default: NULL

  • transformation: Kind of transformation applied to spectral data (character). See transformSpeclib for available ones. If transformation = NULL, no transformation is assumed (default).

  • usagehistory: Character string or vector used for history of usage. Default: NULL

  • continuousdata: Flag indicating if spectra are quasi continuous or discrete sensor spectra (deprecated). Default: "auto"

  • wlunit: Unit of wavelength in spectra. Default: "nm". See datails how other units are treated.

  • xlabel: Label of wavelength data to be used for plots etc. Default: "Wavelength"

  • ylabel: Label of spectral signal to be used for plots etc. Default: "Reflectance"

  • rastermeta: List of meta information for SpatialGridDataFrame. If missing, meta data in speclib is used. Use function rastermeta to create valid objects. Default: NULL

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. 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:

Value

An object of class Speclib containing the following slots is returned:

Author(s)

Lukas Lehnert

See Also

Speclib, plot, readGDAL, mask,

idSpeclib, dim, spectra,

SI

Examples

1
2
3
4
5

hsdar documentation built on June 21, 2018, 9 a.m.