<?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 Re: Zonal statistics for raster using a matching mask file in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163885#M2335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you are working with Shapefiles, the name will be &amp;lt;name&amp;gt;.shp.&amp;nbsp; The split method splits the shapefile name at the period and returns two values "&amp;lt;name&amp;gt;" and "shp" in a list.&amp;nbsp; The [0] indicates to return the first value in the list.&amp;nbsp; The same is true when dealing with a raster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "*" is a wildcard and will return all results when searching for shapefiles or rasters.&amp;nbsp; If you just wanted to find a shapefile that began with "Pa", you could use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14223749215721707 jive_text_macro" jivemacro_uid="_14223749215721707"&gt;&lt;P&gt;shapefiles = arcpy.ListFeatureClasses(&lt;SPAN class="string"&gt;"Pa*", &lt;SPAN class="string"&gt;"Polygon"&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="string"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Jan 2015 16:08:14 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2015-01-27T16:08:14Z</dc:date>
    <item>
      <title>Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163879#M2329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again GeoNet community!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question and the answer may involve script. Just a warning, I have very rarely dealt with scripting and so if the answer is a script code then I may need some extra guidance. Anyway, my problem is this:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have about 1300 raster layers that I need to iterate through. For each raster layer, I need to run zonal statistics using a polygon layer. Each polygon layer corresponds to each raster in space and they also have the same file name (i.e. the raster name is 110_10R and the polygon file name is 110_10R as well, they are just saved in different folders. How can I make it so that 110_10R (raster) uses 110_10R (polygon) for its zonal statistics? Remember this needs to iterate 1300 times (actually 1300 x 12) so it needs to be 110_10R (raster) with 110_10R (polygon) then it moves on a runs 111_10R (raster) with 111_10R (polygon)...etc...&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Remember, scripting novice, but I realize that it may be the only way to solve this issue&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 13:19:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163879#M2329</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-27T13:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163880#M2330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Morgan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where are the polygon feature classes/shapefiles located?&amp;nbsp; Are they in the same directory as the rasters with the same name?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 15:26:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163880#M2330</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-01-27T15:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163881#M2331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They are not in geodatabases or anything. They are just in different folders the pathnames may help you visualize how it is arranged in the directory?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rasters:&lt;/P&gt;&lt;P&gt;C:\Users\AmyShipley\Desktop\Offline_2014_GIS\Exposure_Height&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Polygons:&lt;/P&gt;&lt;P&gt;C:\Users\AmyShipley\Desktop\Offline_2014_GIS\shp_files\Distance_Buffers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 15:31:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163881#M2331</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-27T15:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163882#M2332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like below should get you started:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
from arcpy import env
from arcpy.sa import *

rasterWorkspace = r"C:\Users\AmyShipley\Desktop\Offline_2014_GIS\Exposure_Height"
polygonWorkspace = r"C:\Users\AmyShipley\Desktop\Offline_2014_GIS\shp_files\Distance_Buffers"

env.workspace = polygonWorkspace
shapefiles = arcpy.ListFeatureClasses("*", "Polygon")

env.workspace = rasterWorkspace
rasters = arcpy.ListRasters("*", "TIF")

for shapefile in shapefiles:
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapefileName = shapefile.split(".")[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; for raster in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rasterName = raster.split(".")[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if rasterName == shapefileName:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outZonalStats = ZonalStatistics(shapefileName, "value", rasterName, "SUM", "DATA")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outZonalStats.save("zoneStats_" + shapefileName)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above code will iterate through the raster workspace and find all TIFF files.&amp;nbsp; If you are working with a different raster type, take a look at the &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/listrasters.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;ListRasters &lt;/A&gt;to change to the correct type, or simply remove "TIF" to use all rasters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:35:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163882#M2332</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T08:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163883#M2333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great! Thanks, I will work with this and see what I can do with it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 15:55:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163883#M2333</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-27T15:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163884#M2334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, one question before I get started working with this. After shapefile.split, what does (".") mean? Also, what should fill in the (" * ") space when defining the workspace? Does that stay as an asterisk so that it iterates through?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 16:02:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163884#M2334</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-27T16:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163885#M2335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you are working with Shapefiles, the name will be &amp;lt;name&amp;gt;.shp.&amp;nbsp; The split method splits the shapefile name at the period and returns two values "&amp;lt;name&amp;gt;" and "shp" in a list.&amp;nbsp; The [0] indicates to return the first value in the list.&amp;nbsp; The same is true when dealing with a raster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "*" is a wildcard and will return all results when searching for shapefiles or rasters.&amp;nbsp; If you just wanted to find a shapefile that began with "Pa", you could use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14223749215721707 jive_text_macro" jivemacro_uid="_14223749215721707"&gt;&lt;P&gt;shapefiles = arcpy.ListFeatureClasses(&lt;SPAN class="string"&gt;"Pa*", &lt;SPAN class="string"&gt;"Polygon"&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="string"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 16:08:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163885#M2335</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-01-27T16:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163886#M2336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, great, thanks for describing those for me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 16:17:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163886#M2336</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-27T16:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163887#M2337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I've been trying to work with this code, but I must be doing something wrong. I have filled in the spaces with my own information and everything seems good to go, but when I hit enter nothing really happens. It doesn't give me errors or anything, but it also seems like it isn't doing anything.&amp;nbsp; I have some specific questions below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) When I look at my raster files outside of arcmap they are each their own folder and have many files inside each folder that are .adf. Could this be a problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Is there a way to define where the data saves, and where is it saving right now so I can see if it did anything?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 13:48:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163887#M2337</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-30T13:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163888#M2338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1)&amp;nbsp; It appears you are working with ESRI GRIDs.&amp;nbsp; You will want to change:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;rasters = arcpy.ListRasters(&lt;SPAN class="string"&gt;"*", &lt;SPAN class="string"&gt;"TIF"&lt;/SPAN&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="string"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="string"&gt;to:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="string"&gt;rasters = arcpy.ListRasters(&lt;SPAN class="string"&gt;"*", &lt;SPAN class="string"&gt;"GRID"&lt;/SPAN&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="string"&gt;&lt;SPAN class="string"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; The rasters are saving to your env.workspace.&amp;nbsp; You set this to your rasterWorkspace variable.&amp;nbsp; So, the rasters should save here once once you make the change mentioned above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, it's helpful to add print statements throughout your code.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for shapefile in shapefiles:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapefileName = shapefile.split(".")[0]&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print shapefileName
&amp;nbsp;&amp;nbsp;&amp;nbsp; for raster in rasters:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rasterName = raster.split(".")[0]&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print rasterName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if rasterName == shapefileName:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outZonalStats = ZonalStatistics(shapefileName, "value", rasterName, "SUM", "DATA")&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Saving raster"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outZonalStats.save("zoneStats_" + shapefileName) &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:35:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163888#M2338</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T08:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163889#M2339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry if I'm being a hassle! I converted some of my rasters to TIF just to mess with before I got your reply and have been just trying to get this to run, but I am getting the error shown below that says my input value raster isn't the right format or doesn't exist. The script is a little different since I have tweaked some things, but if you could take a look and see if you can tell what the problem is that would be great!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy, os&amp;nbsp; &lt;/P&gt;&lt;P&gt;... from arcpy import env&amp;nbsp; &lt;/P&gt;&lt;P&gt;... from arcpy.sa import *&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;... rasterWorkspace = r"C:\Users\AmyShipley\Desktop\Offline_2014_GIS\Exp_Height_test_TIFF"&amp;nbsp; &lt;/P&gt;&lt;P&gt;... polygonWorkspace = r"C:\Users\AmyShipley\Desktop\Offline_2014_GIS\shp_files\Distance_Buffers\Span_IDx10m_test_group"&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;... env.workspace = polygonWorkspace&amp;nbsp; &lt;/P&gt;&lt;P&gt;... shapefiles = arcpy.ListFeatureClasses("*", "Polygon")&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;... env.workspace = rasterWorkspace&amp;nbsp; &lt;/P&gt;&lt;P&gt;... rasters = arcpy.ListRasters("*", "TIF")&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;... for shapefile in shapefiles:&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shapefileName = shapefile.split(".")[0]&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for raster in rasters:&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rasterName = raster.split(".")[0]&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if rasterName == shapefileName:&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outZonalStats = ZonalStatistics(shapefileName, "FID", rasterName, "MINIMUM", "DATA")&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outZonalStats.save("zs_" + shapefileName)&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 19, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\sa\Functions.py", line 6145, in ZonalStatistics&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ignore_nodata)&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\sa\Utils.py", line 47, in swapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = wrapper(*args, **kwargs)&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\sa\Functions.py", line 6138, in Wrapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ignore_nodata)&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 498, in &amp;lt;lambda&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return lambda *args: val(*gp_fixargs(args, True)) ExecuteError: Failed to execute. Parameters are not valid. ERROR 000860: Input value raster: is not the type of Composite Geodataset, or does not exist. Failed to execute (ZonalStatistics).&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 15:18:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163889#M2339</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-30T15:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163890#M2340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add some print statements as shown previously.&amp;nbsp; It looks like it is failing when trying to run the ZonalStatistics for the intended raster.&amp;nbsp; We will need to see what raster is being passed to this function.&amp;nbsp; Adding "print rasterName" under "rasterName = raster.split(".")[0]" should help with this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 15:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163890#M2340</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-01-30T15:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163891#M2341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added the print statements and it printed 10_100l for both shapefileName and rasterName, but then I still get the same error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy, os&amp;nbsp; &lt;/P&gt;&lt;P&gt;... from arcpy import env&amp;nbsp; &lt;/P&gt;&lt;P&gt;... from arcpy.sa import *&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;... rasterWorkspace = r"C:\Users\AmyShipley\Desktop\Offline_2014_GIS\Exp_Height_test_TIFF"&amp;nbsp; &lt;/P&gt;&lt;P&gt;... polygonWorkspace = r"C:\Users\AmyShipley\Desktop\Offline_2014_GIS\shp_files\Distance_Buffers\Span_IDx10m_test_group"&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;... env.workspace = polygonWorkspace&amp;nbsp; &lt;/P&gt;&lt;P&gt;... shapefiles = arcpy.ListFeatureClasses("*", "Polygon")&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;... env.workspace = rasterWorkspace&amp;nbsp; &lt;/P&gt;&lt;P&gt;... rasters = arcpy.ListRasters("*", "TIF")&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;... for shapefile in shapefiles:&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shapefileName = shapefile.split(".")[0]&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print shapefileName&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for raster in rasters:&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rasterName = raster.split(".")[0]&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print rasterName&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if rasterName == shapefileName:&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outZonalStats = ZonalStatistics(shapefileName, "FID", rasterName, "MINIMUM", "DATA")&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Saving raster"&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outZonalStats.save("zs_" + shapefileName)&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;10_100l&lt;/P&gt;&lt;P&gt;10_100l&lt;/P&gt;&lt;P&gt;Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 21, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\sa\Functions.py", line 6145, in ZonalStatistics&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ignore_nodata)&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\sa\Utils.py", line 47, in swapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = wrapper(*args, **kwargs)&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\sa\Functions.py", line 6138, in Wrapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ignore_nodata)&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 498, in &amp;lt;lambda&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return lambda *args: val(*gp_fixargs(args, True)) ExecuteError: Failed to execute. Parameters are not valid. ERROR 000860: Input value raster: is not the type of Composite Geodataset, or does not exist. Failed to execute (ZonalStatistics).&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 15:42:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163891#M2341</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-30T15:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163892#M2342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That was my mistake.&amp;nbsp; We will need to add the full path to the shapefile.&amp;nbsp; Replace the outZonalStats with the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14226333100834423" jivemacro_uid="_14226333100834423"&gt;&lt;P&gt;outZonalStats = ZonalStatistics(polygonWorkspace + os.sep + shapefile, "FID", rasterName, "MINIMUM", "DATA") &lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The os.sep is simply python for a backslash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 15:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163892#M2342</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-01-30T15:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal statistics for raster using a matching mask file</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163893#M2343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alright! Got it to work! I had to change the outZonalStats line to have the raster represented by the full path name too. I also ended up adding a line to get zonal stats as table and it worked out fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 16:59:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/zonal-statistics-for-raster-using-a-matching-mask/m-p/163893#M2343</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2015-01-30T16:59:45Z</dc:date>
    </item>
  </channel>
</rss>

