If you need to import AVIRIS ENVI files, have a look at hyperSpec::read.ENVI
. It does not (yet?) provide specific support for the .spec files nor for any georeferencing (as I mainly work with micro-spectroscopy), but adding the wavelength information is reasonably easy by hand:
require ("hyperSpec")
cuprite <- read.ENVI ( file = "data/cuprite/f970619t01p02_r02_sc01.a.rfl",
headerfile = "data/cuprite/f970619t01p02_r02_sc01.a.hdr")
spec <- read.table ( file = "data/cuprite/f970619t01p02_r02.a.spc")
colnames (spec) <- c ("wl", "refl", "V3", "V4", "i")
spec <- spec [order (spec$i),]
wl (cuprite) <- spec$wl
labels (cuprite, ".wavelength") <- expression (lamba / nm)
plotmap (cuprite [,, 827], col.regions = alois.palette ()) # slow
hyperSpec
works with the data cube unfolded into a data matrix with accompanying $x
and $y
information. While this is flexible, you'll probably want to set up an indexing matrix to quickly retrieve images. Or you can reshape the matrix cuprite$spc
to get the hypercube in an array.