<?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: If Then field calculation using Python in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/if-then-field-calculation-using-python/m-p/1419087#M82790</link>
    <description>&lt;P&gt;Zonal Statistics As Table. Statistic = SUM as sum of 1's == the count of 1's.&amp;nbsp; &amp;nbsp;Alternatively, SetNull with&amp;nbsp;&lt;SPAN&gt;Slope &amp;lt;= 25, 1 then you'll have 1's and NoData so Zonal Stats count will be just of the 1's.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 05 May 2024 10:47:35 GMT</pubDate>
    <dc:creator>Luke_Pinner</dc:creator>
    <dc:date>2024-05-05T10:47:35Z</dc:date>
    <item>
      <title>If Then field calculation using Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/if-then-field-calculation-using-python/m-p/1418974#M82770</link>
      <description>&lt;P&gt;I am evaluating a set of tax lots (polygons) to calculate how much land of each has a slope greater than 25%. Here's what I've done so far:&lt;/P&gt;&lt;P&gt;1. DEM raster to Slope raster&lt;/P&gt;&lt;P&gt;2. 'Greater Than' to produce a boolean raster based on Slope &amp;gt; 25.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I now need to count how many '1' cells (areas over 25% slope) from the boolean raster are within each tax lot polygon.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I tried using &lt;EM&gt;Zonal Statistics as Table&lt;/EM&gt; tool with the tax lot polygons as zones, but there doesn't seem to be a way to count '1' cells versus '0' cells. It returns a total count of all cells. My next thought was to add a new field and calculate it with an if/then statement related to the stats that&lt;EM&gt; were&lt;/EM&gt; generated, but I am not experienced with Python and can't seem to get the formula right. I was able to write this formula quickly in Excel, but I don't know how to translate it to Python. Also wondering if there is a better way to accomplish my goal.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The if/then statement I tried to write involves the following (in plain english), which would return the number of acres under 25% slope for each tax lot:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If MAJORITY equals MIN (i.e. 0, implying less than 25% slope), then calculate MAJORITY_PERCENT * mapacres.&lt;/LI&gt;&lt;LI&gt;If MAJORITY does not equal MIN (i.e. 1, implying over 25% slope), then calculate MINORITY_PERCENT * mapacres.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Sat, 04 May 2024 00:29:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/if-then-field-calculation-using-python/m-p/1418974#M82770</guid>
      <dc:creator>GG_CM</dc:creator>
      <dc:date>2024-05-04T00:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: If Then field calculation using Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/if-then-field-calculation-using-python/m-p/1419087#M82790</link>
      <description>&lt;P&gt;Zonal Statistics As Table. Statistic = SUM as sum of 1's == the count of 1's.&amp;nbsp; &amp;nbsp;Alternatively, SetNull with&amp;nbsp;&lt;SPAN&gt;Slope &amp;lt;= 25, 1 then you'll have 1's and NoData so Zonal Stats count will be just of the 1's.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2024 10:47:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/if-then-field-calculation-using-python/m-p/1419087#M82790</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2024-05-05T10:47:35Z</dc:date>
    </item>
  </channel>
</rss>

