I am new to arcpy. I am attempting to batch clip over 350 rasters to one the extent of one mask raster. I tried it in model builder and it wouldn't run so now I am trying it in arcpy but I continue to get error messages.
Here is my code:
import arcpy
import os
import glob
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *
#Sets environment
env.workspace = "E:/AlexandraOrrego/GIS_2017/RasterData/Reclass2.gdb"
mask = "E:/AlexandraOrrego/GIS_2017/Shapefiles/westus_forest"
outputDir = "E:/AlexandraOrrego/GIS_2017/RasterData/clipped.gdb"
rasList = arcpy.ListRasters()
for raster in rasList:
outRasterName = raster.replace("r2", "c")
rasterObject = arcpy.sa.ExtractByMask(raster, mask, outRasterName)
#Saves Raster
rasterObject.save(os.path.join(outputDir, outRasterName))
#prints once each raster layer has been clipped
print outRasterName + " Clipped Successfully!"
Runtime error
Traceback (most recent call last):
File "<string>", line 17, in <module>
TypeError: ExtractByMask() takes exactly 2 arguments (3 given)
>>>