This task resamples a given spectrum to a different set of wavelengths, typically from a hyperspectral image.

Example


; Launch the application
e = ENVI()
 
; Open a spectral library
specLibFile = FILEPATH('veg_2grn.sli', ROOT_DIR=e.ROOT_DIR, $
  SUBDIR=['resource', 'speclib', 'veg_lib'])
specLib = ENVISpectralLibrary(specLibFile)
 
; Open a hyperspectral image
file = FILEPATH('AVIRISReflectanceSubset.dat', $
  ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data', 'hyperspectral'])
raster = e.OpenRaster(file)
 
; Get wavelength units of raster
Task1 = ENVITask('RasterMetadataItem')
Task1.INPUT_RASTER = raster
Task1.KEY = 'Wavelength Units'
Task1.Execute
 
; Get wavelengths of raster
Task2 = ENVITask('RasterMetadataItem')
Task2.INPUT_RASTER = raster
Task2.KEY = 'Wavelength'
Task2.Execute
 
; Get the selected spectrum from spectral library
Task3 = ENVITask('GetSpectrumFromLibrary')
Task3.INPUT_SPECTRAL_LIBRARY = specLib
Task3.SPECTRUM_NAME = 'Dry Grass'
Task3.Execute
 
; Plot the spectrum
y3 = Task3.SPECTRUM
x3 = Task3.WAVELENGTHS
origPlot = PLOT(x3,y3, 'r2', $
  TITLE='Dry Grass (original)', $
  XTITLE='Wavelengths (um)', $
  YTITLE='Data Value')
 
; Get the resample spectrum task from the catalog of ENVITasks
Task4 = ENVITask('ResampleSpectrum')
 
; Define inputs
 
; Spectrum from library to be resampled
Task4.INPUT_SPECTRUM = Task3.SPECTRUM
 
; Wavelengths from spectral library
Task4.INPUT_WAVELENGTHS = Task3.WAVELENGTHS
 
; Wavelength units from spectral library
Task4.INPUT_WAVELENGTH_UNITS = Task3.WAVELENGTH_UNITS
 
; Wavelengths from raster
Task4.RESAMPLE_WAVELENGTHS = Task2.VALUE.VALUE
 
; Wavelength units from raster
Task4.RESAMPLE_WAVELENGTH_UNITS = Task1.VALUE.VALUE
 
; Run the resample spectrum task
Task4.Execute
 
; Plot the resampled spectrum
y4 = Task4.OUTPUT_SPECTRUM
x4 = Task3.WAVELENGTHS
specLibPlot = PLOT(x4,y4, 'g2', $
  TITLE='Dry grass (resampled)', $
  XTITLE='Wavelengths (um)', $
  YTITLE='Data Value')

Syntax


Result = ENVITask('ResampleSpectrum')

Input parameters (Set, Get): INPUT_SPECTRUM, INPUT_WAVELENGTHS, INPUT_WAVELENGTH_UNITS, MISSING, RESAMPLE_WAVELENGTHS, RESAMPLE_WAVELENGTH_UNITS

Output parameters (Get only): OUTPUT_SPECTRUM

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters


INPUT_SPECTRUM (required)

Specify an array that represents the spectrum to resample.

INPUT_WAVELENGTHS (required)

Specify an array that represents the wavelength values for a given spectrum.

INPUT_WAVELENGTH_UNITS (optional)

The units of the input wavelengths.

MISSING (optional)

Specify the value to use for a spectra that falls outside the input wavelength range. The default value is 0.

RESAMPLE_WAVELENGTHS (required)

Specify an array that represents the wavelengths to resample the input spectrum to. This can come from an image (using the RasterMetadataItem task) or from your own array of values.

RESAMPLE_WAVELENGTH_UNITS (optional)

The units to convert the resampled spectrum wavelengths to.

Output Parameters


OUTPUT_SPECTRUM

The resampled output spectrum.

Methods


Execute

Parameter

ParameterNames

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History


ENVI 5.3

Introduced

See Also


ENVITask, ENVISpectralLibrary, QuerySpectralLibrary Task, RasterMetadataItem Task, ENVIGetSpectrumFromLibrary