<?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: populate a field in a raster dataset based on the total SUM of another field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358010#M28284</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi JSkinn3 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Excellent!!. It works perfectly. Thanks a lot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Jul 2011 08:26:43 GMT</pubDate>
    <dc:creator>KhanKamruzzaman</dc:creator>
    <dc:date>2011-07-18T08:26:43Z</dc:date>
    <item>
      <title>populate a field in a raster dataset based on the total SUM of another field</title>
      <link>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358006#M28280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have multiple land-use land-cover raster layers, of which the attribute tables have a field on the total area coverage by different land-use type (field name is AREA). My goal is to have another column populated with the percentage area coverage for the each land-use land cover type in the rate dataset. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to do this by populating another column in the same attribute table with the summation (total summation, not cumulative summation) of AREA. If I could get this column, I can write a simple expression in the "calculate field tool" to calculate the percentage coverage. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have nearly 100 raster layers with different geometric shapes so that I need to do this via model builder. Since this is an iterative process, calculating the column sum by the "calculate statistics tool" in not useful either. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have a tool or a python script for this? I am using ArcGIS 10. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thilina&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2011 00:25:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358006#M28280</guid>
      <dc:creator>ThilinaSurasinghe</dc:creator>
      <dc:date>2011-05-04T00:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: populate a field in a raster dataset based on the total SUM of another field</title>
      <link>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358007#M28281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is an example on how you can sum the Area field into a new field (SUM_Area).&amp;nbsp; From there you can calculate the percentage.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;list = []

lstRasters = arcpy.ListRasters("*")
for raster in lstRasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(raster)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(row.Area)
&amp;nbsp;&amp;nbsp;&amp;nbsp; S = sum(list)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(raster, "SUM_Area", S)
&amp;nbsp;&amp;nbsp;&amp;nbsp; list = []

del row, rows&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:44:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358007#M28281</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T16:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: populate a field in a raster dataset based on the total SUM of another field</title>
      <link>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358008#M28282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi JSkinn3,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a similar kind of question like tdilan1980 . I want summarise a field of my table and update the output into another field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I know how to do in python window but don�??t know how to do it in �??Filed Calculator window in ArcMap table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Specially, how do you write a code for "arcpy.SearchCursor" function in their?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be highly appreciable?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jul 2011 23:51:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358008#M28282</guid>
      <dc:creator>KhanKamruzzaman</dc:creator>
      <dc:date>2011-07-04T23:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: populate a field in a raster dataset based on the total SUM of another field</title>
      <link>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358009#M28283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Below is an example on how you can do this using the Field Calculator.&amp;nbsp; Be sure to check 'Python' at the top and 'Show Codeblock'.&amp;nbsp; Under 'Pre-logic Script Code' enter the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def update():
&amp;nbsp; import arcpy
&amp;nbsp; list = []
&amp;nbsp; rows = arcpy.SearchCursor(r"C:\data\Parcels")
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(row.AREA)
&amp;nbsp; S = sum(list)
&amp;nbsp; del row, rows
&amp;nbsp; rows = arcpy.UpdateCursor(r"C:\data\Parcels")
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.AREA2 = S
&amp;nbsp;&amp;nbsp;&amp;nbsp; val = row.AREA2
&amp;nbsp; del row, rows
&amp;nbsp; return val&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, under the second block enter:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;update()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358009#M28283</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T16:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: populate a field in a raster dataset based on the total SUM of another field</title>
      <link>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358010#M28284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi JSkinn3 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Excellent!!. It works perfectly. Thanks a lot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jul 2011 08:26:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/populate-a-field-in-a-raster-dataset-based-on-the/m-p/358010#M28284</guid>
      <dc:creator>KhanKamruzzaman</dc:creator>
      <dc:date>2011-07-18T08:26:43Z</dc:date>
    </item>
  </channel>
</rss>

