<?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: How to do a raster layer summation by loop? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157013#M12084</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you soooooo much again &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Nov 2017 14:46:55 GMT</pubDate>
    <dc:creator>RebeccaRicker</dc:creator>
    <dc:date>2017-11-12T14:46:55Z</dc:date>
    <item>
      <title>How to do a raster layer summation by loop?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157011#M12082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN&gt;&lt;STRONG style="color: black; font-size: 12pt;"&gt;Hey folks,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: black; font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I work with &lt;STRONG&gt;ArcGIS Pro&lt;/STRONG&gt; and &lt;STRONG&gt;Python&lt;/STRONG&gt; and I need to do a &lt;STRONG&gt;Summation &lt;/STRONG&gt;over 31 raster layers. I want to do it &lt;STRONG&gt;by a loop&lt;/STRONG&gt;, because I need it more often.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;This is what I want to loop:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = Folder_Single_Layer_ND_as_0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum_Layer_ND_as_0 = \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Raster("/offset_0_1.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_2.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_3.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_4.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_5.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_6.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_7.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_8.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_9.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_10.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_11.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_12.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_13.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_14.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_15.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_16.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_17.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_18.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_19.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_20.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_21.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_22.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_23.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_24.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_25.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_26.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_27.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_28.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_29.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_30.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + Raster("/offset_0_31.tif") \&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum_Layer_ND_as_0.save()&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I tried so far...&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Those are already definite&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # TxWx = "/offset"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I need this as a Variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Number_of_Years = 31&amp;nbsp;&amp;nbsp;&amp;nbsp; # I calculated this from a NetCDF&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;...this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = Folder_Single_Layer_ND_as_0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for Number in range(1, int(Number_of_Years))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum_Layer_ND_as_0 += Raster(TxWx + "_0_" + Number + ".tif")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;...and this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = Folder_Single_Layer_ND_as_0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while True:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum_Layer_ND_as_0 += Raster(TxWx + "_0_" + str(x) + ".tif")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x += int(Number_of_Years)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;... and this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = Folder_Single_Layer_ND_as_0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while count &amp;lt;= int(Number_of_Years):&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum_Layer_ND_as_0 += Raster(TXWX + "_0_" + str(count) + ".tif")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count +=1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;Nothing works. I am a very beginner in Python. I would be very grateful if anyone could help me!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;PS.: If my question is on the wrong position or I am not supposed to ask it here, please tell me.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Nov 2017 04:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157011#M12082</guid>
      <dc:creator>RebeccaRicker</dc:creator>
      <dc:date>2017-11-12T04:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a raster layer summation by loop?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157012#M12083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting" target="_blank"&gt;https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt; to format your code so it is easier to read.&lt;/P&gt;&lt;P&gt;You need to use &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listrasters.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;list rasters&lt;/A&gt; and sum the raster datasets using a&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/spatial-analyst-toolbox/cell-statistics.htm" rel="nofollow noopener noreferrer" target="_blank"&gt; Local sum&lt;/A&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; env
env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:/some_folder/a_folder_or_gdb"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CheckOutExtension&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Spatial"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
in_rasters &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListRasters&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"*"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TIF"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="comment token"&gt;# change to suit the raster types&lt;/SPAN&gt;
sum_cellstats &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; CellStatistics_sa&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_rasters&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SUM"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"DATA"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="comment token"&gt;# read the help!!&lt;/SPAN&gt;
sum_cellstats&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"C:/test/output/sum_o_rama"&lt;/SPAN&gt;&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;/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;which has obviously not been tried but you can examine the various help topics to get the idea of how to work through through the process&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:19:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157012#M12083</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T08:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a raster layer summation by loop?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157013#M12084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you soooooo much again &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Nov 2017 14:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157013#M12084</guid>
      <dc:creator>RebeccaRicker</dc:creator>
      <dc:date>2017-11-12T14:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a raster layer summation by loop?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157014#M12085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no problem &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Nov 2017 15:14:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-do-a-raster-layer-summation-by-loop/m-p/157014#M12085</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-11-12T15:14:11Z</dc:date>
    </item>
  </channel>
</rss>

