Syntax Highlighing:
comments, key words, predefined symbols, class members & methods, functions & classes
########################################################
# avirisl.sml
#
# Within a rvc file, change descriptions of bands of
# aviris data so each has the phrase "wavelength xxxx"
# where xxxx
# is the wavelength of that specific band.
#
#
# NOTE: use only on a single rvc containing just the
# 224 aviris bands from band 001 to 224. Filename and
# object names are hard coded, so change the script for
# different files and objects.
#
# an example would be that you have imported the aviris image
# file with USER DEFINED format, then need to name the wavelengths
# for use in the hyperspectral application
#
# AUTHOR: Ray L. Harris, Jr.
#
# REQUESTED BY:
# CREATION DATE: March 31, 1998
# REVISION LIST:
########################################################
clear();
string filename$ = "e:/avirisHL.rvc";
# AVIRIS has 4 detectors, so need 4 rows 5 columns
# of beginning band, ending band, beginning wavelength, ending
# wavelength, wavelength increment
# Values extracted from "A system overview of the Airborne Visible/
# Ifrared Imaging Spectrometer (AVIRIS)" 9.0 Appendix: AVIRIS
# INSTRUMENT PARAMETERS
class MATRIX detectorMat;
raster A;
detectorMat = CreateMatrix(4,5);
#Detector 1, units in um
SetMatrixItem(detectorMat,0,0,1);
SetMatrixItem(detectorMat,0,1,31);
SetMatrixItem(detectorMat,0,2,0.41);
SetMatrixItem(detectorMat,0,3,0.70);
SetMatrixItem(detectorMat,0,4,0.0097);
#Detector 2
SetMatrixItem(detectorMat,1,0,32);
SetMatrixItem(detectorMat,1,1,95);
SetMatrixItem(detectorMat,1,2,0.68);
SetMatrixItem(detectorMat,1,3,1.27);
SetMatrixItem(detectorMat,1,4,0.0095);
#Detector 3
SetMatrixItem(detectorMat,2,0,96);
SetMatrixItem(detectorMat,2,1,160);
SetMatrixItem(detectorMat,2,2,1.25);
SetMatrixItem(detectorMat,2,3,1.86);
SetMatrixItem(detectorMat,2,4,0.0098);
#Detector 4
SetMatrixItem(detectorMat,3,0,161);
SetMatrixItem(detectorMat,3,1,224);
SetMatrixItem(detectorMat,3,2,1.84);
SetMatrixItem(detectorMat,3,3,2.45);
SetMatrixItem(detectorMat,3,4,0.0098);
#outside loop for each of the detectors
numeric r;
numeric bb, eb, firstw, ew, incrementw, wavelength;
numeric objnum, t;
string objname$, string$;
for r = 0 to 3 {
bb = GetMatrixItem(detectorMat,r,0);
eb =GetMatrixItem(detectorMat,r,1);
firstw =GetMatrixItem(detectorMat,r,2);
ew =GetMatrixItem(detectorMat,r,3);
incrementw = GetMatrixItem(detectorMat,r,4);
wavelength = firstw;
#inside loop for each detectors wavelengths
for t = bb to eb {
objname$ = sprintf("PG02106_1_%03i",t);
OpenRaster(A, filename$, objname$);
objnum = GetObjectNumber(A);
string$ = "wavelength " + sprintf("%1.3f", wavelength);
print (objname$);
print (string$);
SetObjectDescription(filename$, objnum, string$);
CloseRaster(A);
wavelength = wavelength + incrementw;
}
}