I am relatively new to the ArcGIS-Python environment and want to calculate elevation raster slope. But it says "ValueError: setting an array element with a sequence". Below code is what I have.
import arcpy, numpy, mathfrom numpy import *from arcpy import envarcpy.env.workspace = ("D:/input")inRas = arcpy.RasterToNumPyArray('t1')[rows,cols]=inRas.shapeslope=zeros((rows,cols), float)desc = arcpy.Describe('t1')cellSize = desc.meanCellHeightextent = desc.Extentpnt = arcpy.Point(extent.XMin,extent.YMin)for j in range(0,rows-1): for i in range(0,cols-1): slope[i,j]= inRas[math.sqrt(((cols+1)-(cols-1)) ** 2 + ((rows+1)-(rows-1)) ** 2)] print slope myArray=arcpy.NumPyArrayToRaster('slope',pnt,cellSize,cellSize) myArray.save("D:/output/t1")
أكثر...
import arcpy, numpy, mathfrom numpy import *from arcpy import envarcpy.env.workspace = ("D:/input")inRas = arcpy.RasterToNumPyArray('t1')[rows,cols]=inRas.shapeslope=zeros((rows,cols), float)desc = arcpy.Describe('t1')cellSize = desc.meanCellHeightextent = desc.Extentpnt = arcpy.Point(extent.XMin,extent.YMin)for j in range(0,rows-1): for i in range(0,cols-1): slope[i,j]= inRas[math.sqrt(((cols+1)-(cols-1)) ** 2 + ((rows+1)-(rows-1)) ** 2)] print slope myArray=arcpy.NumPyArrayToRaster('slope',pnt,cellSize,cellSize) myArray.save("D:/output/t1")
أكثر...