import arcpy, os from arcpy import env from arcpy.sa import * arcpy.CheckOutExtension("Spatial") env.workspace = r"E:\Models_Ken\PSI_Outputs\Test_Small_Run" list1 = [] lstRasters = arcpy.ListRasters("*") for raster in lstRasters: list1.append(env.workspace + os.sep + raster) print 'Successfully created list1' print list1 #env.workspace = r"E:\Models_Ken\PSI_Outputs\Test_Small_Run" featureClass = r"E:\Models_Ken\PSI_Outputs\Test_Small_Run\Tract_Centroids_Test.shp" list2 = [] #fclist = arcpy.ListFeatureClasses("*","Point") #for fc in fclist: #list2.append(env.workspace + os.sep + raster) #print 'Successfully created list2' rows = arcpy.SearchCursor(featureClass) row = rows.next() while row: print row.Sum_Count row = rows.next() count = len(list1) x = 0 while x < count: raster = list1name = raster.split("\\")[-1] inParcelNumber = row.Sum_Count outTimes = raster * inParcelNumber outTimes.save(r"E:\Models_Ken\PSI_Outputs\Test_Small_Run_Output" + os.sep + name.split(".")[0] + "_minus.tif") print 'Successfully created raster' x += 1 del list1, row.Sum_Count
Solved! Go to Solution.
rows = arcpy.SearchCursor(featureClass) row = rows.next() while row: print row.Sum_Count row = rows.next()
rows = arcpy.SearchCursor(featureClass) value_lst = [row.Sum_Count for row in rows]
rows = arcpy.SearchCursor(featureClass) row = rows.next() while row: print row.Sum_Count row = rows.next()
rows = arcpy.SearchCursor(featureClass) value_lst = [row.Sum_Count for row in rows]
import arcpy, os from arcpy import env from arcpy.sa import * arcpy.CheckOutExtension("Spatial") env.workspace = r"E:\Models_Ken\PSI_Outputs\Subtraction_Output_Tract" list1 = [] lstRasters = arcpy.ListRasters("*") for raster in lstRasters: list1.append(env.workspace + os.sep + raster) print 'Successfully created list1' print list1 featureClass = r"E:\Models_Ken\PSI_Outputs\tract_centroids.shp" rows = arcpy.SearchCursor(featureClass) value_lst = [row.Sum_Count for row in rows] print value_lst count = len(list1) x = 0 while x < count: raster = list1name = raster.split("\\")[-1] inParcelNumber = value_lst outTimes = Times(raster, inParcelNumber) outTimes.save(r"E:\Models_Ken\PSI_Outputs\Multiplication_Output_Tract" + os.sep + name.split(".")[0] + "_multi.tif") print 'Successfully created raster' x += 1 del list1, value_lst, count