<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Batch Raster Clipping in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194303#M14898</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi ArcGIS Users,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good Day!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been searching for answers in the web but haven't find any plausible answers yet. What I want to do is automate the clipping of my raster files using a set of shapefiles. Basically, what I want to do is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;raster 1 clip with shapefile 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster 2 clip with shapefile 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster 3 clip with shapefile 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster 37 clip with shapefile 37&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My raster files and shapefiles are in different directory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My initial code is like the one below which I got from exporting the model builder to a python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I automate my clipping process in such a way that it will loop to all my raster data and match each raster data with a specified shapefile. I am currently using ArcGIS 10.2. Can you help me build the code using the initial code that I have below?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Import arcpy module
import arcpy


# Local variables:
Shapefile = r'E:\folder\folder\folder\folder\shapefile1.shp'
Raster_Dataset = r'E:\folder\folder\folder\raster1.tif'
Output_Raster_Dataset = r'E:\folder\test.tif'

# Process: Clip
arcpy.Clip_management(Raster_Dataset, "", Output_Raster_Dataset, Shapefile, "", "ClippingGeometry", "NO_MAINTAIN_EXTENT")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 May 2014 08:36:30 GMT</pubDate>
    <dc:creator>Leo_KrisPalao</dc:creator>
    <dc:date>2014-05-16T08:36:30Z</dc:date>
    <item>
      <title>Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194303#M14898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi ArcGIS Users,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good Day!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been searching for answers in the web but haven't find any plausible answers yet. What I want to do is automate the clipping of my raster files using a set of shapefiles. Basically, what I want to do is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;raster 1 clip with shapefile 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster 2 clip with shapefile 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster 3 clip with shapefile 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster 37 clip with shapefile 37&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My raster files and shapefiles are in different directory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My initial code is like the one below which I got from exporting the model builder to a python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I automate my clipping process in such a way that it will loop to all my raster data and match each raster data with a specified shapefile. I am currently using ArcGIS 10.2. Can you help me build the code using the initial code that I have below?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Import arcpy module
import arcpy


# Local variables:
Shapefile = r'E:\folder\folder\folder\folder\shapefile1.shp'
Raster_Dataset = r'E:\folder\folder\folder\raster1.tif'
Output_Raster_Dataset = r'E:\folder\test.tif'

# Process: Clip
arcpy.Clip_management(Raster_Dataset, "", Output_Raster_Dataset, Shapefile, "", "ClippingGeometry", "NO_MAINTAIN_EXTENT")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 08:36:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194303#M14898</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2014-05-16T08:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194304#M14899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This can all be done in model builder no need to create a python script. You need to read the help file about iterators and inline substitution. Read those pages to understand the model below which will do what you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33864[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 09:38:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194304#M14899</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2014-05-16T09:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194305#M14900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I use the model that you suggested, can I input multiple raster layers (*.tif)? and when I run the model, it will automatically match the first shapefile in my folders with my first raster?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried something similar before, but what it does is the first shapefile in my folder reiterates through all of my rasters in my Raster List ( i have used raster layer and enable "List of values" option) like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SHP 1 clip with raster 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SHP 1 clip with raster 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SHP 1 clip with raster 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SHP 1 clip with raster 37&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;what I would love to do is to match each SHP with my 1st raster in my list, then 2nd shapefile with my 2nd raster, and so on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I will try what I can do in the model builder as you suggested.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 11:05:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194305#M14900</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2014-05-16T11:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194306#M14901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is why I parse the output of the iterator to get the shapefile name so c:\temp\fred.shp will parse to "fred". I then use inline substitution to grab the equivalent raster from c:\raster\fred.tif.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 11:58:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194306#M14901</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2014-05-16T11:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194307#M14902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If your file names really are named like "raster1" and "shapefile1" and there is a 1:1 relationship, this code should work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

raster_ws = r'E:\path_to_raster_fold'
shp_ws = r'E:\path_to_shp_fold'

# output workspace
out_ws = r'E:\path_to_output_fold'

# get lists
arcpy.env.workspace = raster_ws
rasters = [os.path.join(raster_ws, r) for r in arcpy.ListRasters()]

arcpy.env.workspace = shp_ws
shapes = [os.path.join(shp_ws, s) for s in arcpy.ListFeatureClasses()]

# get dictionary {raster1 : shapefile1.shp, ...}
clip_dict = dict(zip(rasters, shapes))

# clip all reasters
for raster, shapefile in clip_dict.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_raster = os.path.join(out_ws, os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(raster, "", out_raster, shapefile, "", "ClippingGeometry", "NO_MAINTAIN_EXTENT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Clipped {0}'.format(os.path.basename(raster))
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:44:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194307#M14902</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T09:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194308#M14903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply and sharing the code. I would like to modify the code to incorporate calculation of cell statistics after the clipping process. Would you suggest incorporating it in the code that you gave me, or it will be much simpler to write another code just for calculating cell statistics.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 08:24:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194308#M14903</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2014-05-20T08:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194309#M14904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Caleb and other ArcGIS Python users,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I modified the code a bit to incorporate computation of cell statistics in the code. Basically what I have done so far is to create a container &amp;gt;&amp;gt;&amp;gt; outputlist = [] that will store the output of the clipping. Then used this list to compute for cell statistics. I think I got the code correctly until Line 28 &amp;gt;&amp;gt;&amp;gt; outputList.append(out_raster) but I have a problem in computing the cell statistics. The error says:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "E:\Python_scripts\Clip\rasterClip_with_cellstats.py", line 29, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for raster in outputList():&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TypeError: 'list' object is not callable&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code with a little modification is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os, sys
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True

raster_ws = r'E:\Test_awd\Criteria_SP_2mm_v2'
shp_ws = r'E:\Test_awd\Season1'

# output workspace
out_ws = r'E:\Test_awd'

# get lists
arcpy.env.workspace = raster_ws
rasters = [os.path.join(raster_ws, r) for r in arcpy.ListRasters()]

arcpy.env.workspace = shp_ws
shapes = [os.path.join(shp_ws, s) for s in arcpy.ListFeatureClasses()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# get dictionary {raster1 : shapefile1.shp, ...}
clip_dict = dict(zip(rasters, shapes))

# clip all rasters
outputList = []
for raster, shapefile in clip_dict.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_raster = os.path.join(out_ws, os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(raster, "", out_raster, shapefile, "", "ClippingGeometry", "NO_MAINTAIN_EXTENT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Clipped {0}'.format(os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; outputList.append(out_raster)
for raster in outputList():
&amp;nbsp;&amp;nbsp;&amp;nbsp; sumRaster = CellStatistics(["outputList"], "SUM", "DATA")
&amp;nbsp;&amp;nbsp;&amp;nbsp; sumRaster.save(r'E:\Test_awd')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you help me solve the error that I am getting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:44:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194309#M14904</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2021-12-11T09:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194310#M14905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Leo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You were close...You do not need the () after outputList. Try modifying the last portion of the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os, sys
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension('Spatial')

raster_ws = r'E:\Test_awd\Criteria_SP_2mm_v2'
shp_ws = r'E:\Test_awd\Season1'

# output workspace
out_ws = r'E:\Test_awd'

# get lists
arcpy.env.workspace = raster_ws
rasters = [os.path.join(raster_ws, r) for r in arcpy.ListRasters()]

arcpy.env.workspace = shp_ws
shapes = [os.path.join(shp_ws, s) for s in arcpy.ListFeatureClasses()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# get dictionary {raster1 : shapefile1.shp, ...}
clip_dict = dict(zip(rasters, shapes))

# clip all rasters
outputList = []
for raster, shapefile in clip_dict.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_raster = os.path.join(out_ws, os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(raster, "", out_raster, shapefile, "", "ClippingGeometry", "NO_MAINTAIN_EXTENT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Clipped {0}'.format(os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; outputList.append(out_raster)

# output list is already a list, so no need to wrap it in [ ]
sumRaster = CellStatistics(outputList, "SUM", "DATA")
sumRaster.save(r'E:\Test_awd')
print "Created Sum Raster"
arcpy.CheckInExtension('Spatial')
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:10:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194310#M14905</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T16:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194311#M14906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried revising the code this morning and run it again, but the process is stuck on sumRaster = CellStatistics(ouputList, "SUM", "DATA"). Is this an indication that we cannot use list of raster values in Cellstatistics function?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is the revised code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os, sys
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
arcpy.CheckInExtension("Spatial")

raster_ws = r'E:\Test_awd\Criteria_SP_2mm_v2'
shp_ws = r'E:\Test_awd\Season1'

# output workspace
out_ws = r'E:\Test_awd'

# get lists
arcpy.env.workspace = raster_ws
rasters = [os.path.join(raster_ws, r) for r in arcpy.ListRasters()]

arcpy.env.workspace = shp_ws
shapes = [os.path.join(shp_ws, s) for s in arcpy.ListFeatureClasses()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# get dictionary {raster1 : shapefile1.shp, ...}
clip_dict = dict(zip(rasters, shapes))

# clip all rasters
outputList = []
for raster, shapefile in clip_dict.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_raster = os.path.join(out_ws, os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(raster, "", out_raster, shapefile, "", "ClippingGeometry", "NO_MAINTAIN_EXTENT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Clipped {0}'.format(os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; outputList.append(out_raster)

for raster in outputList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; sumRaster = CellStatistics(outputList, "SUM", "DATA")
&amp;nbsp;&amp;nbsp;&amp;nbsp; sumRaster.save(r'E:\Test_awd\test.tif')
print "Created Sum Raster"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the code that I am getting:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "E:\Python_scripts\Clip\rasterClip_with_cellstats.py", line 32, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sumRaster = CellStatistics(outputList, "SUM", "DATA")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\sa\Functions.py", line 2931, in CellStatistics&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ignore_nodata)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\sa\Utils.py", line 47, in swapper&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = wrapper(*args, **kwargs)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\sa\Functions.py", line 2927, in Wrapper&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [function] + Utils.flattenLists(in_rasters_or_constants))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: ERROR 000824: The tool is not licensed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to use cell statistics in a separate code, and it works. Hence, my question on using list of rasters as input in Cellstatistics. The code looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
from arcpy.sa import *

env.workspace = r'E:\Test_awd\output'

Raster01 = "RE_suitable_dek001.tif"
Raster02 = "RE_suitable_dek002.tif"
Raster03 = "RE_suitable_dek003.tif"
Raster04 = "RE_suitable_dek004.tif"
Raster05 = "RE_suitable_dek005.tif"

arcpy.CheckOutExtension("Spatial")

outCellStatistics = CellStatistics([Raster01, Raster02, Raster03, Raster04, Raster05], "SUM", "DATA")
outCellStatistics.save(r'E:\Test_awd\output.tif')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the code is working okay, but get stuck with the line &amp;gt;&amp;gt;&amp;gt; sumRaster = CellStatistics(outputList, "SUM", "DATA")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:44:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194311#M14906</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2021-12-11T09:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194312#M14907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Leo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you say "stuck on the the sum raster process" what do you mean? If it just looks unresponsive that is probably because you are running this analysis on 37 rasters, so this could take a long time depending on the resolution of your rasters. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;I tried revising the code this morning and run it again, but the process is stuck on sumRaster = CellStatistics(ouputList, "SUM", "DATA"). Is this an indication that we cannot use list of raster values in Cellstatistics function?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;I do not think this is the case...From the &lt;A href="&amp;lt;/span&amp;gt;&amp;lt;a" target="_blank" rel="nofollow noopener noreferrer"&gt;tool" rel="nofollow" target="_blank"&amp;gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//009z0000007q000000]tool&lt;/A&gt;&lt;SPAN&gt; help documents:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;SPAN style="font-family:Courier New;"&gt;[in_raster_or_constant,...] A &lt;STRONG&gt;list of input rasters&lt;/STRONG&gt; for which a statistic will be calculated for each cell within the Analysis window.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# output list is already a list, so no need to wrap it in [ ]
sumRaster = CellStatistics(outputList, "SUM", "DATA")
sumRaster.save(r'E:\Test_awd')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Should be correct because it is passing in a list of rasters for the sum analysis.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This part of your code is &lt;/SPAN&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;SPAN&gt; correct: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# you do not want to have this in a loop, remove the for loop
&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;for raster in outputList:&lt;/SPAN&gt; # take this out
&amp;nbsp;&amp;nbsp;&amp;nbsp; sumRaster = CellStatistics(outputList, "SUM", "DATA")
&amp;nbsp;&amp;nbsp;&amp;nbsp; sumRaster.save(r'E:\Test_awd\test.tif')
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;because you are running the the cell statistics on the entire list of rasters for every iteration of your list (which would be 37 times if there are still 37 rasters in your list). You are also overwriting the test.tif every time as well. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, judging from your error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;Traceback (most recent call last):&amp;nbsp; &lt;BR /&gt;File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript&amp;nbsp; &lt;BR /&gt;exec codeObject in __main__.__dict__&amp;nbsp; &lt;BR /&gt;File "E:\Python_scripts\Clip\rasterClip_with_cellstats.py", line 32, in &amp;lt;module&amp;gt;&amp;nbsp; &lt;BR /&gt;sumRaster = CellStatistics(outputList, "SUM", "DATA")&amp;nbsp; &lt;BR /&gt;File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\sa\Functions.py", line 2931, in CellStatistics&amp;nbsp; &lt;BR /&gt;ignore_nodata)&amp;nbsp; &lt;BR /&gt;File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\sa\Utils.py", line 47, in swapper&amp;nbsp; &lt;BR /&gt;result = wrapper(*args, **kwargs)&amp;nbsp; &lt;BR /&gt;File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\sa\Functions.py", line 2927, in Wrapper&amp;nbsp; &lt;BR /&gt;[function] + Utils.flattenLists(in_rasters_or_constants))&amp;nbsp; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;RuntimeError: ERROR 000824: The tool is not licensed.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os, sys
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;arcpy.CheckInExtension("Spatial")&amp;nbsp; &lt;/SPAN&gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The line highlighted in red needs to be changed to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.CheckOutExtension("Spatial")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because you were checking the license in &lt;/SPAN&gt;&lt;STRONG&gt;before&lt;/STRONG&gt;&lt;SPAN&gt; running the tool, therefore you were now allowing access to spatial analyst tools. The full code I supplied in my last post should do the trick. I would suggest trying that and if it is hanging up on the sum statistics part, try running that as a separate script.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:44:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194312#M14907</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T09:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194313#M14908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your great help. The problem with the code is the loop in the cell statistics portion and the arcpy.CheckInExtension("Spatial). I changed the code as you suggested and it worked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am sharing the final code so other users can use it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, thanks for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os, sys
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension("Spatial")

raster_ws = r'C:\raster\folderpath'
shp_ws = r'E:\shapefile\folderpath'

# output workspace
out_ws = r'C:\outputpath'

# get lists
arcpy.env.workspace = raster_ws
rasters = [os.path.join(raster_ws, r) for r in arcpy.ListRasters()]

arcpy.env.workspace = shp_ws
shapes = [os.path.join(shp_ws, s) for s in arcpy.ListFeatureClasses()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# get dictionary {raster1 : shapefile1.shp, ...}
clip_dict = dict(zip(rasters, shapes))

# clip all rasters
outputList = [] # container
for raster, shapefile in clip_dict.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_raster = os.path.join(out_ws, os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(raster, "", out_raster, shapefile, "", "ClippingGeometry", "NO_MAINTAIN_EXTENT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Clipped {0}'.format(os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; outputList.append(out_raster) # aopend all the output to the container

# compute the sum of all rasters with ignore no data option
sumRaster = CellStatistics(outputList, "SUM", "DATA")
sumRaster.save(r'C\outputpath\ofsumrasters.tif') # remove .tif if GRID format is desired
print "Created Sum Raster"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:44:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194313#M14908</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2021-12-11T09:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194314#M14909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry again for this request. I am again needed for some assistance in completing the python code that I need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the code that we completed before, I am trying to reiterate the resulting raster (one raster only) to multiple shapefiles (provinces).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added some code below, but I am having an error, i.e.,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "E:\Python_scripts\Clip\clip_raster_with_multifeatures_v2.py", line 46, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(sumRaster, "", out_prov, fc, "", "clippingGeometry", "NO_MAINTAIN_EXTENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 12803, in Clip&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000445: Extension is invalid for the output raster format.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Clip).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the error is something to do with the filename.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is the code the modified code that I am trying to run:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os, sys
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension("Spatial")
arcpy.env.workspace = r'E:\output_workspace'
arcpy.env.extent = "MAXOF"

raster_ws = r'E:\raster_workspace'
shp_ws = r'E:\shape_workspace'

# output workspace
out_ws = r'E:\output_workspace'

# get lists
arcpy.env.workspace = raster_ws
rasters = [os.path.join(raster_ws, r) for r in arcpy.ListRasters()]

arcpy.env.workspace = shp_ws
shapes = [os.path.join(shp_ws, s) for s in arcpy.ListFeatureClasses()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# get dictionary {raster1 : shapefile1.shp, ...}
clip_dict = dict(zip(rasters, shapes))

# clip all rasters
outputList = [] # container
for raster, shapefile in clip_dict.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_raster = os.path.join(out_ws, os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(raster, "", out_raster, shapefile, "", "ClippingGeometry", "NO_MAINTAIN_EXTENT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Clipped {0}'.format(os.path.basename(raster))
&amp;nbsp;&amp;nbsp;&amp;nbsp; outputList.append(out_raster) # append all the output to the container

# compute the sum of all rasters with ignore no data option
sumRaster = CellStatistics(outputList, "SUM", "DATA")
sumRaster.save(r'E:\output_workspace\output.tif')
print "Created Sum Raster"

# clip sumRaster with shapefiles
province = r'E:\workspace_of_shapefiles_per_province'

# Process: Iterate Feature Classes
arcpy.env.workspace = province
fcList = [os.path.join(province, p) for p in arcpy.ListFeatureClasses()] # Get list
for fc in fcList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_prov = os.path.join(out_ws, os.path.basename(fc))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(sumRaster, "", out_prov, fc, "", "clippingGeometry", "NO_MAINTAIN_EXTENT")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks very much,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:44:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194314#M14909</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2021-12-11T09:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194315#M14910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am almost corrected the code. It seems to work properly. But my problem is the naming of the file. I am having trouble removing the .shp extension in my features list. For instance my filename input is &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;out_prov + "clip.tif"&lt;/SPAN&gt;&lt;SPAN&gt;. When it saved the file it carries the .shp extension name of my feature list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the output file name that I get: &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;province.shpclip.tif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I like to have is &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;provinceclip.tif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the last 10 lines of the code that I am using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# clip sumRaster with shapefiles
province = r'E:\path\province_shapefiles'

# Process: Iterate Feature Classes
arcpy.env.workspace = province
fcList = [os.path.join(province, p) for p in arcpy.ListFeatureClasses()] # Get list
for fc in fcList: # clip the sumRaster with all the shapefiles in the folder
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_prov = os.path.join(out_ws, os.path.basename(fc))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(sumRaster, "", out_prov + "clip.tif", fc, "", "clippingGeometry", "NO_MAINTAIN_EXTENT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "scoring maps clipped by province"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:44:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194315#M14910</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2021-12-11T09:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194316#M14911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Leo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try changing the line in red:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# clip sumRaster with shapefiles
province = r'E:\path\province_shapefiles'

# Process: Iterate Feature Classes
arcpy.env.workspace = province
fcList = [os.path.join(province, p) for p in arcpy.ListFeatureClasses()] # Get list
for fc in fcList: # clip the sumRaster with all the shapefiles in the folder
&amp;nbsp;&amp;nbsp; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt; out_prov = os.path.join(out_ws, os.path.splitext(os.path.basename(fc))[0])&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(sumRaster, "", out_prov + "clip.tif", fc, "", "clippingGeometry", "NO_MAINTAIN_EXTENT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "scoring maps clipped by province"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Also, you should mark this thread as answered to let others know your issue has been resolved. If you do not know how, see this [url=&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/forums-mvp/]page[/url" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/forums-mvp/]page[/url&lt;/A&gt;&lt;SPAN&gt;].&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:44:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194316#M14911</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T09:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194317#M14912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry for this late reply. Why is it in the thread there is no option to mark the reply as best (check mark). I can only vote your reply but not mark it as best to signify that my query has been resolved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Leo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 00:58:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/194317#M14912</guid>
      <dc:creator>Leo_KrisPalao</dc:creator>
      <dc:date>2014-06-10T00:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Raster Clipping</title>
      <link>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/1476493#M70630</link>
      <description>&lt;P&gt;Even though your suggestion was posted 10 years ago, this worked great for me! I was pulling my hair out trying to get a sub-model with an iterator to work within a model that also had an iterator, but your suggestion was so much easier to implement. Brilliant workaround.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 19:38:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-raster-clipping/m-p/1476493#M70630</guid>
      <dc:creator>CharlottePeters95540</dc:creator>
      <dc:date>2024-05-21T19:38:22Z</dc:date>
    </item>
  </channel>
</rss>

