##################################################################################################################
# DiskFile : LandsatCalibrationPilot.sml
# Programmer : Ralf Koller
# Created : 09.10.2003
# Revisions : 1.0 rc2
# Coming next : 1) Slimming the code when the feature passing arrays to functions is implented by microimages
# 2) A refined master selection routine... So far the routine is vulnerable to clouds in scene
# according to them the spread could be stilted...
# 3) The possibility to choose the number of input scenes
# 4) Adding the possibilty to select between (D)ark (O)bject (S)ubstraction 1-3
# 5) The possibility to write the console output directly into a textfile
# 6) If a under number of PIFs was found, the possibility to reenter their number via a pop-up
# 7) The Implementation of a calibration routine for Landsat TM 4 sensors
# 8) So far only congruent scenes get calibrated, but a future aim is to implent the BRDF correction
# so that it will be possible to normalize each part of a mosaiced scene too. Additionaly a auto-
# selection between PIF (for congruent) and BRDF (for mosaiced scenes) routines will be also pro-
# vided and if necessary the user will be able to select how many steps to perform. So it will be
# also possible to perform only the radiance raster computation or only a reflectance raster
# output
# 9) To pipeline all the routines into a externe c programm to slim and fasten up the whole compu-
# tation processes
# 10) The possibility to process scenes with a different cell size
# 11) To lookup the necessary calibration values directly out of the headerfiles
#
##################################################################################################################
#
# Function : At first the script computes age adjusted radiance and atmosphere corrected (DOS 1) reflectance
# rasters. In the next step four soil brightness index rasters are computed and the spreads are
# compared. The scene with the widest spread becomes the master scene (In a mixed setup - MSS to-
# gether with TM and/or ETM - only TM and ETM are able to become the new master). Now each scene
# gets sorted and the dark and bright histogram tails which are similar to the invariant features
# soil and water, are written to PIF masks. Only pixels which are available in all scenes or scene
# pairs are taken into account. In the next step a user defined number of pseudo invariant features
# is chosen randomly. Those are taken into account for the calculation of the regression coefficents,
# correlation coefficents, the level of confidence and the standard deviation of the regression co-
# efficients. So there is still the possibilty to rerun the regression calculation in a statistic
# programm like SPSS or R in the case that the control values indicate a further investigation. In
# the end the reflectance scene of the master is transfered into the output scene. Additionally the
# slave scenes are adjusted via the regression coefficents and are also written into the userdefined
# outputfiles. In the case MSS scenes were processed with a TM or ETM master scene only MSS band 1,
# 2 and 4 got normalized. Band 3 is just a simple not normalized reflectance band...
#
##################################################################################################################
#
# Usage : - You have to enter 4 scenes. In the case you have less than 4 scenes just double enter one of
# them. If the double entered scene becomes the slave scene, everything should be ok, other-
# wise let me know and i'll send you a modified version of the script.
# - All used scenes must have the same cell and image size while covering the same area
#
##################################################################################################################
#
# Credits : Main Code Assistance - Wolfgang Riedl (Siemens A&D ATS 14 - Germany)
# Shell Sort Algorithm - Dan Glasser (Tech Support - Microimages Inc. - Usa)
#
##################################################################################################################
##################################################################################################################
#
# References : Price, J.C. (1987): Calibration of Satellite Radiometers and the Comparison of Vegetation
# Indices. In: Remote Sensing Of Environment, 21, p. 15-27
#
# Samimi, C. (2003): Das Weidepotential im Gutu Distrikt (Zimbabwe) - Möglichkeiten und Grenzen
# Modellierung unter Verwendung von Landsat TM-5. In: Karlsruher Schriften zur Geographie und
# Geoökologie, 19
#
# Fedosejevs, G., Teillet, P.M. (1995): On the dark target approach to atmospheric correction of
# remotely sensed data. In: Canadian Journal of Remote Sensing, 21, 4, p. 374-387
#
# Teillet, P.M., Helder, D.L., Markham, B.L., Barker, J.L., Thome, K.J., Morfitt, R., Schott, J.R.,
# Palluconi, F.D. (2001): A Lifetime Radiometric Calibration Record for the Landsat Thematic Mapper.
# In: Proceedings of the 23rd Canadian Symposium on Remote Sensing. Quebec.
#
# Song, C., Woodcock, C.E., Seto, K. C., Lenney M.P., Macomber S. A. (2001): Classification and
# Change Detection Using Landsat TM Data: When and How to Correct Atmospheric Effects?. In: Remote
# Sensing of Environment, 75, p. 230-244
#
# Muramatsu, K., Furumi, S., Fujiwara, N. Hayashi, A., Daigo, M., Ochiai, F. (2000): Pattern
# decomposition method in the albedo space for Landsat TM and MSS data analysis. In: International
# Journal of Remote Sensing, 21, 1, p. 99-119
#
# Schott, J.R., Salvaggio, C., Volchok, W.J. (1988): Radiometric Scene Normalization Using Pseudo
# Invariant Features. In: Remote Sensing Of Environment, 26, p. 1-16
#
#
# ETM zones see:
# http://ltpwww.gsfc.nasa.gov/IAS/handbook/handbook_htmls/chapter6/chapter6.html#section6.4.2
#
##################################################################################################################
##################################################################################################################
#
# DISCLAIMER : The usage of the script is for free but a commercial adoption isn't permitted. Please be so kind
# to contact me and inform me if you have used or are using the script. Suggestions for optimization
# purpose and submission of bug reports are also welcome. Thanks a lot... r.
#
# Contact : Ralf Koller ( rpk@gmx.net )
# Student of Geography - FAU Erlangen-Nuernberg - Germany
# Supervising: PD Dr. Cyrus Samimi
#
##################################################################################################################
$warnings 3
##############################################
######### Global Variable Declaration ########
##############################################
class XMLDOC docmain; # class instance for XML text containing main dialog specification
class XMLNODE nodemain; # XMLNODE for main dialog window
class GUI_DLG dlgmain; # dialog class for main dialog window
class XMLDOC docs1; # class instance for XML text contain Scene 1 dialog specification
class XMLNODE nodes1; # XMLNODE for Scene 1 dialog
class GUI_DLG dlgs1; # dialog class for Scene 1 dialog
class XMLDOC docs2; # class instance for XML text contain Scene 2 dialog specification
class XMLNODE nodes2; # XMLNODE for Scene 2 dialog
class GUI_DLG dlgs2; # dialog class for Scene 2 dialog
class XMLDOC docs3; # class instance for XML text contain Scene 3 dialog specification
class XMLNODE nodes3; # XMLNODE for Scene 3 dialog
class GUI_DLG dlgs3; # dialog class for Scene 3 dialog
class XMLDOC docs4; # class instance for XML text contain Scene 4 dialog specification
class XMLNODE nodes4; # XMLNODE for Scene 4 dialog
class GUI_DLG dlgs4; # dialog class for Scene 4 dialog
class DATETIME s1yyyymmdd;
class DATETIME s2yyyymmdd;
class DATETIME s3yyyymmdd;
class DATETIME s4yyyymmdd;
array accumulate[12]; # Norm Year Value Array
array accumulateLY[12]; # Leap Year Value Array
numeric ESMSS11, ESMSS12, ESMSS13, ESMSS14;
numeric ESMSS41, ESMSS42, ESMSS43, ESMSS44;
numeric ESMSS51, ESMSS52, ESMSS53, ESMSS54;
numeric ESTM1, ESTM2, ESTM3, ESTM4, ESTM5, ESTM7;
numeric ESETM1, ESETM2, ESETM3, ESETM4, ESETM5, ESETM7;
numeric QCALMAX, QCALMIN;
numeric B1LGLMINBef2000, B2LGLMINBef2000, B3LGLMINBef2000, B4LGLMINBef2000, B5LGLMINBef2000, B7LGLMINBef2000;
numeric B1LGLMAXBef2000, B2LGLMAXBef2000, B3LGLMAXBef2000, B4LGLMAXBef2000, B5LGLMAXBef2000, B7LGLMAXBef2000;
numeric B1HGLMINBef2000, B2HGLMINBef2000, B3HGLMINBef2000, B4HGLMINBef2000, B5HGLMINBef2000, B7HGLMINBef2000;
numeric B1HGLMAXBef2000, B2HGLMAXBef2000, B3HGLMAXBef2000, B4HGLMAXBef2000, B5HGLMAXBef2000, B7HGLMAXBef2000;
numeric B1LGLMINAFT2000, B2LGLMINAFT2000, B3LGLMINAFT2000, B4LGLMINAFT2000, B5LGLMINAFT2000, B7LGLMINAFT2000;
numeric B1LGLMAXAFT2000, B2LGLMAXAFT2000, B3LGLMAXAFT2000, B4LGLMAXAFT2000, B5LGLMAXAFT2000, B7LGLMAXAFT2000;
numeric B1HGLMINAFT2000, B2HGLMINAFT2000, B3HGLMINAFT2000, B4HGLMINAFT2000, B5HGLMINAFT2000, B7HGLMINAFT2000;
numeric B1HGLMAXAFT2000, B2HGLMAXAFT2000, B3HGLMAXAFT2000, B4HGLMAXAFT2000, B5HGLMAXAFT2000, B7HGLMAXAFT2000;
numeric L1B1gain, L1B2gain, L1B3gain, L1B4gain;
numeric L1B1bias;
numeric L2B1bef75gain, L2B2bef75gain, L2B3bef75gain, L2B4bef75gain;
numeric L2B1bef75bias, L2B2bef75bias, L2B3bef75bias, L2B4bef75bias;
numeric L2B1aft75gain, L2B2aft75gain, L2B3aft75gain, L2B4aft75gain;
numeric L2B1aft75bias, L2B2aft75bias, L2B3aft75bias, L2B4aft75bias;
numeric L2B1aft79gain, L2B2aft79gain, L2B3aft79gain, L2B4aft79gain;
numeric L2B1aft79bias, L2B2aft79bias, L2B3aft79bias, L2B4aft79bias;
numeric L3B1bef78gain, L3B2bef78gain, L3B3bef78gain, L3B4bef78gain;
numeric L3B1bef78bias, L3B2bef78bias, L3B3bef78bias, L3B4bef78bias;
numeric L3B17879gain, L3B27879gain, L3B37879gain, L3B47879gain;
numeric L3B17879bias, L3B27879bias, L3B37879bias, L3B47879bias;
numeric L3B1aft79gain, L3B2aft79gain, L3B3aft79gain, L3B4aft79gain;
numeric L3B1aft79bias, L3B2aft79bias, L3B3aft79bias, L3B4aft79bias;
numeric L4B1bef83gain, L4B2bef83gain, L4B3bef83gain, L4B4bef83gain;
numeric L4B1bef83bias, L4B2bef83bias, L4B3bef83bias, L4B4bef83bias;
numeric L4B1aft83gain, L4B2aft83gain, L4B3aft83gain, L4B4aft83gain;
numeric L4B1aft83bias, L4B2aft83bias, L4B3aft83bias, L4B4aft83bias;
numeric L5B1bef84gain, L5B2bef84gain, L5B3bef84gain, L5B4bef84gain;
numeric L5B1bef84bias, L5B2bef84bias, L5B3bef84bias, L5B4bef84bias;
numeric L5B1aft84gain, L5B2aft84gain, L5B3aft84gain, L5B4aft84gain;
numeric L5B1aft84bias, L5B2aft84bias, L5B3aft84bias, L5B4aft84bias;
numeric biasnewTMb1, biasnewTMb2, biasnewTMb3, biasnewTMb4, biasnewTMb5, biasnewTMb7;
numeric i, j, m, n, o;
numeric ETMlins, ETMcols, TMlins, TMcols, MSSlins, MSScols; # number of lines and columns in input raster set
numeric Scene1Lin, Scene2Lin, Scene3Lin, Scene4Lin; # vertical size of a input raster cell
numeric Scene1Col, Scene2Col, Scene3Col, Scene4Col; # horizontal size of a input raster cell
numeric sensors1, sensors2, sensors3, sensors4; # sensor identification number (Differencing TM and 5 MSS sensor models)
string xmlmain$, xmls1$, xmls2$, xmls3$, xmls4$; # string IDs for main and parameter windows
numeric err, err1, err2, err3, err4; # error numeric variables
numeric ret, ret1, ret2, ret3, ret4; # return numeric variables
numeric createMETA;
numeric earSurCat1, earSurCat2, earSurCat3, earSurCat4; # Earth Surface Categories Identification numers
numeric s1aq, s2aq, s3aq, s4aq; # numeric input for Aquisition Date of the scene
numeric s1ele, s2ele, s3ele, s4ele; # numeric input for sun elevation
numeric s1zenith, s2zenith, s3zenith, s4zenith; # sun zenith
numeric s1zenithSIMPLE, s2zenithSIMPLE, s3zenithSIMPLE, s4zenithSIMPLE;
numeric s1leap, s2leap, s3leap, s4leap;
numeric s1jul, s2jul, s3jul, s4jul; # Julian date
numeric s1year, s2year, s3year, s4year; # Year number extracted from sxaqui
numeric s1month, s2month, s3month, s4month; # Month number extracted from sxaqui
numeric s1day, s2day, s3day, s4day; # Day number extracted from sxaqui
numeric dist1, dist2, dist3, dist4; # Earth Sundistance
numeric pifDarkVAL, pifBrightVAL, minPifVAL, histoTailInputVAL; # numeric input for PIF normalization
numeric sbi1min, sbi1max, sbi1mean, sbi1sd; # numeric values for SBI 1 raster statistics
numeric sbi2min, sbi2max, sbi2mean, sbi2sd; # numeric values for SBI 2 raster statistics
numeric sbi3min, sbi3max, sbi3mean, sbi3sd; # numeric values for SBI 3 raster statistics
numeric sbi4min, sbi4max, sbi4mean, sbi4sd; # numeric values for SBI 4 raster statistics
numeric sbi1spread, sbi2spread, sbi3spread, sbi4spread; # sbi max min differences
numeric slaveMaster = 0; # Master 1=scene1 2=scene2 3=scene3 4=scene4
##############################################
######### Global Constant Declaration ########
##############################################
accumulate[1] = 0; # Norm Year Values
accumulate[2] = 31;
accumulate[3] = 59;
accumulate[4] = 90;
accumulate[5] = 120;
accumulate[6] = 151;
accumulate[7] = 181;
accumulate[8] = 212;
accumulate[9] = 243;
accumulate[10] = 273;
accumulate[11] = 304;
accumulate[12] = 334;
accumulateLY[1] = 0; # Leap Year Values
accumulateLY[2] = 31;
accumulateLY[3] = 60;
accumulateLY[4] = 91;
accumulateLY[5] = 121;
accumulateLY[6] = 152;
accumulateLY[7] = 182;
accumulateLY[8] = 213;
accumulateLY[9] = 244;
accumulateLY[10] = 274;
accumulateLY[11] = 305;
accumulateLY[12] = 335;
biasnewTMb1 = 2.523; #Lifetime Biases for Landsat TM5
biasnewTMb2 = 2.417;
biasnewTMb3 = 1.452;
biasnewTMb4 = 1.854;
biasnewTMb5 = 3.423;
biasnewTMb7 = 2.633;
ESMSS11 = 1844.114888; # ES Values for Landsat MSS1, MSS2, MSS3 - Price 1988
ESMSS12 = 1573.937919;
ESMSS13 = 1288.052988;
ESMSS14 = 901.6370916;
ESMSS41 = 1834.69011; # ES Values for Landsat MSS4 - Price 1988
ESMSS42 = 1595.929068;
ESMSS43 = 1266.061839;
ESMSS44 = 867.0795724;
ESMSS51 = 1834.69011; # ES Values for Landsat MSS5 - Price 1988
ESMSS52 = 1595.929068;
ESMSS53 = 1262.920247;
ESMSS54 = 863.9379797;
ESTM1 = 1959.2; # ES Values for Landsat TM - Fedosejevs 1995
ESTM2 = 1827.4;
ESTM3 = 1550.0;
ESTM4 = 1040.8;
ESTM5 = 220.75;
ESTM7 = 74.960;
ESETM1 = 1969.000; # ES Values for Landsat ETM - User Handbook
ESETM2 = 1840.000;
ESETM3 = 1551.000;
ESETM4 = 1044.000;
ESETM5 = 225.700;
ESETM7 = 82.07;
QCALMAX = 255; # Maximum digital value for Landsat ETM
QCALMIN = 1; # Minimum digital value for Landsat ETM
B1LGLMINBef2000 = -6.2; # LOW GAIN BEFORE 2000 (LMIN)
B2LGLMINBef2000 = -6.0;
B3LGLMINBef2000 = -4.5;
B4LGLMINBef2000 = -4.5;
B5LGLMINBef2000 = -1.0;
B7LGLMINBef2000 = -0.35;
B1LGLMAXBef2000 = 297.5; # LOW GAIN BEFORE 2000 (LMAX)
B2LGLMAXBef2000 = 303.4;
B3LGLMAXBef2000 = 235.5;
B4LGLMAXBef2000 = 235.0;
B5LGLMAXBef2000 = 47.7;
B7LGLMAXBef2000 = 16.6;
B1HGLMINBef2000 = -6.2; #HIGH GAIN BEFORE 2000 (LMIN)
B2HGLMINBef2000 = -6.0;
B3HGLMINBef2000 = -4.5;
B4HGLMINBef2000 = -4.5;
B5HGLMINBef2000 = -1.0;
B7HGLMINBef2000 = -0.35;
B1HGLMAXBef2000 = 194.3; #HIGH GAIN BEFORE 2000 (LMAX)
B2HGLMAXBef2000 = 202.4;
B3HGLMAXBef2000 = 158.6;
B4HGLMAXBef2000 = 157.5;
B5HGLMAXBef2000 = 31.76;
B7HGLMAXBef2000 = 10.932;
B1LGLMINAFT2000 = -6.2; #LOW GAIN AFTER 2000 (LMIN)
B2LGLMINAFT2000 = -6.4;
B3LGLMINAFT2000 = -5.0;
B4LGLMINAFT2000 = -5.1;
B5LGLMINAFT2000 = -1.0;
B7LGLMINAFT2000 = -0.35;
B1LGLMAXAFT2000 = 293.7; #LOW GAIN AFTER 2000 (LMAX)
B2LGLMAXAFT2000 = 300.9;
B3LGLMAXAFT2000 = 234.4;
B4LGLMAXAFT2000 = 241.1;
B5LGLMAXAFT2000 = 47.57;
B7LGLMAXAFT2000 = 16.54;
B1HGLMINAFT2000 = -6.2; #HIGH GAIN AFTER 2000 (LMIN)
B2HGLMINAFT2000 = -6.4;
B3HGLMINAFT2000 = -5.0;
B4HGLMINAFT2000 = -5.1;
B5HGLMINAFT2000 = -1.0;
B7HGLMINAFT2000 = -0.35;
B1HGLMAXAFT2000 = 191.6; #HIGH GAIN AFTER 2000 (LMAX)
B2HGLMAXAFT2000 = 196.5;
B3HGLMAXAFT2000 = 152.9;
B4HGLMAXAFT2000 = 157.4;
B5HGLMAXAFT2000 = 31.06;
B7HGLMAXAFT2000 = 10.80;
L1B1gain = 1.95; # Landsat1 Gain and bias calibration constants
L1B2gain = 1.57;
L1B3gain = 1.39;
L1B4gain = 2.43;
L1B1bias = 0.0;
L2B1bef75gain = 1.57; # Landsat2 Gain and bias calibration constants before 16.Juli7
L2B2bef75gain = 1.17;
L2B3bef75gain = 1.05;
L2B4bef75gain = 2.12;
L2B1bef75bias = 10;
L2B2bef75bias = 7;
L2B3bef75bias = 7;
L2B4bef75bias = 5;
L2B1aft75gain = 2.01; # Landsat2 Gain and bias calibration constants after 16.Juli75
L2B2aft75gain = 1.34;
L2B3aft75gain = 1.15;
L2B4aft75gain = 2.01;
L2B1aft75bias = 8;
L2B2aft75bias = 6;
L2B3aft75bias = 6;
L2B4aft75bias = 4;
L2B1aft79gain = 2.01; # Landsat2 Gain and bias calibration constants after 1.Feb79
L2B2aft79gain = 1.34;
L2B3aft79gain = 1.15;
L2B4aft79gain = 1.01;
L2B1aft79bias = 8;
L2B2aft79bias = 6;
L2B3aft79bias = 6;
L2B4aft79bias = 4;
L3B1bef78gain = 1.70; # Landsat3 Gain and bias calibration constants Before1Jun78
L3B2bef78gain = 1.35;
L3B3bef78gain = 1.12;
L3B4bef78gain = 2.32;
L3B1bef78bias = 4;
L3B2bef78bias = 3;
L3B3bef78bias = 3;
L3B4bef78bias = 1;
L3B17879gain = 2.01; # Landsat3 Gain and bias calibration constants 2Jun78 to 1Feb7
L3B27879gain = 1.39;
L3B37879gain = 1.15;
L3B47879gain = 2.02;
L3B17879bias = 4;
L3B27879bias = 3;
L3B37879bias = 3;
L3B47879bias = 1;
L3B1aft79gain = 2.01; # Landsat3 Gain and bias calibration constants after 1.Feb79
L3B2aft79gain = 1.39;
L3B3aft79gain = 1.15;
L3B4aft79gain = 1.00;
L3B1aft79bias = 4;
L3B2aft79bias = 3;
L3B3aft79bias = 3;
L3B4aft79bias = 1;
L4B1bef83gain = 1.80; # Landsat4 Gain and bias calibration constants Before 1april83
L4B2bef83gain = 1.39;
L4B3bef83gain = 0.99;
L4B4bef83gain = 1.02;
L4B1bef83bias = 2;
L4B2bef83bias = 4;
L4B3bef83bias = 4;
L4B4bef83bias = 3;
L4B1aft83gain = 1.84; # Landsat4 Gain and bias calibration constants after 1 april83
L4B2aft83gain = 1.26;
L4B3aft83gain = 1.08;
L4B4aft83gain = 0.88;
L4B1aft83bias = 4;
L4B2aft83bias = 4;
L4B3aft83bias = 5;
L4B4aft83bias = 4;
L5B1bef84gain = 2.08; # Landsat5 Gain and bias calibration constants before 9 Nov 84
L5B2bef84gain = 1.39;
L5B3bef84gain = 1.22;
L5B4bef84gain = 0.94;
L5B1bef84bias = 3;
L5B2bef84bias = 3;
L5B3bef84bias = 4;
L5B4bef84bias = 4;
L5B1aft84gain = 2.08; # Landsat5 Gain and bias calibration constants after 9 Nov 84
L5B2aft84gain = 1.39;
L5B3aft84gain = 1.13;
L5B4aft84gain = 0.94;
L5B1aft84bias = 3;
L5B2aft84bias = 3;
L5B3aft84bias = 5;
L5B4aft84bias = 4;
#####################################################################
#####################################################################
################ Procedure Definitions ############################
#####################################################################
#####################################################################
#####################################
### Callback procedure to initally disable OK-
### button on main dialog window when it opens
#####################################
proc OnOpenMain () {
dlgmain.SetOkEnabled( 0 );
}
##################################
### Procedure to select SZENE 1
##################################
proc SELECTS1 ()
{
sensors1 = dlgmain.GetCtrlByID( "comps1" ).GetValueNum();
if ( sensors1 == 7 )
{
raster ETM1BAND1, ETM1BAND2, ETM1BAND3, ETM1BAND4, ETM1BAND5, ETM1BAND7; # szene 1 ETM input bands
GetInputRasters(ETM1BAND1, ETM1BAND2, ETM1BAND3, ETM1BAND4, ETM1BAND5, ETM1BAND7);
ETMlins = NumLins(ETM1BAND1);
ETMcols = NumCols(ETM1BAND1);
Scene1Lin = LinScale(ETM1BAND1);
Scene1Col = ColScale(ETM1BAND1);
}
else if ( sensors1 == 6 )
{
raster TM1BAND1, TM1BAND2, TM1BAND3, TM1BAND4, TM1BAND5, TM1BAND7; # szene 1 TM input bands
GetInputRasters(TM1BAND1, TM1BAND2, TM1BAND3, TM1BAND4, TM1BAND5, TM1BAND7);
TMlins = NumLins(TM1BAND1);
TMcols = NumCols(TM1BAND1);
Scene1Lin = LinScale(TM1BAND1);
Scene1Col = ColScale(TM1BAND1);
}
else
{
raster MSS1BAND1, MSS1BAND2, MSS1BAND3, MSS1BAND4; # szene 1 MSS input bands
GetInputRasters(MSS1BAND1, MSS1BAND2, MSS1BAND3, MSS1BAND4);
MSSlins = NumLins(MSS1BAND1);
MSScols = NumCols(MSS1BAND1);
Scene1Lin = LinScale(MSS1BAND1);
Scene1Col = ColScale(MSS1BAND1);
}
}
##################################
### Procedure to select SZENE 2
##################################
proc SELECTS2 ()
{
sensors2 = dlgmain.GetCtrlByID( "comps2" ).GetValueNum();
if ( sensors2 == 7 )
{
raster ETM2BAND1, ETM2BAND2, ETM2BAND3, ETM2BAND4, ETM2BAND5, ETM2BAND7; # szene 2 ETM input bands
GetInputRasters(ETM2BAND1, ETM2BAND2, ETM2BAND3, ETM2BAND4, ETM2BAND5, ETM2BAND7);
Scene2Lin = LinScale(ETM2BAND1);
Scene2Col = ColScale(ETM2BAND1);
if ( ETMlins == 0 )
{
ETMlins = NumLins(ETM2BAND1);
ETMcols = NumCols(ETM2BAND1);
}
}
else if ( sensors2 == 6 )
{
raster TM2BAND1, TM2BAND2, TM2BAND3, TM2BAND4, TM2BAND5, TM2BAND7; # szene 2 TM input bands
GetInputRasters(TM2BAND1, TM2BAND2, TM2BAND3, TM2BAND4, TM2BAND5, TM2BAND7);
Scene2Lin = LinScale(TM2BAND1);
Scene2Col = ColScale(TM2BAND1);
if (TMlins == 0)
{
TMlins = NumLins(TM2BAND1);
TMcols = NumCols(TM2BAND1);
}
}
else
{
raster MSS2BAND1, MSS2BAND2, MSS2BAND3, MSS2BAND4; # szene 2 MSS input bands
GetInputRasters(MSS2BAND1, MSS2BAND2, MSS2BAND3, MSS2BAND4);
Scene2Lin = LinScale(MSS2BAND1);
Scene2Col = ColScale(MSS2BAND1);
if ( MSSlins == 0 )
{
MSSlins = NumLins(MSS2BAND1);
MSScols = NumCols(MSS2BAND1);
}
}
}
##################################
### Procedure to select SZENE 3
##################################
proc SELECTS3 ()
{
sensors3 = dlgmain.GetCtrlByID( "comps3" ).GetValueNum();
if (sensors3 == 7)
{
raster ETM3BAND1, ETM3BAND2, ETM3BAND3, ETM3BAND4, ETM3BAND5, ETM3BAND7; # szene 3 ETM input bands
GetInputRasters(ETM3BAND1, ETM3BAND2, ETM3BAND3, ETM3BAND4, ETM3BAND5, ETM3BAND7);
Scene3Lin = LinScale(ETM3BAND1);
Scene3Col = ColScale(ETM3BAND1);
if (ETMlins == 0)
{
ETMlins = NumLins(ETM3BAND1);
ETMcols = NumCols(ETM3BAND1);
}
}
else if ( sensors3 == 6 )
{
raster TM3BAND1, TM3BAND2, TM3BAND3, TM3BAND4, TM3BAND5, TM3BAND7; # szene 3 TM input bands
GetInputRasters(TM3BAND1, TM3BAND2, TM3BAND3, TM3BAND4, TM3BAND5, TM3BAND7);
Scene3Lin = LinScale(TM3BAND1);
Scene3Col = ColScale(TM3BAND1);
if (TMlins == 0)
{
TMlins = NumLins(TM3BAND1);
TMcols = NumCols(TM3BAND1);
}
}
else
{
raster MSS3BAND1, MSS3BAND2, MSS3BAND3, MSS3BAND4; # szene 3 MSS input bands
GetInputRasters(MSS3BAND1, MSS3BAND2, MSS3BAND3, MSS3BAND4);
Scene3Lin = LinScale(MSS3BAND1);
Scene3Col = ColScale(MSS3BAND1);
if (MSSlins == 0)
{
MSSlins = NumLins(MSS3BAND1);
MSScols = NumCols(MSS3BAND1);
}
}
}
##################################
### Procedure to select SZENE 4
##################################
proc SELECTS4 ()
{
sensors4 = dlgmain.GetCtrlByID( "comps4" ).GetValueNum();
if ( sensors4 == 7 )
{
raster ETM4BAND1, ETM4BAND2, ETM4BAND3, ETM4BAND4, ETM4BAND5, ETM4BAND7; # szene 4 ETM input bands
GetInputRasters(ETM4BAND1, ETM4BAND2, ETM4BAND3, ETM4BAND4, ETM4BAND5, ETM4BAND7);
Scene4Lin = LinScale(ETM4BAND1);
Scene4Col = ColScale(ETM4BAND1);
if ( ETMlins == 0 )
{
ETMlins = NumLins(ETM4BAND1);
ETMcols = NumCols(ETM4BAND1);
}
}
else if ( sensors4 == 6 )
{
raster TM4BAND1, TM4BAND2, TM4BAND3, TM4BAND4, TM4BAND5, TM4BAND7; # szene 4 TM input bands
GetInputRasters(TM4BAND1, TM4BAND2, TM4BAND3, TM4BAND4, TM4BAND5, TM4BAND7);
Scene4Lin = LinScale(TM4BAND1);
Scene4Col = ColScale(TM4BAND1);
if ( TMlins == 0 )
{
TMlins = NumLins(TM4BAND1);
TMcols = NumCols(TM4BAND1);
}
}
else
{
raster MSS4BAND1, MSS4BAND2, MSS4BAND3, MSS4BAND4; # szene 4 MSS input bands
GetInputRasters(MSS4BAND1, MSS4BAND2, MSS4BAND3, MSS4BAND4);
Scene4Lin = LinScale(MSS4BAND1);
Scene4Col = ColScale(MSS4BAND1);
if ( MSSlins == 0 )
{
MSSlins = NumLins(MSS4BAND1);
MSScols = NumCols(MSS4BAND1);
}
}
}
###################################################################################################
###### Procedure to prompt for values for SZENE 1
###################################################################################################
proc SPECS1 () {
if ( sensors1 == 7 )
{
xmls1$ = '
';
err1 = docs1.Parse(xmls1$);
if ( err1 < 0 ) {
PopupError( err1 );
Exit( );
}
nodes1 = docs1.GetElementByID( "dlgs1" );
if ( nodes1 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs1.SetXMLNode( nodes1 );
ret1 = dlgs1.DoModal();
if (ret1 == -1)
{
Exit();
}
earSurCat1 = dlgs1.GetCtrlByID( "esc1" ).GetValueNum();
s1aq = dlgs1.GetCtrlByID("s1aqui").GetValueNum();
s1ele = dlgs1.GetCtrlByID("s1elevation").GetValueNum();
}
else if ( sensors1 == 6 )
{
xmls1$ = '
';
err1 = docs1.Parse(xmls1$);
if ( err1 < 0 ) {
PopupError( err1 ); # pop up an error dialog
Exit( );
}
nodes1 = docs1.GetElementByID( "dlgs1" );
if ( nodes1 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs1.SetXMLNode( nodes1 );
ret1 = dlgs1.DoModal();
if (ret1 == -1)
{
Exit();
}
numeric s1TMg1, s1TMg2, s1TMg3, s1TMg4, s1TMg5, s1TMg7;
numeric s1TMb1, s1TMb2, s1TMb3, s1TMb4, s1TMb5, s1TMb7;
s1aq = dlgs1.GetCtrlByID("s1aqui").GetValueNum();
s1ele = dlgs1.GetCtrlByID("s1elevation").GetValueNum();
s1TMg1 = dlgs1.GetCtrlByID("ss1TMg1").GetValueNum();
s1TMg2 = dlgs1.GetCtrlByID("ss1TMg2").GetValueNum();
s1TMg3 = dlgs1.GetCtrlByID("ss1TMg3").GetValueNum();
s1TMg4 = dlgs1.GetCtrlByID("ss1TMg4").GetValueNum();
s1TMg5 = dlgs1.GetCtrlByID("ss1TMg5").GetValueNum();
s1TMg7 = dlgs1.GetCtrlByID("ss1TMg7").GetValueNum();
s1TMb1 = dlgs1.GetCtrlByID("ss1TMb1").GetValueNum();
s1TMb2 = dlgs1.GetCtrlByID("ss1TMb2").GetValueNum();
s1TMb3 = dlgs1.GetCtrlByID("ss1TMb3").GetValueNum();
s1TMb4 = dlgs1.GetCtrlByID("ss1TMb4").GetValueNum();
s1TMb5 = dlgs1.GetCtrlByID("ss1TMb5").GetValueNum();
s1TMb7 = dlgs1.GetCtrlByID("ss1TMb7").GetValueNum();
}
else if ( sensors1 == 5 )
{
xmls1$ = '
';
err1 = docs1.Parse(xmls1$);
if ( err1 < 0 ) {
PopupError( err1 ); # pop up an error dialog
Exit( );
}
nodes1 = docs1.GetElementByID( "dlgs1" );
if ( nodes1 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs1.SetXMLNode( nodes1 );
ret1 = dlgs1.DoModal();
if (ret1 == -1)
{
Exit();
}
s1aq = dlgs1.GetCtrlByID("s1aqui").GetValueNum();
s1ele = dlgs1.GetCtrlByID("s1elevation").GetValueNum();
}
else if ( sensors1 == 4 )
{
xmls1$ = '
';
err1 = docs1.Parse(xmls1$);
if ( err1 < 0 ) {
PopupError( err1 );
Exit( );
}
nodes1 = docs1.GetElementByID( "dlgs1" );
if ( nodes1 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs1.SetXMLNode( nodes1 );
ret1 = dlgs1.DoModal();
if (ret1 == -1)
{
Exit();
}
s1aq = dlgs1.GetCtrlByID("s1aqui").GetValueNum();
s1ele = dlgs1.GetCtrlByID("s1elevation").GetValueNum();
}
else if ( sensors1 == 3 )
{
xmls1$ = '
';
err1 = docs1.Parse(xmls1$);
if ( err1 < 0 ) {
PopupError( err1 ); # pop up an error dialog
Exit( );
}
nodes1 = docs1.GetElementByID( "dlgs1" );
if ( nodes1 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs1.SetXMLNode( nodes1 );
ret1 = dlgs1.DoModal();
if (ret1 == -1)
{
Exit();
}
s1aq = dlgs1.GetCtrlByID("s1aqui").GetValueNum();
s1ele = dlgs1.GetCtrlByID("s1elevation").GetValueNum();
}
else if ( sensors1 == 2 )
{
xmls1$ = '
';
err = docs1.Parse(xmls1$);
if ( err1 < 0 ) {
PopupError( err1 ); # pop up an error dialog
Exit( );
}
nodes1 = docs1.GetElementByID( "dlgs1" );
if ( nodes1 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs1.SetXMLNode( nodes1 );
ret1 = dlgs1.DoModal();
if (ret1 == -1)
{
Exit();
}
s1aq = dlgs1.GetCtrlByID("s1aqui").GetValueNum();
s1ele = dlgs1.GetCtrlByID("s1elevation").GetValueNum();
}
else if ( sensors1 == 1 )
{
xmls1$ = '
';
err1 = docs1.Parse(xmls1$);
if ( err1 < 0 ) {
PopupError( err1 ); # pop up an error dialog
Exit( );
}
nodes1 = docs1.GetElementByID( "dlgs1" );
if ( nodes1 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs1.SetXMLNode( nodes1 );
ret1 = dlgs1.DoModal();
if (ret1 == -1)
{
Exit();
}
s1aq = dlgs1.GetCtrlByID("s1aqui").GetValueNum();
s1ele = dlgs1.GetCtrlByID("s1elevation").GetValueNum();
}
}
###################################################################################################
###### Procedure to prompt for values for SZENE 2
###################################################################################################
proc SPECS2 () {
if ( sensors2 == 7 )
{
xmls2$ = '
';
err2 = docs2.Parse(xmls2$);
if ( err2 < 0 ) {
PopupError( err2 );
Exit( );
}
nodes2 = docs2.GetElementByID( "dlgs2" );
if ( nodes2 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs2.SetXMLNode( nodes2 );
ret2 = dlgs2.DoModal();
if (ret2 == -1)
{
Exit();
}
earSurCat2 = dlgs2.GetCtrlByID( "esc2" ).GetValueNum();
s2aq = dlgs2.GetCtrlByID("s2aqui").GetValueNum();
s2ele = dlgs2.GetCtrlByID("s2elevation").GetValueNum();
}
else if ( sensors2 == 6 )
{
xmls2$ = '
';
err2 = docs2.Parse(xmls2$);
if ( err2 < 0 ) {
PopupError( err2 );
Exit( );
}
nodes2 = docs2.GetElementByID( "dlgs2" );
if ( nodes2 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs2.SetXMLNode( nodes2 );
ret2 = dlgs2.DoModal();
if (ret2 == -1)
{
Exit();
}
numeric s2TMg1, s2TMg2, s2TMg3, s2TMg4, s2TMg5, s2TMg7;
numeric s2TMb1, s2TMb2, s2TMb3, s2TMb4, s2TMb5, s2TMb7;
s2aq = dlgs2.GetCtrlByID("s2aqui").GetValueNum();
s2ele = dlgs2.GetCtrlByID("s2elevation").GetValueNum();
s2TMg1 = dlgs2.GetCtrlByID("ss2TMg1").GetValueNum();
s2TMg2 = dlgs2.GetCtrlByID("ss2TMg2").GetValueNum();
s2TMg3 = dlgs2.GetCtrlByID("ss2TMg3").GetValueNum();
s2TMg4 = dlgs2.GetCtrlByID("ss2TMg4").GetValueNum();
s2TMg5 = dlgs2.GetCtrlByID("ss2TMg5").GetValueNum();
s2TMg7 = dlgs2.GetCtrlByID("ss2TMg7").GetValueNum();
s2TMb1 = dlgs2.GetCtrlByID("ss2TMb1").GetValueNum();
s2TMb2 = dlgs2.GetCtrlByID("ss2TMb2").GetValueNum();
s2TMb3 = dlgs2.GetCtrlByID("ss2TMb3").GetValueNum();
s2TMb4 = dlgs2.GetCtrlByID("ss2TMb4").GetValueNum();
s2TMb5 = dlgs2.GetCtrlByID("ss2TMb5").GetValueNum();
s2TMb7 = dlgs2.GetCtrlByID("ss2TMb7").GetValueNum();
}
else if ( sensors2 == 5 )
{
xmls2$ = '
';
err2 = docs2.Parse(xmls2$);
if ( err2 < 0 ) {
PopupError( err2 );
Exit( );
}
nodes2 = docs2.GetElementByID( "dlgs2" );
if ( nodes2 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs2.SetXMLNode( nodes2 );
ret2 = dlgs2.DoModal();
if (ret2 == -1)
{
Exit();
}
s2aq = dlgs2.GetCtrlByID("s2aqui").GetValueNum();
s2ele = dlgs2.GetCtrlByID("s2elevation").GetValueNum();
}
else if ( sensors2 == 4 )
{
xmls2$ = '
';
err2 = docs2.Parse(xmls2$);
if ( err2 < 0 ) {
PopupError( err2 );
Exit( );
}
nodes2 = docs2.GetElementByID( "dlgs2" );
if ( nodes2 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs2.SetXMLNode( nodes2 );
ret2 = dlgs2.DoModal();
if (ret2 == -1)
{
Exit();
}
s2aq = dlgs2.GetCtrlByID("s2aqui").GetValueNum();
s2ele = dlgs2.GetCtrlByID("s2elevation").GetValueNum();
}
else if ( sensors2 == 3 )
{
xmls2$ = '
';
err2 = docs2.Parse(xmls2$);
if ( err2 < 0 ) {
PopupError( err2 );
Exit( );
}
nodes2 = docs2.GetElementByID( "dlgs2" );
if ( nodes2 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs2.SetXMLNode( nodes2 );
ret2 = dlgs2.DoModal();
if (ret2 == -1)
{
Exit();
}
s2aq = dlgs2.GetCtrlByID("s2aqui").GetValueNum();
s2ele = dlgs2.GetCtrlByID("s2elevation").GetValueNum();
}
else if ( sensors2 == 2 )
{
xmls2$ = '
';
err2 = docs2.Parse(xmls2$);
if ( err2 < 0 ) {
PopupError( err );
Exit( );
}
nodes2 = docs2.GetElementByID( "dlgs2" );
if ( nodes2 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs2.SetXMLNode( nodes2 );
ret2 = dlgs2.DoModal();
if (ret2 == -1)
{
Exit();
}
s2aq = dlgs2.GetCtrlByID("s2aqui").GetValueNum();
s2ele = dlgs2.GetCtrlByID("s2elevation").GetValueNum();
}
else if ( sensors2 == 1 )
{
xmls2$ = '
';
err2 = docs2.Parse(xmls2$);
if ( err2 < 0 ) {
PopupError( err2 ); # pop up an error dialog
Exit( );
}
nodes2 = docs2.GetElementByID( "dlgs2" );
if ( nodes2 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs2.SetXMLNode( nodes2 );
ret2 = dlgs2.DoModal();
if (ret2 == -1)
{
Exit();
}
s2aq = dlgs2.GetCtrlByID("s2aqui").GetValueNum();
s2ele = dlgs2.GetCtrlByID("s2elevation").GetValueNum();
}
}
###################################################################################################
###### Procedure to prompt for values for SZENE 3
###################################################################################################
proc SPECS3 () {
if ( sensors3 == 7 )
{
xmls3$ = '
';
err3 = docs3.Parse(xmls3$);
if ( err3 < 0 ) {
PopupError( err3 );
Exit( );
}
nodes3 = docs3.GetElementByID( "dlgs3" );
if ( nodes3 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs3.SetXMLNode( nodes3 );
ret3 = dlgs3.DoModal();
if (ret3 == -1)
{
Exit();
}
earSurCat3 = dlgs3.GetCtrlByID( "esc3" ).GetValueNum();
s3aq = dlgs3.GetCtrlByID("s3aqui").GetValueNum();
s3ele = dlgs3.GetCtrlByID("s3elevation").GetValueNum();
}
else if ( sensors3 == 6 )
{
xmls3$ = '
';
err3 = docs3.Parse(xmls3$);
if ( err3 < 0 ) {
PopupError( err3 );
Exit( );
}
nodes3 = docs3.GetElementByID( "dlgs3" );
if ( nodes3 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs3.SetXMLNode( nodes3 );
ret3 = dlgs3.DoModal();
if (ret3 == -1)
{
Exit();
}
numeric s3TMg1, s3TMg2, s3TMg3, s3TMg4, s3TMg5, s3TMg7;
numeric s3TMb1, s3TMb2, s3TMb3, s3TMb4, s3TMb5, s3TMb7;
s3aq = dlgs3.GetCtrlByID("s3aqui").GetValueNum();
s3ele = dlgs3.GetCtrlByID("s3elevation").GetValueNum();
s3TMg1 = dlgs3.GetCtrlByID("ss3TMg1").GetValueNum();
s3TMg2 = dlgs3.GetCtrlByID("ss3TMg2").GetValueNum();
s3TMg3 = dlgs3.GetCtrlByID("ss3TMg3").GetValueNum();
s3TMg4 = dlgs3.GetCtrlByID("ss3TMg4").GetValueNum();
s3TMg5 = dlgs3.GetCtrlByID("ss3TMg5").GetValueNum();
s3TMg7 = dlgs3.GetCtrlByID("ss3TMg7").GetValueNum();
s3TMb1 = dlgs3.GetCtrlByID("ss3TMb1").GetValueNum();
s3TMb2 = dlgs3.GetCtrlByID("ss3TMb2").GetValueNum();
s3TMb3 = dlgs3.GetCtrlByID("ss3TMb3").GetValueNum();
s3TMb4 = dlgs3.GetCtrlByID("ss3TMb4").GetValueNum();
s3TMb5 = dlgs3.GetCtrlByID("ss3TMb5").GetValueNum();
s3TMb7 = dlgs3.GetCtrlByID("ss3TMb7").GetValueNum();
}
else if ( sensors3 == 5 )
{
xmls3$ = '
';
err3 = docs3.Parse(xmls3$);
if ( err3 < 0 ) {
PopupError( err3 );
Exit( );
}
nodes3 = docs3.GetElementByID( "dlgs3" );
if ( nodes3 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs3.SetXMLNode( nodes3 );
ret3 = dlgs3.DoModal();
if (ret3 == -1)
{
Exit();
}
s3aq = dlgs3.GetCtrlByID("s3aqui").GetValueNum();
s3ele = dlgs3.GetCtrlByID("s3elevation").GetValueNum();
}
else if ( sensors3 == 4 )
{
xmls3$ = '
';
err3 = docs3.Parse(xmls3$);
if ( err3 < 0 ) {
PopupError( err3 );
Exit( );
}
nodes3 = docs3.GetElementByID( "dlgs3" );
if ( nodes3 == 0 ) {
PopupMessage( "Could not find dialognode in XML document" );
Exit();
}
dlgs3.SetXMLNode( nodes3 );
ret3 = dlgs3.DoModal();
if (ret3 == -1)
{
Exit();
}
s3aq = dlgs3.GetCtrlByID("s3aqui").GetValueNum();
s3ele = dlgs3.GetCtrlByID("s3elevation").GetValueNum();
}
else if ( sensors3 == 3 )
{
xmls3$ = '
';
err3 = docs3.Parse(xmls3$);
if ( err3 < 0 ) {
PopupError( err3 );
Exit( );
}
nodes3 = docs3.GetElementByID( "dlgs3" );
if ( nodes3 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs3.SetXMLNode( nodes3 );
ret3 = dlgs3.DoModal();
if (ret3 == -1)
{
Exit();
}
s3aq = dlgs3.GetCtrlByID("s3aqui").GetValueNum();
s3ele = dlgs3.GetCtrlByID("s3elevation").GetValueNum();
}
else if ( sensors3 == 2 )
{
xmls3$ = '
';
err3 = docs3.Parse(xmls3$);
if ( err3 < 0 ) {
PopupError( err3 );
Exit( );
}
nodes3 = docs3.GetElementByID( "dlgs3" );
if ( nodes3 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs3.SetXMLNode( nodes3 );
ret3 = dlgs3.DoModal();
if (ret3 == -1)
{
Exit();
}
s3aq = dlgs3.GetCtrlByID("s3aqui").GetValueNum();
s3ele = dlgs3.GetCtrlByID("s3elevation").GetValueNum();
}
else if ( sensors3 == 1 )
{
xmls3$ = '
';
err3 = docs3.Parse(xmls3$);
if ( err3 < 0 ) {
PopupError( err3 );
Exit( );
}
nodes3 = docs3.GetElementByID( "dlgs3" );
if ( nodes3 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs3.SetXMLNode( nodes3 );
ret3 = dlgs3.DoModal();
if (ret3 == -1)
{
Exit();
}
s3aq = dlgs3.GetCtrlByID("s3aqui").GetValueNum();
s3ele = dlgs3.GetCtrlByID("s3elevation").GetValueNum();
}
}
###################################################################################################
##### Procedure to prompt for values for SZENE 4
###################################################################################################
proc SPECS4 () {
if ( sensors4 == 7 )
{
xmls4$ = '
';
err4 = docs4.Parse(xmls4$);
if ( err4 < 0 ) {
PopupError( err4 );
Exit( );
}
nodes4 = docs4.GetElementByID( "dlgs4" );
if ( nodes4 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs4.SetXMLNode( nodes4 );
ret4 = dlgs4.DoModal();
if (ret4 == -1)
{
Exit();
}
earSurCat4 = dlgs4.GetCtrlByID( "esc4" ).GetValueNum();
s4aq = dlgs4.GetCtrlByID("s4aqui").GetValueNum();
s4ele = dlgs4.GetCtrlByID("s4elevation").GetValueNum();
dlgmain.GetCtrlByID("rasrefdoss1").SetEnabled(1);
}
else if ( sensors4 == 6 )
{
xmls4$ = '
';
err4 = docs4.Parse(xmls4$);
if ( err4 < 0 ) {
PopupError( err4 );
Exit( );
}
nodes4 = docs4.GetElementByID( "dlgs4" );
if ( nodes4 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs4.SetXMLNode( nodes4 );
ret4 = dlgs4.DoModal();
if (ret4 == -1)
{
Exit();
}
numeric s4TMg1, s4TMg2, s4TMg3, s4TMg4, s4TMg5, s4TMg7;
numeric s4TMb1, s4TMb2, s4TMb3, s4TMb4, s4TMb5, s4TMb7;
s4aq = dlgs4.GetCtrlByID("s4aqui").GetValueNum();
s4ele = dlgs4.GetCtrlByID("s4elevation").GetValueNum();
s4TMg1 = dlgs4.GetCtrlByID("ss4TMg1").GetValueNum();
s4TMg2 = dlgs4.GetCtrlByID("ss4TMg2").GetValueNum();
s4TMg3 = dlgs4.GetCtrlByID("ss4TMg3").GetValueNum();
s4TMg4 = dlgs4.GetCtrlByID("ss4TMg4").GetValueNum();
s4TMg5 = dlgs4.GetCtrlByID("ss4TMg5").GetValueNum();
s4TMg7 = dlgs4.GetCtrlByID("ss4TMg7").GetValueNum();
s4TMb1 = dlgs4.GetCtrlByID("ss4TMb1").GetValueNum();
s4TMb2 = dlgs4.GetCtrlByID("ss4TMb2").GetValueNum();
s4TMb3 = dlgs4.GetCtrlByID("ss4TMb3").GetValueNum();
s4TMb4 = dlgs4.GetCtrlByID("ss4TMb4").GetValueNum();
s4TMb5 = dlgs4.GetCtrlByID("ss4TMb5").GetValueNum();
s4TMb7 = dlgs4.GetCtrlByID("ss4TMb7").GetValueNum();
dlgmain.GetCtrlByID("rasrefdoss1").SetEnabled(1);
}
else if ( sensors4 == 5 )
{
xmls4$ = '
';
err4 = docs4.Parse(xmls4$);
if ( err4 < 0 ) {
PopupError( err4 ); # pop up an error dialog
Exit( );
}
nodes4 = docs4.GetElementByID( "dlgs4" );
if ( nodes4 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs4.SetXMLNode( nodes4 );
ret4 = dlgs4.DoModal();
if (ret4 == -1)
{
Exit();
}
s4aq = dlgs4.GetCtrlByID("s4aqui").GetValueNum();
s4ele = dlgs4.GetCtrlByID("s4elevation").GetValueNum();
dlgmain.GetCtrlByID("rasrefdoss1").SetEnabled(1);
}
else if ( sensors4 == 4 )
{
xmls4$ = '
';
err4 = docs4.Parse(xmls4$);
if ( err4 < 0 ) {
PopupError( err4 ); # pop up an error dialog
Exit( );
}
nodes4 = docs4.GetElementByID( "dlgs4" );
if ( nodes4 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs4.SetXMLNode( nodes4 );
ret4 = dlgs4.DoModal();
if (ret4 == -1)
{
Exit();
}
s4aq = dlgs4.GetCtrlByID("s4aqui").GetValueNum();
s4ele = dlgs4.GetCtrlByID("s4elevation").GetValueNum();
dlgmain.GetCtrlByID("rasrefdoss1").SetEnabled(1);
}
else if ( sensors4 == 3 )
{
xmls4$ = '
';
err4 = docs4.Parse(xmls4$);
if ( err4 < 0 ) {
PopupError( err4 ); # pop up an error dialog
Exit( );
}
nodes4 = docs4.GetElementByID( "dlgs4" );
if ( nodes4 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs4.SetXMLNode( nodes4 );
ret4 = dlgs4.DoModal();
if (ret4 == -1)
{
Exit();
}
s4aq = dlgs4.GetCtrlByID("s4aqui").GetValueNum();
s4ele = dlgs4.GetCtrlByID("s4elevation").GetValueNum();
dlgmain.GetCtrlByID("rasrefdoss1").SetEnabled(1);
}
else if ( sensors4 == 2 )
{
xmls4$ = '
';
err4 = docs4.Parse(xmls4$);
if ( err4 < 0 ) {
PopupError( err4 ); # pop up an error dialog
Exit( );
}
nodes4 = docs4.GetElementByID( "dlgs4" );
if ( nodes4 ==0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs4.SetXMLNode( nodes4 );
ret4 = dlgs4.DoModal();
if (ret4 == -1)
{
Exit();
}
s4aq = dlgs4.GetCtrlByID("s4aqui").GetValueNum();
s4ele = dlgs4.GetCtrlByID("s4elevation").GetValueNum();
dlgmain.GetCtrlByID("rasrefdoss1").SetEnabled(1);
}
else if ( sensors4 == 1 )
{
xmls4$ = '
';
err4 = docs4.Parse(xmls4$);
if ( err4 < 0 ) {
PopupError( err4 );
Exit( );
}
nodes4 = docs4.GetElementByID( "dlgs4" );
if ( nodes4 == 0 ) {
PopupMessage( "Could not find dialog node in XML document" );
Exit();
}
dlgs4.SetXMLNode( nodes4 );
ret4 = dlgs4.DoModal();
if (ret4 == -1)
{
Exit();
}
s4aq = dlgs4.GetCtrlByID("s4aqui").GetValueNum();
s4ele = dlgs4.GetCtrlByID("s4elevation").GetValueNum();
dlgmain.GetCtrlByID("rasrefdoss1").SetEnabled(1);
}
}
#######################################
### Procedure to select reflectance output files SZENE 1 DOS 1 corrected
#######################################
proc OUTREFDOSS1()
{
if ( sensors1 == 7 )
{
raster REFS1ETM1, REFS1ETM2, REFS1ETM3, REFS1ETM4, REFS1ETM5, REFS1ETM7;
GetOutputRaster(REFS1ETM1, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND1, REFS1ETM1, "georef");
GetOutputRaster(REFS1ETM2, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND2, REFS1ETM2, "georef");
GetOutputRaster(REFS1ETM3, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND3, REFS1ETM3, "georef");
GetOutputRaster(REFS1ETM4, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND4, REFS1ETM4, "georef");
GetOutputRaster(REFS1ETM5, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND5, REFS1ETM5, "georef");
GetOutputRaster(REFS1ETM7, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND7, REFS1ETM7, "georef");
dlgmain.GetCtrlByID("rasrefdoss2").SetEnabled(1);
}
else if ( sensors1 == 6 )
{
raster REFS1TM1, REFS1TM2, REFS1TM3, REFS1TM4, REFS1TM5, REFS1TM7;
GetOutputRaster(REFS1TM1, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND1, REFS1TM1, "georef");
GetOutputRaster(REFS1TM2, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND2, REFS1TM2, "georef");
GetOutputRaster(REFS1TM3, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND3, REFS1TM3, "georef");
GetOutputRaster(REFS1TM4, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND4, REFS1TM4, "georef");
GetOutputRaster(REFS1TM5, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND5, REFS1TM5, "georef");
GetOutputRaster(REFS1TM7, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND7, REFS1TM7, "georef");
dlgmain.GetCtrlByID("rasrefdoss2").SetEnabled(1);
}
else
{
raster REFS1MSS1, REFS1MSS2, REFS1MSS3, REFS1MSS4;
GetOutputRaster(REFS1MSS1, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS1BAND1, REFS1MSS1, "georef");
GetOutputRaster(REFS1MSS2, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS1BAND2, REFS1MSS2, "georef");
GetOutputRaster(REFS1MSS3, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS1BAND3, REFS1MSS3, "georef");
GetOutputRaster(REFS1MSS4, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS1BAND4, REFS1MSS4, "georef");
dlgmain.GetCtrlByID("rasrefdoss2").SetEnabled(1);
}
}
#######################################
### Procedure to select reflectance output files SZENE 2 DOS 1 corrected
#######################################
proc OUTREFDOSS2()
{
if ( sensors2 == 7 )
{
raster REFS2ETM1, REFS2ETM2, REFS2ETM3, REFS2ETM4, REFS2ETM5, REFS2ETM7;
GetOutputRaster(REFS2ETM1, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND1, REFS2ETM1, "georef");
GetOutputRaster(REFS2ETM2, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND2, REFS2ETM2, "georef");
GetOutputRaster(REFS2ETM3, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND3, REFS2ETM3, "georef");
GetOutputRaster(REFS2ETM4, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND4, REFS2ETM4, "georef");
GetOutputRaster(REFS2ETM5, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND5, REFS2ETM5, "georef");
GetOutputRaster(REFS2ETM7, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND7, REFS2ETM7, "georef");
dlgmain.GetCtrlByID("rasrefdoss3").SetEnabled(1);
}
else if ( sensors2 == 6 )
{
raster REFS2TM1, REFS2TM2, REFS2TM3, REFS2TM4, REFS2TM5, REFS2TM7;
GetOutputRaster(REFS2TM1, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND1, REFS2TM1, "georef");
GetOutputRaster(REFS2TM2, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND2, REFS2TM2, "georef");
GetOutputRaster(REFS2TM3, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND3, REFS2TM3, "georef");
GetOutputRaster(REFS2TM4, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND4, REFS2TM4, "georef");
GetOutputRaster(REFS2TM5, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND5, REFS2TM5, "georef");
GetOutputRaster(REFS2TM7, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND7, REFS2TM7, "georef");
dlgmain.GetCtrlByID("rasrefdoss3").SetEnabled(1);
}
else
{
raster REFS2MSS1, REFS2MSS2, REFS2MSS3, REFS2MSS4;
GetOutputRaster(REFS2MSS1, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS2BAND1, REFS2MSS1, "georef");
GetOutputRaster(REFS2MSS2, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS2BAND2, REFS2MSS2, "georef");
GetOutputRaster(REFS2MSS3, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS2BAND3, REFS2MSS3, "georef");
GetOutputRaster(REFS2MSS4, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS2BAND4, REFS2MSS4, "georef");
dlgmain.GetCtrlByID("rasrefdoss3").SetEnabled(1);
}
}
#######################################
### Procedure to select reflectance output files SZENE 3 DOS 1 corrected
#######################################
proc OUTREFDOSS3()
{
if ( sensors3 == 7 )
{
raster REFS3ETM1, REFS3ETM2, REFS3ETM3, REFS3ETM4, REFS3ETM5, REFS3ETM7;
GetOutputRaster(REFS3ETM1, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND1, REFS3ETM1, "georef");
GetOutputRaster(REFS3ETM2, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND2, REFS3ETM2, "georef");
GetOutputRaster(REFS3ETM3, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND3, REFS3ETM3, "georef");
GetOutputRaster(REFS3ETM4, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND4, REFS3ETM4, "georef");
GetOutputRaster(REFS3ETM5, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND5, REFS3ETM5, "georef");
GetOutputRaster(REFS3ETM7, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND7, REFS3ETM7, "georef");
dlgmain.GetCtrlByID("rasrefdoss4").SetEnabled(1);
}
else if ( sensors3 == 6 )
{
raster REFS3TM1, REFS3TM2, REFS3TM3, REFS3TM4, REFS3TM5, REFS3TM7;
GetOutputRaster(REFS3TM1, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND1, REFS3TM1, "georef");
GetOutputRaster(REFS3TM2, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND2, REFS3TM2, "georef");
GetOutputRaster(REFS3TM3, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND3, REFS3TM3, "georef");
GetOutputRaster(REFS3TM4, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND4, REFS3TM4, "georef");
GetOutputRaster(REFS3TM5, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND5, REFS3TM5, "georef");
GetOutputRaster(REFS3TM7, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND7, REFS3TM7, "georef");
dlgmain.GetCtrlByID("rasrefdoss4").SetEnabled(1);
}
else
{
raster REFS3MSS1, REFS3MSS2, REFS3MSS3, REFS3MSS4;
GetOutputRaster(REFS3MSS1, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS3BAND1, REFS3MSS1, "georef");
GetOutputRaster(REFS3MSS2, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS3BAND2, REFS3MSS2, "georef");
GetOutputRaster(REFS3MSS3, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS3BAND3, REFS3MSS3, "georef");
GetOutputRaster(REFS3MSS4, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS3BAND4, REFS3MSS4, "georef");
dlgmain.GetCtrlByID("rasrefdoss4").SetEnabled(1);
}
}
#######################################
### Procedure to select reflectance output files SZENE 4 DOS 1 corrected
#######################################
proc OUTREFDOSS4()
{
if ( sensors4 == 7 )
{
raster REFS4ETM1, REFS4ETM2, REFS4ETM3, REFS4ETM4, REFS4ETM5, REFS4ETM7;
GetOutputRaster(REFS4ETM1, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND1, REFS4ETM1, "georef");
GetOutputRaster(REFS4ETM2, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND2, REFS4ETM2, "georef");
GetOutputRaster(REFS4ETM3, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND3, REFS4ETM3, "georef");
GetOutputRaster(REFS4ETM4, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND4, REFS4ETM4, "georef");
GetOutputRaster(REFS4ETM5, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND5, REFS4ETM5, "georef");
GetOutputRaster(REFS4ETM7, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND7, REFS4ETM7, "georef");
dlgmain.GetCtrlByID("raspifglob").SetEnabled(1);
}
else if ( sensors4 == 6 )
{
raster REFS4TM1, REFS4TM2, REFS4TM3, REFS4TM4, REFS4TM5, REFS4TM7;
GetOutputRaster(REFS4TM1, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND1, REFS4TM1, "georef");
GetOutputRaster(REFS4TM2, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND2, REFS4TM2, "georef");
GetOutputRaster(REFS4TM3, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND3, REFS4TM3, "georef");
GetOutputRaster(REFS4TM4, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND4, REFS4TM4, "georef");
GetOutputRaster(REFS4TM5, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND5, REFS4TM5, "georef");
GetOutputRaster(REFS4TM7, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND7, REFS4TM7, "georef");
dlgmain.GetCtrlByID("raspifglob").SetEnabled(1);
}
else
{
raster REFS4MSS1, REFS4MSS2, REFS4MSS3, REFS4MSS4;
GetOutputRaster(REFS4MSS1, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS4BAND1, REFS4MSS1, "georef");
GetOutputRaster(REFS4MSS2, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS4BAND2, REFS4MSS2, "georef");
GetOutputRaster(REFS4MSS3, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS4BAND3, REFS4MSS3, "georef");
GetOutputRaster(REFS4MSS4, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS4BAND4, REFS4MSS4, "georef");
dlgmain.GetCtrlByID("raspifglob").SetEnabled(1);
}
}
#######################################
### Procedure to select PIF output masks
#######################################
proc OUTCOMPIFS1()
{
if ( sensors1 == 7 )
{
raster PIFMASK, PIFdarkMASK, PIFbrightMASK;
GetOutputRaster(PIFMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM1BAND1, PIFMASK, "georef");
GetOutputRaster(PIFdarkMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM1BAND1, PIFdarkMASK, "georef");
GetOutputRaster(PIFbrightMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM1BAND1, PIFbrightMASK, "georef");
dlgmain.GetCtrlByID("raspifs1").SetEnabled(1);
}
else if ( sensors1 == 6 )
{
raster PIFMASK, PIFdarkMASK, PIFbrightMASK;
GetOutputRaster(PIFMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM1BAND1, PIFMASK, "georef");
GetOutputRaster(PIFdarkMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM1BAND1, PIFdarkMASK, "georef");
GetOutputRaster(PIFbrightMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM1BAND1, PIFbrightMASK, "georef");
dlgmain.GetCtrlByID("raspifs1").SetEnabled(1);
}
else
{
raster PIFMASK, PIFdarkMASK, PIFbrightMASK;
GetOutputRaster(PIFMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS1BAND1, PIFMASK, "georef");
GetOutputRaster(PIFdarkMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS1BAND1, PIFdarkMASK, "georef");
GetOutputRaster(PIFbrightMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS1BAND1, PIFbrightMASK, "georef");
dlgmain.GetCtrlByID("raspifs1").SetEnabled(1);
}
}
proc OUTPIFS1()
{
if ( sensors1 == 7 )
{
raster S1MASK, S1darkMASK, S1brightMASK;
GetOutputRaster(S1MASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM1BAND1, S1MASK, "georef");
GetOutputRaster(S1darkMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM1BAND1, S1darkMASK, "georef");
GetOutputRaster(S1brightMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM1BAND1, S1brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs2").SetEnabled(1);
}
else if ( sensors1 == 6 )
{
raster S1MASK, S1darkMASK, S1brightMASK;
GetOutputRaster(S1MASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM1BAND1, S1MASK, "georef");
GetOutputRaster(S1darkMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM1BAND1, S1darkMASK, "georef");
GetOutputRaster(S1brightMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM1BAND1, S1brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs2").SetEnabled(1);
}
else
{
raster S1MASK, S1darkMASK, S1brightMASK;
GetOutputRaster(S1MASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS1BAND1, S1MASK, "georef");
GetOutputRaster(S1darkMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS1BAND1, S1darkMASK, "georef");
GetOutputRaster(S1brightMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS1BAND1, S1brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs2").SetEnabled(1);
}
}
proc OUTPIFS2()
{
if ( sensors2 == 7 )
{
raster S2MASK, S2darkMASK, S2brightMASK;
GetOutputRaster(S2MASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM2BAND1, S2MASK, "georef");
GetOutputRaster(S2darkMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM2BAND1, S2darkMASK, "georef");
GetOutputRaster(S2brightMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM2BAND1, S2brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs3").SetEnabled(1);
}
else if ( sensors2 == 6 )
{
raster S2MASK, S2darkMASK, S2brightMASK;
GetOutputRaster(S2MASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM2BAND1, S2MASK, "georef");
GetOutputRaster(S2darkMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM2BAND1, S2darkMASK, "georef");
GetOutputRaster(S2brightMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM2BAND1, S2brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs3").SetEnabled(1);
}
else
{
raster S2MASK, S2darkMASK, S2brightMASK;
GetOutputRaster(S2MASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS2BAND1, S2MASK, "georef");
GetOutputRaster(S2darkMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS2BAND1, S2darkMASK, "georef");
GetOutputRaster(S2brightMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS2BAND1, S2brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs3").SetEnabled(1);
}
}
proc OUTPIFS3()
{
if ( sensors3 == 7 )
{
raster S3MASK, S3darkMASK, S3brightMASK;
GetOutputRaster(S3MASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM3BAND1, S3MASK, "georef");
GetOutputRaster(S3darkMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM3BAND1, S3darkMASK, "georef");
GetOutputRaster(S3brightMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM3BAND1, S3brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs4").SetEnabled(1);
}
else if ( sensors3 == 6 )
{
raster S3MASK, S3darkMASK, S3brightMASK;
GetOutputRaster(S3MASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM3BAND1, S3MASK, "georef");
GetOutputRaster(S3darkMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM3BAND1, S3darkMASK, "georef");
GetOutputRaster(S3brightMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM3BAND1, S3brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs4").SetEnabled(1);
}
else
{
raster S3MASK, S3darkMASK, S3brightMASK;
GetOutputRaster(S3MASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS3BAND1, S3MASK, "georef");
GetOutputRaster(S3darkMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS3BAND1, S3darkMASK, "georef");
GetOutputRaster(S3brightMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS3BAND1, S3brightMASK, "georef");
dlgmain.GetCtrlByID("raspifs4").SetEnabled(1);
}
}
proc OUTPIFS4()
{
if ( sensors4 == 7 )
{
raster S4MASK, S4darkMASK, S4brightMASK;
GetOutputRaster(S4MASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM4BAND1, S4MASK, "georef");
GetOutputRaster(S4darkMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM4BAND1, S4darkMASK, "georef");
GetOutputRaster(S4brightMASK, ETMlins, ETMcols, "8-bit unsigned");
CopySubobjects(ETM4BAND1, S4brightMASK, "georef");
dlgmain.GetCtrlByID("rasnorms1").SetEnabled(1);
}
else if ( sensors4 == 6 )
{
raster S4MASK, S4darkMASK, S4brightMASK;
GetOutputRaster(S4MASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM4BAND1, S4MASK, "georef");
GetOutputRaster(S4darkMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM4BAND1, S4darkMASK, "georef");
GetOutputRaster(S4brightMASK, TMlins, TMcols, "8-bit unsigned");
CopySubobjects(TM4BAND1, S4brightMASK, "georef");
dlgmain.GetCtrlByID("rasnorms1").SetEnabled(1);
}
else
{
raster S4MASK, S4darkMASK, S4brightMASK;
GetOutputRaster(S4MASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS4BAND1, S4MASK, "georef");
GetOutputRaster(S4darkMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS4BAND1, S4darkMASK, "georef");
GetOutputRaster(S4brightMASK, MSSlins, MSScols, "8-bit unsigned");
CopySubobjects(MSS4BAND1, S4brightMASK, "georef");
dlgmain.GetCtrlByID("rasnorms1").SetEnabled(1);
}
}
#######################################
### Procedure to select output files SZENE 1
#######################################
proc OUTS1 () {
if ( sensors1 == 7 )
{
raster OUT1ETM1, OUT1ETM2, OUT1ETM3, OUT1ETM4, OUT1ETM5, OUT1ETM7;
GetOutputRaster(OUT1ETM1, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND1, OUT1ETM1, "georef");
GetOutputRaster(OUT1ETM2, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND2, OUT1ETM2, "georef");
GetOutputRaster(OUT1ETM3, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND3, OUT1ETM3, "georef");
GetOutputRaster(OUT1ETM4, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND4, OUT1ETM4, "georef");
GetOutputRaster(OUT1ETM5, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND5, OUT1ETM5, "georef");
GetOutputRaster(OUT1ETM7, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM1BAND7, OUT1ETM7, "georef");
dlgmain.GetCtrlByID("rasnorms2").SetEnabled(1);
}
else if ( sensors1 == 6 )
{
raster OUT1TM1, OUT1TM2, OUT1TM3, OUT1TM4, OUT1TM5, OUT1TM7;
GetOutputRaster(OUT1TM1, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND1, OUT1TM1, "georef");
GetOutputRaster(OUT1TM2, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND2, OUT1TM2, "georef");
GetOutputRaster(OUT1TM3, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND3, OUT1TM3, "georef");
GetOutputRaster(OUT1TM4, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND4, OUT1TM4, "georef");
GetOutputRaster(OUT1TM5, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND5, OUT1TM5, "georef");
GetOutputRaster(OUT1TM7, TMlins, TMcols, "32-bit float");
CopySubobjects(TM1BAND7, OUT1TM7, "georef");
dlgmain.GetCtrlByID("rasnorms2").SetEnabled(1);
}
else
{
raster OUT1MSS1, OUT1MSS2, OUT1MSS3, OUT1MSS4;
GetOutputRaster(OUT1MSS1, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS1BAND1, OUT1MSS1, "georef");
GetOutputRaster(OUT1MSS2, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS1BAND2, OUT1MSS2, "georef");
GetOutputRaster(OUT1MSS3, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS1BAND3, OUT1MSS3, "georef");
GetOutputRaster(OUT1MSS4, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS1BAND4, OUT1MSS4, "georef");
dlgmain.GetCtrlByID("rasnorms2").SetEnabled(1);
}
}
#######################################
### Procedure to select output files SZENE 2
#######################################
proc OUTS2 () {
if ( sensors2 == 7 )
{
raster OUT2ETM1, OUT2ETM2, OUT2ETM3, OUT2ETM4, OUT2ETM5, OUT2ETM7;
GetOutputRaster(OUT2ETM1, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND1, OUT2ETM1, "georef");
GetOutputRaster(OUT2ETM2, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND2, OUT2ETM2, "georef");
GetOutputRaster(OUT2ETM3, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND3, OUT2ETM3, "georef");
GetOutputRaster(OUT2ETM4, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND4, OUT2ETM4, "georef");
GetOutputRaster(OUT2ETM5, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND5, OUT2ETM5, "georef");
GetOutputRaster(OUT2ETM7, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM2BAND7, OUT2ETM7, "georef");
dlgmain.GetCtrlByID("rasnorms3").SetEnabled(1);
}
else if ( sensors2 == 6 )
{
raster OUT2TM1, OUT2TM2, OUT2TM3, OUT2TM4, OUT2TM5, OUT2TM7;
GetOutputRaster(OUT2TM1, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND1, OUT2TM1, "georef");
GetOutputRaster(OUT2TM2, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND2, OUT2TM2, "georef");
GetOutputRaster(OUT2TM3, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND3, OUT2TM3, "georef");
GetOutputRaster(OUT2TM4, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND4, OUT2TM4, "georef");
GetOutputRaster(OUT2TM5, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND5, OUT2TM5, "georef");
GetOutputRaster(OUT2TM7, TMlins, TMcols, "32-bit float");
CopySubobjects(TM2BAND7, OUT2TM7, "georef");
dlgmain.GetCtrlByID("rasnorms3").SetEnabled(1);
}
else
{
raster OUT2MSS1, OUT2MSS2, OUT2MSS3, OUT2MSS4;
GetOutputRaster(OUT2MSS1, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS2BAND1, OUT2MSS1, "georef");
GetOutputRaster(OUT2MSS2, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS2BAND2, OUT2MSS2, "georef");
GetOutputRaster(OUT2MSS3, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS2BAND3, OUT2MSS3, "georef");
GetOutputRaster(OUT2MSS4, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS2BAND4, OUT2MSS4, "georef");
dlgmain.GetCtrlByID("rasnorms3").SetEnabled(1);
}
}
#######################################
### Procedure to select output files SZENE 3
#######################################
proc OUTS3 () {
if ( sensors3 == 7 )
{
raster OUT3ETM1, OUT3ETM2, OUT3ETM3, OUT3ETM4, OUT3ETM5, OUT3ETM7;
GetOutputRaster(OUT3ETM1, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND1, OUT3ETM1, "georef");
GetOutputRaster(OUT3ETM2, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND2, OUT3ETM2, "georef");
GetOutputRaster(OUT3ETM3, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND3, OUT3ETM3, "georef");
GetOutputRaster(OUT3ETM4, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND4, OUT3ETM4, "georef");
GetOutputRaster(OUT3ETM5, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND5, OUT3ETM5, "georef");
GetOutputRaster(OUT3ETM7, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM3BAND7, OUT3ETM7, "georef");
dlgmain.GetCtrlByID("rasnorms4").SetEnabled(1);
}
else if ( sensors3 == 6 )
{
raster OUT3TM1, OUT3TM2, OUT3TM3, OUT3TM4, OUT3TM5, OUT3TM7;
GetOutputRaster(OUT3TM1, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND1, OUT3TM1, "georef");
GetOutputRaster(OUT3TM2, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND2, OUT3TM2, "georef");
GetOutputRaster(OUT3TM3, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND3, OUT3TM3, "georef");
GetOutputRaster(OUT3TM4, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND4, OUT3TM4, "georef");
GetOutputRaster(OUT3TM5, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND5, OUT3TM5, "georef");
GetOutputRaster(OUT3TM7, TMlins, TMcols, "32-bit float");
CopySubobjects(TM3BAND7, OUT3TM7, "georef");
dlgmain.GetCtrlByID("rasnorms4").SetEnabled(1);
}
else
{
raster OUT3MSS1, OUT3MSS2, OUT3MSS3, OUT3MSS4;
GetOutputRaster(OUT3MSS1, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS3BAND1, OUT3MSS1, "georef");
GetOutputRaster(OUT3MSS2, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS3BAND2, OUT3MSS2, "georef");
GetOutputRaster(OUT3MSS3, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS3BAND3, OUT3MSS3, "georef");
GetOutputRaster(OUT3MSS4, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS3BAND4, OUT3MSS4, "georef");
dlgmain.GetCtrlByID("rasnorms4").SetEnabled(1);
}
}
#######################################
### Procedure to select output files SZENE 4
#######################################
proc OUTS4 () {
if ( sensors4 == 7 )
{
raster OUT4ETM1, OUT4ETM2, OUT4ETM3, OUT4ETM4, OUT4ETM5, OUT4ETM7;
GetOutputRaster(OUT4ETM1, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND1, OUT4ETM1, "georef");
GetOutputRaster(OUT4ETM2, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND2, OUT4ETM2, "georef");
GetOutputRaster(OUT4ETM3, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND3, OUT4ETM3, "georef");
GetOutputRaster(OUT4ETM4, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND4, OUT4ETM4, "georef");
GetOutputRaster(OUT4ETM5, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND5, OUT4ETM5, "georef");
GetOutputRaster(OUT4ETM7, ETMlins, ETMcols, "32-bit float");
CopySubobjects(ETM4BAND7, OUT4ETM7, "georef");
dlgmain.SetOkEnabled(1);
}
else if ( sensors4 == 6 )
{
raster OUT4TM1, OUT4TM2, OUT4TM3, OUT4TM4, OUT4TM5, OUT4TM7;
GetOutputRaster(OUT4TM1, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND1, OUT4TM1, "georef");
GetOutputRaster(OUT4TM2, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND2, OUT4TM2, "georef");
GetOutputRaster(OUT4TM3, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND3, OUT4TM3, "georef");
GetOutputRaster(OUT4TM4, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND4, OUT4TM4, "georef");
GetOutputRaster(OUT4TM5, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND5, OUT4TM5, "georef");
GetOutputRaster(OUT4TM7, TMlins, TMcols, "32-bit float");
CopySubobjects(TM4BAND7, OUT4TM7, "georef");
dlgmain.SetOkEnabled(1);
}
else
{
raster OUT4MSS1, OUT4MSS2, OUT4MSS3, OUT4MSS4;
GetOutputRaster(OUT4MSS1, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS4BAND1, OUT4MSS1, "georef");
GetOutputRaster(OUT4MSS2, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS4BAND2, OUT4MSS2, "georef");
GetOutputRaster(OUT4MSS3, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS4BAND3, OUT4MSS3, "georef");
GetOutputRaster(OUT4MSS4, MSSlins, MSScols, "32-bit float");
CopySubobjects(MSS4BAND4, OUT4MSS4, "georef");
dlgmain.SetOkEnabled(1);
}
}
##################################
### Function for Julian Date aquisition
##################################
func LeapYear(date)
{
if ( (date/4) != round(date/4) ) return false;
if ( (date/100) != round(date/100) ) return true;
if ( (date/400) != round(date/400) ) return false;
return true;
}
func julD(day, month, year)
{
if ( LeapYear(year) )
{
return (day + accumulateLY[month]);
}
else
{
return (day + accumulate[month]);
}
}
##################################
### Function for the calculation of the relative DNmin1000 value
##################################
func DNminCALC(extentLIN, extentCOL, pixel)
{
numeric DNminCALClvl, extentLIN, extentCOL, pixel, DNminCALClevel, DNminCALClvl;
DNminCALClevel = (1000*pixel)/((185000/extentLIN)*(185000/extentCOL));
DNminCALClvl = round(DNminCALClevel);
return DNminCALClvl;
}
######################################################################
######################################################################
#################### Main Program ##################################
######################################################################
######################################################################
clear();
#################################################
### Set up main dialog window
#################################################
xmlmain$ = '
';
err = docmain.Parse(xmlmain$);
if ( err < 0 ) {
PopupError( err ); # pop up an error dialog
Exit( );
}
nodemain = docmain.GetElementByID( "maindlg" );
if ( nodemain == 0 ) {
PopupMessage( "Could not find main dialog node in XML document" );
Exit();
}
dlgmain.SetXMLNode(nodemain);
ret = dlgmain.DoModal();
if (ret == -1)
{
Exit();
}
######################################
###### Begin processing.
###### Calculate Radiance.
######################################
pifDarkVAL = dlgmain.GetCtrlByID("pifDark").GetValueNum();
pifBrightVAL = dlgmain.GetCtrlByID("pifBright").GetValueNum();
minPifVAL = dlgmain.GetCtrlByID("minPif").GetValueNum();
histoTailInputVAL = dlgmain.GetCtrlByID("histoTailInput").GetValueNum();
printf( "Entered PIF-Selection values passed to variables...\n\n" );
printf( "Starting off calculating...\n\n" );
s1zenith = ((2 * pi * (90 - s1ele)) / 360); # sunzenith calculation via 90degree minus sunelevation
s2zenith = ((2 * pi * (90 - s2ele)) / 360);
s3zenith = ((2 * pi * (90 - s3ele)) / 360);
s4zenith = ((2 * pi * (90 - s4ele)) / 360);
s1zenithSIMPLE = 90 - s1ele;
s2zenithSIMPLE = 90 - s2ele;
s3zenithSIMPLE = 90 - s3ele;
s4zenithSIMPLE = 90 - s4ele;
printf("Sun zenith angle (Scene 1): %6f\n", s1zenithSIMPLE);
printf("Sun zenith angle (Scene 2): %6f\n", s2zenithSIMPLE);
printf("Sun zenith angle (Scene 3): %6f\n", s3zenithSIMPLE);
printf("Sun zenith angle (Scene 4): %6f\n\n", s4zenithSIMPLE);
printf( "Sun zenith calculated...\n\n" );
s1yyyymmdd.SetDateYYYYMMDD(s1aq);
s1year = s1yyyymmdd.GetYear();
s1month = s1yyyymmdd.GetMonth();
s1day = s1yyyymmdd.GetDayOfMonth();
s2yyyymmdd.SetDateYYYYMMDD(s2aq);
s2year = s2yyyymmdd.GetYear();
s2month = s2yyyymmdd.GetMonth();
s2day = s2yyyymmdd.GetDayOfMonth();
s3yyyymmdd.SetDateYYYYMMDD(s3aq);
s3year = s3yyyymmdd.GetYear();
s3month = s3yyyymmdd.GetMonth();
s3day = s3yyyymmdd.GetDayOfMonth();
s4yyyymmdd.SetDateYYYYMMDD(s4aq);
s4year = s4yyyymmdd.GetYear();
s4month = s4yyyymmdd.GetMonth();
s4day = s4yyyymmdd.GetDayOfMonth();
s1leap = LeapYear(s1year); #Leap Year = 1 Else = 0
s2leap = LeapYear(s2year);
s3leap = LeapYear(s3year);
s4leap = LeapYear(s4year);
s1jul = julD(s1day, s1month, s1year); #julD(day, month, year)
s2jul = julD(s2day, s2month, s2year);
s3jul = julD(s3day, s3month, s3year);
s4jul = julD(s4day, s4month, s4year);
printf("Julian Date (Scene 1): %3i\n", s1jul);
printf("Julian Date (Scene 2): %3i\n", s2jul);
printf("Julian Date (Scene 3): %3i\n", s3jul);
printf("Julian Date (Scene 4): %3i\n\n", s4jul);
printf( "Julian Date calculated and year, month and day count extracted from aquisition date...\n\n" );
dist1 = 1 / (1 - 0.01674 * cos(0.9856 * (s1jul - 4)));
dist2 = 1 / (1 - 0.01674 * cos(0.9856 * (s2jul - 4)));
dist3 = 1 / (1 - 0.01674 * cos(0.9856 * (s3jul - 4)));
dist4 = 1 / (1 - 0.01674 * cos(0.9856 * (s4jul - 4)));
printf("Earth-Sun distance (Scene 1): %12f\n", dist1);
printf("Earth-Sun distance (Scene 2): %12f\n", dist2);
printf("Earth-Sun distance (Scene 3): %12f\n", dist3);
printf("Earth-Sun distance (Scene 4): %12f\n\n", dist4);
printf( "Earth Sundistance Calculated...\n\n" );
printf( "Computing Radiance...\n\n" );
###########################
### Radiance Scene 1
###########################
if ( sensors1 == 7 )
{
raster RADS1ETM1, RADS1ETM2, RADS1ETM3, RADS1ETM4, RADS1ETM5, RADS1ETM7;
CreateTempRaster(RADS1ETM1, ETMlins, ETMcols,"32-bit float");
CreateTempRaster(RADS1ETM2, ETMlins, ETMcols,"32-bit float");
CreateTempRaster(RADS1ETM3, ETMlins, ETMcols,"32-bit float");
CreateTempRaster(RADS1ETM4, ETMlins, ETMcols,"32-bit float");
CreateTempRaster(RADS1ETM5, ETMlins, ETMcols,"32-bit float");
CreateTempRaster(RADS1ETM7, ETMlins, ETMcols,"32-bit float");
for i = 1 to ETMlins
{
for j = 1 to ETMcols
{
if ( s1aq < 20000701) # Before 1. July 2000
{
if ( earSurCat1 == 8 ) # Desert(hs)
{
RADS1ETM1[i,j] = (B1LGLMAXBef2000-B1LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1LGLMINBef2000;
RADS1ETM2[i,j] = (B2LGLMAXBef2000-B2LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2LGLMINBef2000;
RADS1ETM3[i,j] = (B3LGLMAXBef2000-B3LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3LGLMINBef2000;
RADS1ETM4[i,j] = (B4LGLMAXBef2000-B4LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4LGLMINBef2000;
RADS1ETM5[i,j] = (B5LGLMAXBef2000-B5LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5LGLMINBef2000;
RADS1ETM7[i,j] = (B7LGLMAXBef2000-B7LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7LGLMINBef2000;
}
else if ( earSurCat1 == 7 ) # Desert(ms)
{
RADS1ETM1[i,j] = (B1LGLMAXBef2000-B1LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1LGLMINBef2000;
RADS1ETM2[i,j] = (B2LGLMAXBef2000-B2LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2LGLMINBef2000;
RADS1ETM3[i,j] = (B3LGLMAXBef2000-B3LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3LGLMINBef2000;
RADS1ETM4[i,j] = (B4HGLMAXBef2000-B4HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINBef2000;
RADS1ETM5[i,j] = (B5LGLMAXBef2000-B5LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5LGLMINBef2000;
RADS1ETM7[i,j] = (B7LGLMAXBef2000-B7LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7LGLMINBef2000;
}
else if ( earSurCat1 == 6 ) # Desert Ice(ls)
{
RADS1ETM1[i,j] = (B1LGLMAXBef2000-B1LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1LGLMINBef2000;
RADS1ETM2[i,j] = (B2LGLMAXBef2000-B2LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2LGLMINBef2000;
RADS1ETM3[i,j] = (B3LGLMAXBef2000-B3LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3LGLMINBef2000;
RADS1ETM4[i,j] = (B4HGLMAXBef2000-B4HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINBef2000;
RADS1ETM5[i,j] = (B5HGLMAXBef2000-B5HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINBef2000;
RADS1ETM7[i,j] = (B7HGLMAXBef2000-B7HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINBef2000;
}
else if ( earSurCat1 == 5 ) # Ice(hs)
{
RADS1ETM1[i,j] = (B1LGLMAXBef2000-B1LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1LGLMINBef2000;
RADS1ETM2[i,j] = (B2LGLMAXBef2000-B2LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2LGLMINBef2000;
RADS1ETM3[i,j] = (B3LGLMAXBef2000-B3LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3LGLMINBef2000;
RADS1ETM4[i,j] = (B4LGLMAXBef2000-B4LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4LGLMINBef2000;
RADS1ETM5[i,j] = (B5HGLMAXBef2000-B5HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINBef2000;
RADS1ETM7[i,j] = (B7HGLMAXBef2000-B7HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINBef2000;
}
else if ( earSurCat1 == 4 ) # Land(hs)
{
RADS1ETM1[i,j] = (B1HGLMAXBef2000-B1HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1HGLMINBef2000;
RADS1ETM2[i,j] = (B2HGLMAXBef2000-B2HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2HGLMINBef2000;
RADS1ETM3[i,j] = (B3HGLMAXBef2000-B3HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3HGLMINBef2000;
RADS1ETM4[i,j] = (B4LGLMAXBef2000-B4LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4LGLMINBef2000;
RADS1ETM5[i,j] = (B5HGLMAXBef2000-B5HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINBef2000;
RADS1ETM7[i,j] = (B7HGLMAXBef2000-B7HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINBef2000;
}
else if ( earSurCat1 == 3 ) # Land Ocean(ls
{
RADS1ETM1[i,j] = (B1HGLMAXBef2000-B1HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1HGLMINBef2000;
RADS1ETM2[i,j] = (B2HGLMAXBef2000-B2HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2HGLMINBef2000;
RADS1ETM3[i,j] = (B3HGLMAXBef2000-B3HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3HGLMINBef2000;
RADS1ETM4[i,j] = (B4HGLMAXBef2000-B4HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINBef2000;
RADS1ETM5[i,j] = (B5HGLMAXBef2000-B5HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINBef2000;
RADS1ETM7[i,j] = (B7HGLMAXBef2000-B7HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINBef2000;
}
else if ( earSurCat1 == 2 ) # Water
{
RADS1ETM1[i,j] = (B1HGLMAXBef2000-B1HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1HGLMINBef2000;
RADS1ETM2[i,j] = (B2HGLMAXBef2000-B2HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2HGLMINBef2000;
RADS1ETM3[i,j] = (B3HGLMAXBef2000-B3HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3HGLMINBef2000;
RADS1ETM4[i,j] = (B4HGLMAXBef2000-B4HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINBef2000;
RADS1ETM5[i,j] = (B5HGLMAXBef2000-B5HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINBef2000;
RADS1ETM7[i,j] = (B7HGLMAXBef2000-B7HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINBef2000;
}
else if ( earSurCat1 == 1 ) # Night(volcanos
{
RADS1ETM1[i,j] = (B1HGLMAXBef2000-B1HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1HGLMINBef2000;
RADS1ETM2[i,j] = (B2HGLMAXBef2000-B2HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2HGLMINBef2000;
RADS1ETM3[i,j] = (B3HGLMAXBef2000-B3HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3HGLMINBef2000;
RADS1ETM4[i,j] = (B4HGLMAXBef2000-B4HGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINBef2000;
RADS1ETM5[i,j] = (B5LGLMAXBef2000-B5LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5LGLMINBef2000;
RADS1ETM7[i,j] = (B7LGLMAXBef2000-B7LGLMINBef2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7LGLMINBef2000;
}
}
else # After 1. July 2000
{
if ( earSurCat1 == 8 ) # Desert(hs)
{
RADS1ETM1[i,j] = (B1LGLMAXAFT2000-B1LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1LGLMINAFT2000;
RADS1ETM2[i,j] = (B2LGLMAXAFT2000-B2LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2LGLMINAFT2000;
RADS1ETM3[i,j] = (B3LGLMAXAFT2000-B3LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3LGLMINAFT2000;
RADS1ETM4[i,j] = (B4LGLMAXAFT2000-B4LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4LGLMINAFT2000;
RADS1ETM5[i,j] = (B5LGLMAXAFT2000-B5LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5LGLMINAFT2000;
RADS1ETM7[i,j] = (B7LGLMAXAFT2000-B7LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7LGLMINAFT2000;
}
else if ( earSurCat1 == 7 ) # Desert(ms)
{
RADS1ETM1[i,j] = (B1LGLMAXAFT2000-B1LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1LGLMINAFT2000;
RADS1ETM2[i,j] = (B2LGLMAXAFT2000-B2LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2LGLMINAFT2000;
RADS1ETM3[i,j] = (B3LGLMAXAFT2000-B3LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3LGLMINAFT2000;
RADS1ETM4[i,j] = (B4HGLMAXAFT2000-B4HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINAFT2000;
RADS1ETM5[i,j] = (B5LGLMAXAFT2000-B5LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5LGLMINAFT2000;
RADS1ETM7[i,j] = (B7LGLMAXAFT2000-B7LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7LGLMINAFT2000;
}
else if ( earSurCat1 == 6 ) # Desert Ice(ls)
{
RADS1ETM1[i,j] = (B1LGLMAXAFT2000-B1LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1LGLMINAFT2000;
RADS1ETM2[i,j] = (B2LGLMAXAFT2000-B2LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2LGLMINAFT2000;
RADS1ETM3[i,j] = (B3LGLMAXAFT2000-B3LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3LGLMINAFT2000;
RADS1ETM4[i,j] = (B4HGLMAXAFT2000-B4HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINAFT2000;
RADS1ETM5[i,j] = (B5HGLMAXAFT2000-B5HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINAFT2000;
RADS1ETM7[i,j] = (B7HGLMAXAFT2000-B7HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINAFT2000;
}
else if ( earSurCat1 == 5 ) # Ice(hs)
{
RADS1ETM1[i,j] = (B1LGLMAXAFT2000-B1LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1LGLMINAFT2000;
RADS1ETM2[i,j] = (B2LGLMAXAFT2000-B2LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2LGLMINAFT2000;
RADS1ETM3[i,j] = (B3LGLMAXAFT2000-B3LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3LGLMINAFT2000;
RADS1ETM4[i,j] = (B4LGLMAXAFT2000-B4LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4LGLMINAFT2000;
RADS1ETM5[i,j] = (B5HGLMAXAFT2000-B5HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINAFT2000;
RADS1ETM7[i,j] = (B7HGLMAXAFT2000-B7HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINAFT2000;
}
else if ( earSurCat1 == 4 ) # Land(hs)
{
RADS1ETM1[i,j] = (B1HGLMAXAFT2000-B1HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1HGLMINAFT2000;
RADS1ETM2[i,j] = (B2HGLMAXAFT2000-B2HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2HGLMINAFT2000;
RADS1ETM3[i,j] = (B3HGLMAXAFT2000-B3HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3HGLMINAFT2000;
RADS1ETM4[i,j] = (B4LGLMAXAFT2000-B4LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4LGLMINAFT2000;
RADS1ETM5[i,j] = (B5HGLMAXAFT2000-B5HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINAFT2000;
RADS1ETM7[i,j] = (B7HGLMAXAFT2000-B7HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINAFT2000;
}
else if ( earSurCat1 == 3 ) # Land Ocean(ls
{
RADS1ETM1[i,j] = (B1HGLMAXAFT2000-B1HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1HGLMINAFT2000;
RADS1ETM2[i,j] = (B2HGLMAXAFT2000-B2HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2HGLMINAFT2000;
RADS1ETM3[i,j] = (B3HGLMAXAFT2000-B3HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3HGLMINAFT2000;
RADS1ETM4[i,j] = (B4HGLMAXAFT2000-B4HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINAFT2000;
RADS1ETM5[i,j] = (B5HGLMAXAFT2000-B5HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINAFT2000;
RADS1ETM7[i,j] = (B7HGLMAXAFT2000-B7HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINAFT2000;
}
else if ( earSurCat1 == 2 ) # Water
{
RADS1ETM1[i,j] = (B1HGLMAXAFT2000-B1HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1HGLMINAFT2000;
RADS1ETM2[i,j] = (B2HGLMAXAFT2000-B2HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2HGLMINAFT2000;
RADS1ETM3[i,j] = (B3HGLMAXAFT2000-B3HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3HGLMINAFT2000;
RADS1ETM4[i,j] = (B4HGLMAXAFT2000-B4HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINAFT2000;
RADS1ETM5[i,j] = (B5HGLMAXAFT2000-B5HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5HGLMINAFT2000;
RADS1ETM7[i,j] = (B7HGLMAXAFT2000-B7HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7HGLMINAFT2000;
}
else if ( earSurCat1 == 1 ) # Night(volcanos
{
RADS1ETM1[i,j] = (B1HGLMAXAFT2000-B1HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND1[i,j]-QCALMIN)+B1HGLMINAFT2000;
RADS1ETM2[i,j] = (B2HGLMAXAFT2000-B2HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND2[i,j]-QCALMIN)+B2HGLMINAFT2000;
RADS1ETM3[i,j] = (B3HGLMAXAFT2000-B3HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND3[i,j]-QCALMIN)+B3HGLMINAFT2000;
RADS1ETM4[i,j] = (B4HGLMAXAFT2000-B4HGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND4[i,j]-QCALMIN)+B4HGLMINAFT2000;
RADS1ETM5[i,j] = (B5LGLMAXAFT2000-B5LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND5[i,j]-QCALMIN)+B5LGLMINAFT2000;
RADS1ETM7[i,j] = (B7LGLMAXAFT2000-B7LGLMINAFT2000)/(QCALMAX-QCALMIN)*(ETM1BAND7[i,j]-QCALMIN)+B7LGLMINAFT2000;
}
}
}
}
CloseRaster(ETM1BAND1);
CloseRaster(ETM1BAND2);
CloseRaster(ETM1BAND3);
CloseRaster(ETM1BAND4);
CloseRaster(ETM1BAND5);
CloseRaster(ETM1BAND7);
printf("Radiance calculation for Scene 1 (ETM) is done...\n");
}
else if ( sensors1 == 6 )
{
raster RADS1TM1, RADS1TM2, RADS1TM3, RADS1TM4, RADS1TM5, RADS1TM7;
CreateTempRaster(RADS1TM1, TMlins, TMcols,"32-bit float");
CreateTempRaster(RADS1TM2, TMlins, TMcols,"32-bit float");
CreateTempRaster(RADS1TM3, TMlins, TMcols,"32-bit float");
CreateTempRaster(RADS1TM4, TMlins, TMcols,"32-bit float");
CreateTempRaster(RADS1TM5, TMlins, TMcols,"32-bit float");
CreateTempRaster(RADS1TM7, TMlins, TMcols,"32-bit float");
for i = 1 to TMlins
{
for j = 1 to TMcols
{
if (s1leap == 0)
{
numeric gainnewTMS1b1, gainnewTMS1b2, gainnewTMS1b3, gainnewTMS1b4, gainnewTMS1b5, gainnewTMS1b7;
gainnewTMS1b1 = ((0.145658 * exp(-0.955113 * ((s1year + (s1jul / 365)) - 1984.2082))) + 1.243000);
gainnewTMS1b2 = ((0.058651 * exp(-0.835952 * ((s1year + (s1jul / 365)) - 1984.2082))) + 0.656100);
gainnewTMS1b3 = ((0.111858 * exp(-1.002090 * ((s1year + (s1jul / 365)) - 1984.2082))) + 0.905000);
gainnewTMS1b4 = ((0.107650 * exp(-1.277190 * ((s1year + (s1jul / 365)) - 1984.2082))) + 1.082000);
gainnewTMS1b5 = ((0.243364 * exp(-1.207080 * ((s1year + (s1jul / 365)) - 1984.2082))) + 7.944000);
gainnewTMS1b7 = ((0.403551 * exp(-0.999127 * ((s1year + (s1jul / 365)) - 1984.2082))) + 14.52000);
RADS1TM1[i,j] = ((s1TMg1 * ((gainnewTMS1b1 * ((s1TMg1 * TM1BAND1[i,j]) + s1TMb1)) + biasnewTMb1)) + s1TMb1);
RADS1TM2[i,j] = ((s1TMg2 * ((gainnewTMS1b2 * ((s1TMg2 * TM1BAND2[i,j]) + s1TMb2)) + biasnewTMb2)) + s1TMb2);
RADS1TM3[i,j] = ((s1TMg3 * ((gainnewTMS1b3 * ((s1TMg3 * TM1BAND3[i,j]) + s1TMb3)) + biasnewTMb3)) + s1TMb3);
RADS1TM4[i,j] = ((s1TMg4 * ((gainnewTMS1b4 * ((s1TMg4 * TM1BAND4[i,j]) + s1TMb4)) + biasnewTMb4)) + s1TMb4);
RADS1TM5[i,j] = ((s1TMg5 * ((gainnewTMS1b5 * ((s1TMg5 * TM1BAND5[i,j]) + s1TMb5)) + biasnewTMb5)) + s1TMb5);
RADS1TM7[i,j] = ((s1TMg7 * ((gainnewTMS1b7 * ((s1TMg7 * TM1BAND7[i,j]) + s1TMb7)) + biasnewTMb7)) + s1TMb7);
}
else if (s1leap == 1)
{
numeric gainnewTMS1b1, gainnewTMS1b2, gainnewTMS1b3, gainnewTMS1b4, gainnewTMS1b5, gainnewTMS1b7;
gainnewTMS1b1 = ((0.145658 * exp(-0.955113 * ((s1year + (s1jul / 366)) - 1984.2082))) + 1.243000);
gainnewTMS1b2 = ((0.058651 * exp(-0.835952 * ((s1year + (s1jul / 366)) - 1984.2082))) + 0.656100);
gainnewTMS1b3 = ((0.111858 * exp(-1.002090 * ((s1year + (s1jul / 366)) - 1984.2082))) + 0.905000);
gainnewTMS1b4 = ((0.107650 * exp(-1.277190 * ((s1year + (s1jul / 366)) - 1984.2082))) + 1.082000);
gainnewTMS1b5 = ((0.243364 * exp(-1.207080 * ((s1year + (s1jul / 366)) - 1984.2082))) + 7.944000);
gainnewTMS1b7 = ((0.403551 * exp(-0.999127 * ((s1year + (s1jul / 366)) - 1984.2082))) + 14.52000);
RADS1TM1[i,j] = ((s1TMg1 * ((gainnewTMS1b1 * ((s1TMg1 * TM1BAND1[i,j]) + s1TMb1)) + biasnewTMb1)) + s1TMb1);
RADS1TM2[i,j] = ((s1TMg2 * ((gainnewTMS1b2 * ((s1TMg2 * TM1BAND2[i,j]) + s1TMb2)) + biasnewTMb2)) + s1TMb2);
RADS1TM3[i,j] = ((s1TMg3 * ((gainnewTMS1b3 * ((s1TMg3 * TM1BAND3[i,j]) + s1TMb3)) + biasnewTMb3)) + s1TMb3);
RADS1TM4[i,j] = ((s1TMg4 * ((gainnewTMS1b4 * ((s1TMg4 * TM1BAND4[i,j]) + s1TMb4)) + biasnewTMb4)) + s1TMb4);
RADS1TM5[i,j] = ((s1TMg5 * ((gainnewTMS1b5 * ((s1TMg5 * TM1BAND5[i,j]) + s1TMb5)) + biasnewTMb5)) + s1TMb5);
RADS1TM7[i,j] = ((s1TMg7 * ((gainnewTMS1b7 * ((s1TMg7 * TM1BAND7[i,j]) + s1TMb7)) + biasnewTMb7)) + s1TMb7);
}
}
}
CloseRaster(TM1BAND1);
CloseRaster(TM1BAND2);
CloseRaster(TM1BAND3);
CloseRaster(TM1BAND4);
CloseRaster(TM1BAND5);
CloseRaster(TM1BAND7);
printf("Radiance calculation for Scene 1 (TM) is done...\n");
}
else if ( sensors1 == 5 ) # MSS 5 - Calib Werte nach Price J.C.1987
{
raster RADS1MSS1, RADS1MSS2, RADS1MSS3, RADS1MSS4;
CreateTempRaster(RADS1MSS1, MSSlins, MSScols,"32-bit float");
CreateTempRaster(RADS1MSS2, MSSlins, MSScols,"32-bit float");
CreateTempRaster(RADS1MSS3, MSSlins, MSScols,"32-bit float");
CreateTempRaster(RADS1MSS4, MSSlins, MSScols,"32-bit float");
for i = 1 to MSSlins
{
for j = 1 to MSScols
{
if ( s1aq <= 19841109) # Before 9 November 1984
{
RADS1MSS1[i,j] = L5B1bef84gain * MSS1BAND1[i,j] + L5B1bef84bias;
RADS1MSS2[i,j] = L5B2bef84gain * MSS1BAND2[i,j] + L5B2bef84bias;
RADS1MSS3[i,j] = L5B3bef84gain * MSS1BAND3[i,j] + L5B3bef84bias;
RADS1MSS4[i,j] = L5B4bef84gain * MSS1BAND4[i,j] + L5B4bef84bias;
}
else # after 9 November 1984
{
RADS1MSS1[i,j] = L5B1aft84gain * MSS1BAND1[i,j] + L5B1aft84bias;
RADS1MSS2[i,j] = L5B2aft84gain * MSS1BAND2[i,j] + L5B2aft84bias;
RADS1MSS3[i,j] = L5B3aft84gain * MSS1BAND3[i,j] + L5B3aft84bias;
RADS1MSS4[i,j] = L5B4aft84gain * MSS1BAND4[i,j] + L5B4aft84bias;
}
}
}
CloseRaster(MSS1BAND1);
CloseRaster(MSS1BAND2);
CloseRaster(MSS1BAND3);
CloseRaster(MSS1BAND4);
printf("Radiance calculation for Scene 1 (MSS) is done...\n");
}
else if ( sensors1 == 4 ) # MSS 4
{
raster RADS1MSS1, RADS1MSS2, RADS1MSS3, RADS1MSS4;
CreateTempRaster(RADS1MSS1, MSSlins, MSScols,"32-bit float");
CreateTempRaster(RADS1MSS2, MSSlins, MSScols,"32-bit float");
CreateTempRaster(RADS1MSS3, MSSlins, MSScols,"32-bit fl