Arcpy Batch Extract by Mask


PHOTO EMBED

Tue Feb 09 2021 17:16:51 GMT+0000 (UTC)

Saved by @GeeseGoose #python

import arcpy
from arcpy import env 
from arcpy.sa import * 
arcpy.env.workspace = r"I:\ARW_Data\Data\Raw_Data\Soil_Moisture\2011"
arcpy.CheckOutExtension('Spatial')
mask = r"I:\ARW_Data\slc_90m_clip1"
arcpy.env.cellSize = r"I:\ARW_Data\slc_90m_clip1"
rasters = arcpy.ListRasters("*.tif", "TIF")
for raster in rasters:
 outraster = raster.replace('.tif','_clip.tif')
 arcpy.gp.ExtractByMask_sa(raster,mask,outraster)
content_copyCOPY

https://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z0000002n000000.htm