This task resamples a given spectrum to a different set of wavelengths, typically from a hyperspectral image.
Example
e = ENVI()
specLibFile = FILEPATH('veg_2grn.sli', ROOT_DIR=e.ROOT_DIR, $
SUBDIR=['resource', 'speclib', 'veg_lib'])
specLib = ENVISpectralLibrary(specLibFile)
file = FILEPATH('AVIRISReflectanceSubset.dat', $
ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data', 'hyperspectral'])
raster = e.OpenRaster(file)
Task1 = ENVITask('RasterMetadataItem')
Task1.INPUT_RASTER = raster
Task1.KEY = 'Wavelength Units'
Task1.Execute
Task2 = ENVITask('RasterMetadataItem')
Task2.INPUT_RASTER = raster
Task2.KEY = 'Wavelength'
Task2.Execute
Task3 = ENVITask('GetSpectrumFromLibrary')
Task3.INPUT_SPECTRAL_LIBRARY = specLib
Task3.SPECTRUM_NAME = 'Dry Grass'
Task3.Execute
y3 = Task3.SPECTRUM
x3 = Task3.WAVELENGTHS
origPlot = PLOT(x3,y3, 'r2', $
TITLE='Dry Grass (original)', $
XTITLE='Wavelengths (um)', $
YTITLE='Data Value')
Task4 = ENVITask('ResampleSpectrum')
Task4.INPUT_SPECTRUM = Task3.SPECTRUM
Task4.INPUT_WAVELENGTHS = Task3.WAVELENGTHS
Task4.INPUT_WAVELENGTH_UNITS = Task3.WAVELENGTH_UNITS
Task4.RESAMPLE_WAVELENGTHS = Task2.VALUE.VALUE
Task4.RESAMPLE_WAVELENGTH_UNITS = Task1.VALUE.VALUE
Task4.Execute
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 properties (Set, Get): INPUT_SPECTRUM, INPUT_WAVELENGTHS, INPUT_WAVELENGTH_UNITS, MISSING, RESAMPLE_WAVELENGTHS, RESAMPLE_WAVELENGTH_UNITS
Output properties (Get only): OUTPUT_SPECTRUM
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
Methods
This task inherits the following methods from ENVITask:
AddParameter
Execute
Parameter
ParameterNames
RemoveParameter
Properties
This task inherits the following properties from ENVITask:
COMMUTE_ON_DOWNSAMPLE
COMMUTE_ON_SUBSET
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
TAGS
This task also contains the following properties:
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.
OUTPUT_SPECTRUM
The resampled output spectrum.
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.
Version History
API Version
4.3
See Also
ENVITask, ENVISpectralLibrary, QuerySpectralLibrary Task, RasterMetadataItem Task, ENVIGetSpectrumFromLibrary