<?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 Zonal Statistics as table not working using Arcpy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/zonal-statistics-as-table-not-working-using-arcpy/m-p/1267402#M66588</link>
    <description>&lt;P&gt;I have been trying to calculate the mean value of each band in a multiband raster to a feature class as once using zonal statistics as table in arcpy environment. At present my multiband raster do have 36 bands, and i am successfully able to iterate over it but don't know why it is getting failed at Zonal statistics execution time. The code is attached below:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;import arcpy&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;import os&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;from arcpy import env&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;from arcpy.sa import *&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;env.workspace = r'X:\600_POINT_DATA\Layerstack\layerstack_2017.img'&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;raslist = arcpy.ListRasters()&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;for ras in raslist:&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;out_table = os.path.join(env.workspace, ras + '_tab')&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;arcpy.gp.ZonalStatisticsAsTable_sa('Village_1', 'key', ras, out_table, 'NODATA', 'MEAN')&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Error:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;EM&gt;&lt;STRONG&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 9, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (&lt;A href="http://esriurl.com/support" target="_blank" rel="noopener"&gt;http://esriurl.com/support&lt;/A&gt;) to Report a Bug, and refer to the error help for potential solutions or workarounds.&lt;BR /&gt;Failed to execute (ZonalStatisticsAsTable).&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Mar 2023 04:40:13 GMT</pubDate>
    <dc:creator>ShubhamBhatia</dc:creator>
    <dc:date>2023-03-14T04:40:13Z</dc:date>
    <item>
      <title>Zonal Statistics as table not working using Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/zonal-statistics-as-table-not-working-using-arcpy/m-p/1267402#M66588</link>
      <description>&lt;P&gt;I have been trying to calculate the mean value of each band in a multiband raster to a feature class as once using zonal statistics as table in arcpy environment. At present my multiband raster do have 36 bands, and i am successfully able to iterate over it but don't know why it is getting failed at Zonal statistics execution time. The code is attached below:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;import arcpy&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;import os&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;from arcpy import env&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;from arcpy.sa import *&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;env.workspace = r'X:\600_POINT_DATA\Layerstack\layerstack_2017.img'&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;raslist = arcpy.ListRasters()&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;for ras in raslist:&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;out_table = os.path.join(env.workspace, ras + '_tab')&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;arcpy.gp.ZonalStatisticsAsTable_sa('Village_1', 'key', ras, out_table, 'NODATA', 'MEAN')&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Error:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;EM&gt;&lt;STRONG&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 9, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (&lt;A href="http://esriurl.com/support" target="_blank" rel="noopener"&gt;http://esriurl.com/support&lt;/A&gt;) to Report a Bug, and refer to the error help for potential solutions or workarounds.&lt;BR /&gt;Failed to execute (ZonalStatisticsAsTable).&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 04:40:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/zonal-statistics-as-table-not-working-using-arcpy/m-p/1267402#M66588</guid>
      <dc:creator>ShubhamBhatia</dc:creator>
      <dc:date>2023-03-14T04:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Zonal Statistics as table not working using Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/zonal-statistics-as-table-not-working-using-arcpy/m-p/1267406#M66590</link>
      <description>&lt;P&gt;instead of&amp;nbsp;&lt;/P&gt;&lt;P&gt;arcpy.gp.ZonalStatisticsAsTable_sa&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;ZonalStatisticsAsTable&lt;/P&gt;&lt;P&gt;since you imported everthing using&amp;nbsp;&lt;/P&gt;&lt;P&gt;from arcpy.sa import *&lt;/P&gt;&lt;P&gt;check the tool requirememts&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-analyst/zonal-statistics-as-table.htm" target="_blank"&gt;Zonal Statistics as Table (Spatial Analyst)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and throw in a print statement to see if you are getting the right output file names&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The format of the table is determined by the output location and path. By default, the output will be a geodatabase table if in a geodatabase workspace, and a dBASE table if in a file workspace.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;and if you are going to skip optional parameters, then you should provide the default value or use named parameters instead&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 05:17:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/zonal-statistics-as-table-not-working-using-arcpy/m-p/1267406#M66590</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-03-14T05:17:29Z</dc:date>
    </item>
  </channel>
</rss>

