<?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: Calculating Field with Python problem in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498477#M16583</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the button is greyed out and the table says 0 records selected.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Oct 2011 11:13:11 GMT</pubDate>
    <dc:creator>RaphaelR</dc:creator>
    <dc:date>2011-10-24T11:13:11Z</dc:date>
    <item>
      <title>Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498473#M16579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i just came across something odd:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i tried calculating fields with python and noticed that lots of records don´t get calculated when i try to divide something.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so to test this, nothing was selected, and i just entered 1 / 2. some records correctly showed 0.2 but many still showed 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;when i tried 1+1 all records show 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;switching to vbscript also helped.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 09:17:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498473#M16579</guid>
      <dc:creator>RaphaelR</dc:creator>
      <dc:date>2011-10-24T09:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498474#M16580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You might have bigger problems ... 1/2 isn't 0.2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I suspect you did 1/5, in any event, you performed integer division if one or both of your values weren't floating point ie, in Python&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; print 1/5
0
&amp;gt;&amp;gt;&amp;gt; print 1/5.0
0.2
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:54:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498474#M16580</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T21:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498475#M16581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You might have bigger problems ... 1/2 isn't 0.2&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;lol, yes i meant 1/5.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but still if i add a field (type double) and try to do a field calculation as mentioned above, shouldn´t all the records be calculated in the same way?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 10:16:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498475#M16581</guid>
      <dc:creator>RaphaelR</dc:creator>
      <dc:date>2011-10-24T10:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498476#M16582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would actually click on the Clear Selected Features button to ensure that you have no selected records, don't rely on visuals&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 11:07:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498476#M16582</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-10-24T11:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498477#M16583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the button is greyed out and the table says 0 records selected.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 11:13:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498477#M16583</guid>
      <dc:creator>RaphaelR</dc:creator>
      <dc:date>2011-10-24T11:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498478#M16584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have never seen that behaviour before, nor have I seen it reported.&amp;nbsp; Does it occur in other files?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 16:18:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498478#M16584</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-10-24T16:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498479#M16585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think Dan's original answer still applies here even though you are using Double fields to perform this calculation it is still possible that the 2 values you are dividing are both integers. Try this calculation instead:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;float(!field1!)/!field2!&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will ensure that you are always using float values in your calculation.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 23:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498479#M16585</guid>
      <dc:creator>ChrisFox3</dc:creator>
      <dc:date>2011-10-24T23:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498480#M16586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thank you both for your suggestions, in the future i´ll try to be a bit more exact with specifiying what want to calculate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in the meantime i found out that the shapefile i did the calculations with was created with another software (VISUM, a traffic modelling program), maybe that´s the reason. i also couldn´t reproduce this with a couple of other arcgis-created shapefiles.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Oct 2011 05:42:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498480#M16586</guid>
      <dc:creator>RaphaelR</dc:creator>
      <dc:date>2011-10-25T05:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Field with Python problem</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498481#M16587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was using the Raster Calculator tool in ArcToolBox.&amp;nbsp; I used the NDVI formula:&amp;nbsp;&amp;nbsp; (NIR - Red) / (NIR + Red) and instead of getting a range of DN values in the resulting raster between -1 and +1, I got only the integer values of -1, 0, 1.&amp;nbsp; In searching ESRI Help, I figured out that the software was interpreting the input raster DN values as integers, so the output would be in integers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I saw the code that you showed - thank you!&amp;nbsp; It gave me the idea to incorporate the 'Float' function into the formula in ArcToolBox's Raster Calculator tool.&amp;nbsp; It worked!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Dec 2012 00:46:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculating-field-with-python-problem/m-p/498481#M16587</guid>
      <dc:creator>CharlesNichols1</dc:creator>
      <dc:date>2012-12-31T00:46:23Z</dc:date>
    </item>
  </channel>
</rss>

