Read ENVI spectral libraries

Share:

Description

read/write support for ENVI spectral libraries

Usage

1
readSLI(path)

Arguments

path

Path to spectral library file with ending .sli.

Details

ENVI spectral libraries consist of a binary data file (.sli) and a corresponding header (.hdr, or .sli.hdr) file.

Value

The spectral libraries are read into a data.frame. The first column contains the wavelengths and the remaining columns contain the spectra.

See Also

writeSLI

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Create fake spectra
data <- data.frame(wavelength=350:2500, spectrumA=cumsum(abs(rnorm(2151))), 
						spectrumB=cumsum(abs(rnorm(2151))))
pathToFile <- paste0(tempdir(),"/specLib.sli")

## Write to binary spectral library
writeSLI(x = data, path = pathToFile)

## Read from binary spectral library
dataRe <- readSLI(path = pathToFile)

## Check whether they are the same
all.equal(data, dataRe)

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