<?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: Loop addition of Output in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/loop-addition-of-output/m-p/801473#M3159</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume you are using an iterator on your rasters and that is feeding into a Collects tool? As you have not uploaded an image of your model I will assume this is the case?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;People often make the mistake of connecting the collects tool to the final tool &lt;SPAN style="text-decoration: underline;"&gt;within&lt;/SPAN&gt; the same model. This is wrong, the collects tool should be the last tool in the model and exposed as a &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002w0000003z000000"&gt;parameter&lt;/A&gt;. You then add that whole model as a &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002w0000007p000000"&gt;sub-model&lt;/A&gt; to another and connect the output parameter (your collect tool) to the final tool that will do something to the collection of datasets.&amp;nbsp; You will find the model executes much more efficiently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically you need to understand the quirky nature of an iterator, &lt;SPAN style="text-decoration: underline;"&gt;everything&lt;/SPAN&gt; in the model executes &lt;EM&gt;X&lt;/EM&gt; number of times when it contains an iterator. This is subtlety different from a standard loop say in python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Aug 2014 10:40:48 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2014-08-29T10:40:48Z</dc:date>
    <item>
      <title>Loop addition of Output</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/loop-addition-of-output/m-p/801472#M3158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to loop a tool and with every result of the loop to add it to the last. I have a default raster created (all 1's) to add the first instance too. I have tried collect values and then cell statistics, but as the list in collect values grows with successive looping, the cell statistics slows way down. I figure that if I just do an addition it will only ever have two rasters to think about at once. Naturally, I am in modelbuilder, but if you have python ideas, that could work.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is basically what I am trying to do:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In raster = RAS1&lt;/P&gt;&lt;P&gt;Out Raster = RAS2&lt;/P&gt;&lt;P&gt;SUM = RAS3&lt;/P&gt;&lt;P&gt;Shape = SHP1&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each record in SHP1&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RAS2 = Process of SHP1 record and RAS1&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RAS3 = RAS2 + Last RAS3&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. I have no idea how this new forum works, sorry if this ends up somewhere strange.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Aug 2014 21:15:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/loop-addition-of-output/m-p/801472#M3158</guid>
      <dc:creator>DavidCampbell</dc:creator>
      <dc:date>2014-08-10T21:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Loop addition of Output</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/loop-addition-of-output/m-p/801473#M3159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume you are using an iterator on your rasters and that is feeding into a Collects tool? As you have not uploaded an image of your model I will assume this is the case?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;People often make the mistake of connecting the collects tool to the final tool &lt;SPAN style="text-decoration: underline;"&gt;within&lt;/SPAN&gt; the same model. This is wrong, the collects tool should be the last tool in the model and exposed as a &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002w0000003z000000"&gt;parameter&lt;/A&gt;. You then add that whole model as a &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002w0000007p000000"&gt;sub-model&lt;/A&gt; to another and connect the output parameter (your collect tool) to the final tool that will do something to the collection of datasets.&amp;nbsp; You will find the model executes much more efficiently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically you need to understand the quirky nature of an iterator, &lt;SPAN style="text-decoration: underline;"&gt;everything&lt;/SPAN&gt; in the model executes &lt;EM&gt;X&lt;/EM&gt; number of times when it contains an iterator. This is subtlety different from a standard loop say in python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 10:40:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/loop-addition-of-output/m-p/801473#M3159</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2014-08-29T10:40:48Z</dc:date>
    </item>
  </channel>
</rss>

