Learn R Programming

hsdar (version 0.4.1)

soilindex: soilindex

Description

Function calculates a variety of hyperspectral soil indices

Usage

soilindex(x, index, returnHCR = "auto", weighted = TRUE, ...)

Arguments

x
Object of class Speclib
index
Character string. Name or definition of index or vector with names/definitions of indices to calculate. See Details section for further information.
returnHCR
If TRUE, the result will be of class HyperSpecRaster, otherwise it is a data frame. If "auto", the class is automatically determined by passed Speclib.
weighted
Logical indicating if reflectance values should be interpolated to fit wavelength position. If FALSE the reflectance values of nearest neighbour to passed position are returned. See
...
Further arguments passed to derivative functions. Only used for indices requiring derivations.

Value

  • A vector containing indices values. If index is a vector with length > 1, a data frame with ncol = length(index) and nrow = number of spectra in x is returned.

    If function is called without any arguments, return value will be a vector containing all available indices in alphabetical order.

Details

Index must be a charater vector containing pre-defined indices (selected by their name) or self defined indices or any combination of pre- and self-defined indices. Pre-defined indices{ The following indices are available: lll{ Name Formula Reference* BI_TM $((TM\_1^2 + TM\_2^2+ TM\_3^2)/3)^{0.5}$** Mathieu et al. (1998) CI_TM $(TM\_3 - TM\_2)/ (TM\_3 + TM\_2)$** Escadafal and Huete (1991) HI_TM $(2\cdot TM\_3 - TM\_2 - TM\_1)/ (TM\_2-TM\_1)$** Escadafal et al. (1994) NDI $(R_{840} - R_{1650})/(R_{840} + R_{1650})$ McNairn, H. and Protz, R. (1993) NSMI $(R_{1800} - R_{2119})/(R_{1800} + R_{2119})$ Haubrock et al. (2008) RI $R_{693}^2/(R_{447}\cdot R_{556}^3)$ Ben-Dor et al. (2006) RI_TM $TM\_3^2 / (TM\_1 \cdot TM\_2^3)$** Madeira et al. (1997), Mathieu et al. (1998) SI_TM $(TM\_3 - TM\_1)/ (TM\_3 + TM\_1)$** Escadafal et al. (1994) SWIR SI $-41.59 \cdot (R_{2210} - R_{2090}) +$ Lobell et al. (2001) $1.24 \cdot (R_{2280} - R_{2090}) + 0.64$ }

* For references please type: hsdardocs("References.pdf"). ** TM_1 denotes the first band of Landsat Thematic Mapper. Consequently, the hyperspectral data is resmapled to Landsat TM using spectralResampling prior to the calculation of the index. For resampling, the spectral response function is used. } Self-defining indices{ Self-defined indices may be passed using the following syntax:

  • Rxxx:
{Reflectance at wavelength 'xxx'. Note that R must be upper case.} Dxxx:{First derivation of reflectance values at wavelength 'xxx'. Note that D must be upper case.} } Using this syntax, complex indices can be easily defined. Note that the entire definition of the index must be passed as one character string. Consequently, the NSMI would be written as "(R1800-R2119)/(R1800+R2119)".

References

See hsdardocs("References.pdf")

See Also

vegindex, get_reflectance

Examples

Run this code
data(spectral_data)
## Example calculating all available indices
## Get available indices

avl <- soilindex()
vi <- soilindex(spectral_data, avl)

Run the code above in your browser using DataLab