I am attempting to run Extract by Mask through a loop using Search Cursor, where the Cursor is defined by the row "FID" in a table from a grid shapefile. The code is as follows:
import arcpy, os
from arcpy import env
outws = r"C:/path2/"
raster = r"C:/path1/raster.tif"
fc = r"C:/path1/shapegrid.shp"
arcpy.CheckOutExtension("Spatial")
count = 0
with arcpy.da.SearchCursor(fc, ["FID"]) as cursor:
for row in cursor:
out = os.path.join(outws, "demgrid" + str(count) + ".tif")
ebm = arcpy.sa.ExtractByMask (raster, row)
ebm.save(out)
count = count + 1
arcpy.CheckInExtension("Spatial")
sys.exit()
The error that first pops up is on the 17th line: ebm = arcpy.sa.ExtractByMask (raster, row)
Traceback (most recent call last):
File "grid_extract.py", line 17, in <module>
ebm = arcpy.sa.ExtractByMask (raster, row)
My speculation is that either I've called the wrong module, or that I've not defined a specific one I need for this task.