Example code that will create an image cube from a spectral library
This Help Article includes example code that will create an image cube from an input spectral library in ENVI format. By converting the spectral library to an image cube, you can use ENVI's spectral tools that only work on images such as Linear Spectral Unmixing.
-------------------------------------------
pro create_library_cube
compile_opt idl2
lib=envi_pickfile(title='Select the spectral library to convert')
if (lib eq '') then return
envi_open_file, lib, r_fid=fid
envi_file_query,fid, dims=dims, wl=wl, ns=ns, nl=nl
spec=envi_get_data(fid=fid, dims=dims, pos=0)
p=[1,2,0]
spec_out = transpose(reform(spec, ns, nl, 1), p)
envi_enter_data, spec_out, wl=wl
end
Review on 12/31/2013 MM