""" Spatial Data Modeller for ESRI* ArcGIS 9.3 Copyright 2009 Gary L Raines, Reno, NV, USA: production and certification Don L Sawatzky, Spokane, WA, USA: Python software development """ # --------------------------------------------------------------------------- # MSSmall.py # Created on: Sat May 26 2007 07:12:54 AM # (generated by ArcGIS/ModelBuilder) # Usage: MSSmall # --------------------------------------------------------------------------- # Import system modules import sys, string, os, traceback import arcgisscripting import WorkArounds_93 # Create the Geoprocessor object gp = arcgisscripting.create() # Check out any necessary licenses gp.CheckOutExtension("spatial") # Load required toolboxes... #gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx") try: # Script arguments... Evidence = gp.GetParameterAsText(0) FM_MS_Small = gp.GetParameterAsText(3) if FM_MS_Small == '': FM_MS_Small = Evidence + '_MSSml' A = gp.GetParameter(1) B = gp.GetParameter(2) # Local variables... BandCol_Stats = os.path.join(gp.ScratchWorkspace, "bandcol_stats.txt") # Process: Band Collection Statistics... WorkArounds_93.BandCollectionStats(gp, Evidence, BandCol_Stats, "BRIEF") fin = open(BandCol_Stats,'r') for i in range(6): fin.readline() tokens = fin.readline().split() fin.close() Mean = float(tokens[3]) StDev = float(tokens[4]) #>>>>>>>>>>>>>>>>>> For Testing Only >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #for line in open(BandCol_Stats,'r'): gp.addmessage(line[:-1]) #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # Process: Single Output Map Algebra... #>>>>>>>>>>>>>>>>>> For Testing Only >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> s = "con([Evidence] > A * Mean, (B * StDev) / ([Evidence] - (A * Mean) + (B * StDev)),1)" gp.AddMessage(s) #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Expression = "con([%s] > %s * %s, (%s * %s) / ([%s] - (%s * %s) + (%s * %s)),1)" \ %(Evidence,A,Mean,B,StDev,Evidence,A,Mean,B,StDev) #>>>>>>>>>>>>>>>>>> For Testing Only >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #gp.AddMessage(Expression) #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< gp.SingleOutputMapAlgebra_sa( Expression, FM_MS_Small) gp.SetParameterAsText(3, FM_MS_Small) except: gp.AddError("Error in Execution" + gp.GetMessages()) gp.AddMessage("Exit MS Small.")