wstbl = WSTable([["snow", "VALUE", 0.25], ["land", "VALUE", 0.25],["soil", "VALUE", 0.5]])
import arcpy from arcpy.sa import * arcpy.CheckOutExtension("Spatial") wstbl = WSTable([["snow", "VALUE", 0.25], ["land", "VALUE", 0.25], ["soil", "VALUE", 0.5]]) print wstbl
output_raster = arcpy.sa.WeightedSum(wstbl)
arcpy.gp.WeightedSum_sa("snow VALUE 0.25;land VALUE 0.25;soil VALUE 0.5",output_raster)
import arcpy arcpy.CheckOutExtension("Spatial") wstbl = arcpy.GetParameterAsText(0) # list of rasters and weights out_ras = arcpy.GetParameterAsText(1) # output raster arcpy.gp.WeightedSum_sa(wstbl,out_ras)
# make an empty master file WSTable = [] # open the file to read txt = open(r"c:\weights.txt", 'r') # read each line to the end of the file while txt.readline() != '': # readline gets a line line = f.readline() # rstrip removes carrige return strip = line.rstrip() # split makes sure you get the correct chunks split = strip.split(',') # now make a list of the chunks aList = list(split) # append the individual list to the master list WSTable.append(aList) # close the file txt.close()
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.