<?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: 'while loop' on rasters in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60979#M4887</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ok, understood:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;allzero = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while allzero &amp;gt; 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; newraster = Con(rasterX &amp;gt; 0, rasterX -1, rasterX)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; maxcellvalue = getRasterProperties_management(newraster, "MAXIMUM")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; if maxcellvalue &amp;lt;= 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; allzero = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry for the bad syntax and the poorness of the code, keep it as an advice. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;should do what you need with the proper adjustments &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ciao&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jan 2012 13:33:47 GMT</pubDate>
    <dc:creator>AlessandroCinnirella</dc:creator>
    <dc:date>2012-01-09T13:33:47Z</dc:date>
    <item>
      <title>'while loop' on rasters</title>
      <link>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60974#M4882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A beginners question: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am looking for the right syntax to perform a while loop on a raster "x",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to do something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while cell (in raster x) &amp;gt; 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;value of cell= value of cell-1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I do this? Probably something easy but I can't find it anywhere.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 09:37:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60974#M4882</guid>
      <dc:creator>MattiasVan_Opstal</dc:creator>
      <dc:date>2012-01-09T09:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: 'while loop' on rasters</title>
      <link>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60975#M4883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;you can do that using MapAlgebra and the Con() statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Con(rasterX &amp;gt; 0, rasterX -1, rasterX)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This means :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if the cell of rasterX is &amp;gt; 0, than the value of the cell will be changed to the value -1,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else, the value will remain unchanged.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ciao&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 12:18:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60975#M4883</guid>
      <dc:creator>AlessandroCinnirella</dc:creator>
      <dc:date>2012-01-09T12:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: 'while loop' on rasters</title>
      <link>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60976#M4884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Oké, but I want this Con() statement to be repeated until every value of the raster has reached 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Similar to the traditional "while-loop" in python...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 12:54:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60976#M4884</guid>
      <dc:creator>MattiasVan_Opstal</dc:creator>
      <dc:date>2012-01-09T12:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: 'while loop' on rasters</title>
      <link>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60977#M4885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This question is confusing.&amp;nbsp; If the cell values are &amp;gt;0 do you simply want to subtract 1 from each value?&amp;nbsp; If so, then use the raster calculator to subtract 1 from the grid and produce a new grid which will be 1 less than the input grid.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 13:08:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60977#M4885</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2012-01-09T13:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: 'while loop' on rasters</title>
      <link>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60978#M4886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry for the confusion, what I want to do is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"While" (as long as...) the cell values of Ras1&amp;gt;0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ras2= do something&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ras3= do something&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ras1= Ras1 - 1&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 13:25:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60978#M4886</guid>
      <dc:creator>MattiasVan_Opstal</dc:creator>
      <dc:date>2012-01-09T13:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: 'while loop' on rasters</title>
      <link>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60979#M4887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ok, understood:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;allzero = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while allzero &amp;gt; 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; newraster = Con(rasterX &amp;gt; 0, rasterX -1, rasterX)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; maxcellvalue = getRasterProperties_management(newraster, "MAXIMUM")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; if maxcellvalue &amp;lt;= 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; allzero = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry for the bad syntax and the poorness of the code, keep it as an advice. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;should do what you need with the proper adjustments &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ciao&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 13:33:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60979#M4887</guid>
      <dc:creator>AlessandroCinnirella</dc:creator>
      <dc:date>2012-01-09T13:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: 'while loop' on rasters</title>
      <link>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60980#M4888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thanks! I'll try, looks like it will work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 13:43:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/while-loop-on-rasters/m-p/60980#M4888</guid>
      <dc:creator>MattiasVan_Opstal</dc:creator>
      <dc:date>2012-01-09T13:43:58Z</dc:date>
    </item>
  </channel>
</rss>

