<?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: Raster Calculator to Map Algebra in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575694#M45101</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it fails, what is the error message.&lt;/P&gt;&lt;P&gt;If it were to work, then the you would probably want to add a stream_raster.save(… some path...)&lt;/P&gt;&lt;P&gt;It could be as simple as your model vs script not know the work environment and where files are coming from and going to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also the difference between .... outFlowAccum &amp;gt;= 150&amp;nbsp; and Darren's Con representation, is that yours will return a simple binary raster (0 or 1) and the Con variant will return 1 or the outFlowAccum.&amp;nbsp; You could simply replace that portion with a 0 to get the binary raster that you want to represent stream vs non-stream&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Oct 2018 02:01:17 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2018-10-25T02:01:17Z</dc:date>
    <item>
      <title>Raster Calculator to Map Algebra</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575692#M45099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a model that does a really simple Raster Calculator operation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;"%Output accumulation raster%"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;150&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's it.&amp;nbsp; I have been racking my brain trying to figure out how do I get this into a python script?&amp;nbsp; I have been looking at &lt;STRONG&gt;A Quick Tour of Using Map Algebra&lt;/STRONG&gt; and frankly I'm overwhelmed because I don't have bundles of time on my hands, and I'm just trying to do something very straightforward somewhat quickly.&amp;nbsp; I feel like I need to see a very specific, hand-holding, with reasons, example of taking this Raster Calculator expression and putting it into Python (3.6, ArcGIS Pro 2.2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Part of the code in question looks like this (yes, I'm using Spatial Analyst hydrology tools here):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;outfill &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Fill&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;raster&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

outFlowDirection &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; FlowDirection&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outfill&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NORMAL"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

outFlowAccum &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; FlowAccumulation&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outFlowDirection&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

stream_raster &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Raster&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outFlowAccum &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;150&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#this is the part that fails&lt;/SPAN&gt;
&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure this is really 101 but nevertheless, I'd appreciate any guidance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:47:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575692#M45099</guid>
      <dc:creator>EricEagle</dc:creator>
      <dc:date>2021-12-12T00:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator to Map Algebra</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575693#M45100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not exactly sure what the non-tool equivalent is, but I default to Con, something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;stream_raster &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Con&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outFlowAccum &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;150&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; outFlowAccum&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/con-.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/con-.htm"&gt;Con—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 21:06:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575693#M45100</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2018-10-24T21:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator to Map Algebra</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575694#M45101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it fails, what is the error message.&lt;/P&gt;&lt;P&gt;If it were to work, then the you would probably want to add a stream_raster.save(… some path...)&lt;/P&gt;&lt;P&gt;It could be as simple as your model vs script not know the work environment and where files are coming from and going to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also the difference between .... outFlowAccum &amp;gt;= 150&amp;nbsp; and Darren's Con representation, is that yours will return a simple binary raster (0 or 1) and the Con variant will return 1 or the outFlowAccum.&amp;nbsp; You could simply replace that portion with a 0 to get the binary raster that you want to represent stream vs non-stream&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 02:01:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575694#M45101</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-10-25T02:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator to Map Algebra</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575695#M45102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm, I think the Con will return the raster or nothing. If you want a full binary raster, use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;stream_raster &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; Con&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;outFlowAccum &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000; border: 0px; font-weight: inherit;"&gt;150&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; 1, 0&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 15:53:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575695#M45102</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2018-10-25T15:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator to Map Algebra</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575696#M45103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;used to numpy which gives binary automatically ( 0, 1 ) rather than whatever&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 16:02:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575696#M45103</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-10-25T16:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator to Map Algebra</title>
      <link>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575697#M45104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you just want a binary 1/0 True/False output, use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;stream_raster &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; outFlowAccum &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000; border: 0px; font-weight: inherit;"&gt;150&lt;/SPAN&gt; &lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2018 11:14:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-calculator-to-map-algebra/m-p/575697#M45104</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2018-11-02T11:14:01Z</dc:date>
    </item>
  </channel>
</rss>

