Great sample. Thought to add for reference if one wanted to calculate the output as Raster in Map Algebra
from arcpy.sa import * import math asp = Aspect(inElevation) aspNull = SetNull(asp, asp, "VALUE = -1") aspCos = Cos(aspNull * math.pi / 180.0) aspSin = Sin(aspNull * math.pi / 180.0) xxSumSin = ZonalStatistics(inZones,"OBJECTID", "aspSin", "MEAN", "DATA") xxSumCos = ZonalStatistics(inZones,"OBJECTID", aspCos, "MEAN", "DATA") asp_azm = (360+(ATan2(xxSumSin,xxSumCos)) * (180 / math.pi)) % 360.0
I have roughly ~700 polygons that I would like to derive the mean aspect for each. I've downloaded the zip file and input the polygon featureclass. I've also specified the zoneID field but the tool won't accept any of my elevation rasters.
I've tried exporting my rasters to ESRI grid, I've tried changing the source type properties from generic to elevation. I've tried shortening the file names and the tool always returns ERROR -1 Input must be an ESRI grid...
I'm not sure where I've gone wrong. Any help/advice would be greatly appreciated