<?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 Calculate field with Python 3 in ArcGIS Hub Questions</title>
    <link>https://community.esri.com/t5/arcgis-hub-questions/calculate-field-with-python-3/m-p/566024#M2901</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am working on wind data and am trying to reclassify the wmo_wind field into a new field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help because I cannot figure out why it is not valid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query is if the value in wmo_wind is as the values shown in pink circle, they will be reclassified to categories 1 to 5 respectively.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;def reclass (wmo_wind):
    if wmo_wind &amp;lt; 96:
        return '1'
    elif wmo_wind &amp;gt; 96 and &amp;lt; 111: 
        return '2'
    elif wmo_wind &amp;gt; 111 and &amp;lt; 130: 
        return '3'
    elif wmo_wind &amp;gt; 130 and &amp;lt; 157: 
        return '4'
    elif wmo_wind &amp;gt; 157: 
        return '5'&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 00:23:55 GMT</pubDate>
    <dc:creator>CalebSang</dc:creator>
    <dc:date>2021-12-12T00:23:55Z</dc:date>
    <item>
      <title>Calculate field with Python 3</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/calculate-field-with-python-3/m-p/566024#M2901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am working on wind data and am trying to reclassify the wmo_wind field into a new field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help because I cannot figure out why it is not valid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query is if the value in wmo_wind is as the values shown in pink circle, they will be reclassified to categories 1 to 5 respectively.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;def reclass (wmo_wind):
    if wmo_wind &amp;lt; 96:
        return '1'
    elif wmo_wind &amp;gt; 96 and &amp;lt; 111: 
        return '2'
    elif wmo_wind &amp;gt; 111 and &amp;lt; 130: 
        return '3'
    elif wmo_wind &amp;gt; 130 and &amp;lt; 157: 
        return '4'
    elif wmo_wind &amp;gt; 157: 
        return '5'&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:23:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/calculate-field-with-python-3/m-p/566024#M2901</guid>
      <dc:creator>CalebSang</dc:creator>
      <dc:date>2021-12-12T00:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate field with Python 3</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/calculate-field-with-python-3/m-p/566025#M2902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the actual error?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple of problems:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you perform a field calculation, the new value will be applied to all records.&amp;nbsp; Your logic as shown is better suited for an &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm"&gt;update cursor&lt;/A&gt; where you would be stepping through each record, applying the conditional to a single cursor row.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are returning a text type of value (as indicated by the quotes), yet you are treating the values as integers.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jun 2020 14:25:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/calculate-field-with-python-3/m-p/566025#M2902</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-06-04T14:25:26Z</dc:date>
    </item>
  </channel>
</rss>

