#Import modules import os import arcpy from arcpy import env from arcpy.sa import * arcpy.CheckOutExtension("Spatial") #Set local variables wks = arcpy.GetParameterAsText(0) # input workspace inRaster1 = arcpy.GetParameterAsText(1) # input raster layer inRaster2 = arcpy.GetParameterAsText(2) # input raster layer inRaster3 = arcpy.GetParameterAsText(3) # input raster layer inRaster4 = arcpy.GetParameterAsText(4) # input raster layer inRaster5 = arcpy.GetParameterAsText(5) # input raster layer inRaster6 = arcpy.GetParameterAsText(6) # input raster layer inRaster7 = arcpy.GetParameterAsText(7) # input raster layer inRaster8 = arcpy.GetParameterAsText(8) # input raster layer inRaster9 = arcpy.GetParameterAsText(9) # input raster layer inRaster10 = arcpy.GetParameterAsText(10) # input raster layer env.workspace = wks cellSize = 100 outExtent = Extent(871599.89, 982834.44, 912502.09, 1070920.9) ReMapTable_dbf = "P:\\Crime_Analysis\\Testing_Training\\RiskTerrainModeling\\RobinAdrienne\\AggAssaults\\ReMapTable.dbf" #Multiply Raster by a constant with CreateConstantRaster constantValue1 = arcpy.GetParameterAsText(11) # input weight value outConstRaster1 = CreateConstantRaster(constantValue1, "FLOAT", cellSize, outExtent) outReclass1 = ReclassByTable(inRaster1, ReMapTable_dbf , "FROM", "TO", "VALUE") outTimes1 = outReclass1* outConstRaster1 outRaster1 = "Wt_" + os.path.basename(inRaster1) outTimes1.save(outRaster1) # save raster constantValue2 = arcpy.GetParameterAsText(12) # input weight value outConstRaster2 = CreateConstantRaster(constantValue2, "FLOAT", cellSize, outExtent) outReclass2 = ReclassByTable(inRaster2, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes2 = outReclass2* outConstRaster2 outRaster2 = "Wt_" + os.path.basename(inRaster2) outTimes2.save(outRaster2) arcpy.SetParameterAsText(13,outRaster2) #isinstnace test for parameter input constantValue3 = arcpy.GetParameterAsText(14) # input weight value if constantValue3: outConstRaster3 = CreateConstantRaster(constantValue3, "FLOAT", cellSize, outExtent) outReclass3 = ReclassByTable(inRaster3, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes3 = outReclass3* outConstRaster3 outRaster3 = "Wt_" + os.path.basename(inRaster3) outTimes3.save(outRaster3) else: sys.exit() constantValue4 = arcpy.GetParameterAsText(15) # input weight value if constantValue4: outConstRaster4 = CreateConstantRaster(constantValue4, "FLOAT", cellSize, outExtent) outReclass4 = ReclassByTable(inRaster4, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes4 = outReclass4* outConstRaster4 outRaster4 = "Wt_" + os.path.basename(inRaster4) outTimes4.save(outRaster4) else: sys.exit() constantValue5 = arcpy.GetParameterAsText(16) # input weight value if constantValue5: outConstRaster5 = CreateConstantRaster(constantValue5, "FLOAT", cellSize, outExtent) outReclass5 = ReclassByTable(inRaster5, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes5 = outReclass5* outConstRaster5 outRaster5 = "Wt_" + os.path.basename(inRaster5) outTimes5.save(outRaster5) else: sys.exit() constantValue6 = arcpy.GetParameterAsText(17) # input weight value if constantValue6: outConstRaster6 = CreateConstantRaster(constantValue6, "FLOAT", cellSize, outExtent) outReclass6 = ReclassByTable(inRaster6, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes6 = outReclass6* outConstRaster6 outRaster6 = "Wt_" + os.path.basename(inRaster6) outTimes6.save(outRaster6) else: sys.exit() constantValue7 = arcpy.GetParameterAsText(18) # input weight value if constantValue7: outConstRaster7 = CreateConstantRaster(constantValue7, "FLOAT", cellSize, outExtent) outReclass7 = ReclassByTable(inRaster7, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes7 = outReclass7* outConstRaster7 outRaster7 = "Wt_" + os.path.basename(inRaster7) outTimes7.save(outRaster7) else: sys.exit() constantValue8 = arcpy.GetParameterAsText(19) # input weight value if constantValue8: outConstRaster8 = CreateConstantRaster(constantValue8, "FLOAT", cellSize, outExtent) outReclass8 = ReclassByTable(inRaster8, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes8 = outReclass8* outConstRaster8 outRaster8 = "Wt_" + os.path.basename(inRaster8) outTimes8.save(outRaster8) else: sys.exit() constantValue9 = arcpy.GetParameterAsText(20) # input weight value if constantValue9: outConstRaster9 = CreateConstantRaster(constantValue9, "FLOAT", cellSize, outExtent) outReclass9 = ReclassByTable(inRaster9, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes9 = outReclass9* outConstRaster9 outRaster9 = "Wt_" + os.path.basename(inRaster9) outTimes9save(outRaster9) else: sys.exit() constantValue10 = arcpy.GetParameterAsText(21) # input weight value if constantValue10: outConstRaster10 = CreateConstantRaster(constantValue10, "FLOAT", cellSize, outExtent) outReclass10 = ReclassByTable(inRaster10, ReMapTable_dbf ,"FROM","TO","VALUE") outTimes10 = outReclass10* outConstRaster10 outRaster10 = "Wt_" + os.path.basename(inRaster10) outTimes10.save(outRaster10) else: sys.exit()
Solved! Go to Solution.