I am doing a least cost path analysis. I need to create a for loop that will run 3 times and select the correct weight from each of the two lists (slope and land).
Slope = [10, 20, 30]
Land = [30, 20, 10]
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = (c:\)
arcpy.CheckOutExtension("Spatial")
#------------------------------------------------- Times calculation
outTimes10 = Times("Slope",10)
outTimes20 = Times("Slope",20)
outTimes30 = Times("Slope",30)
#------------------------------------------------- Times calculation
outland30 = Times("land_tif", 30)
outland20 = Times("land_tif", 20)
outland10 = Times("land_tif", 10)
#------------------------------------------------- Added two raster together
outPlus1030 = Plus("outTimes10", "outland30")
outPlus2020 = Plus("outTimes20", "outland20")
outPlus3010 = Plus("outTimes30", "outland10")
#------------------------------------------------- Cost Back link
outBacklink = CostBackLink("Hiker.shp","outPlus1030", 100000,
"c:/sapyexamples/output/distRast")
pair1bl="CostBac_shp1"
pair2bl="CostBac_shp2"
pair3bl="CostBac_shp3"
#------------------------------------------------- Cost distance
outCostDist = CostDistance("Hiker.shp", "slope", 200000, "pair1bl")
pair1cd="CostDis_shp1"
pair2cd="CostDis_shp2"
pair3cd="CostDis_shp3"
#------------------------------------------------- Least cost path
outCostPath = CostPath("Hiker.shp", "outplus1030", "pair1bl", "EACH_CELL")
path1="CostPat_shp1"
path2="CostPat_shp2"
path3="CostPat_shp3"
I am new to python. I need help with creating a for loop that will select numbers from the two list do the times calculation, plus calculation, cost backlink, cost distance, and least cost path.
I do not know how to direct the output of the calculation to be saved in a different file name everytime the loop runs.