Hi all,
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.
Here is basically what I am trying to do:
In raster = RAS1
Out Raster = RAS2
SUM = RAS3
Shape = SHP1
For each record in SHP1
RAS2 = Process of SHP1 record and RAS1
RAS3 = RAS2 + Last RAS3
next
Thanks,
David
P.S. I have no idea how this new forum works, sorry if this ends up somewhere strange.
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?
People often make the mistake of connecting the collects tool to the final tool within the same model. This is wrong, the collects tool should be the last tool in the model and exposed as a parameter. You then add that whole model as a sub-model to another and connect the output parameter (your collect tool) to the final tool that will do something to the collection of datasets. You will find the model executes much more efficiently.
Basically you need to understand the quirky nature of an iterator, everything in the model executes X number of times when it contains an iterator. This is subtlety different from a standard loop say in python.