Iterate tool with multiple input variables

548
4
07-12-2012 02:19 PM
JasonAdelaars
New Contributor
Hey forum,

I've created a raster calculator model that includes two input variables and produces a single output raster. Now i want to quickly do that calculation over all 90 variable pairs times 8 folders. Model builder only lets me have one iterator.

For simplicity sake:

Let say the calculation is: RasterA + RasterB = RasterC;

now I want to do that calculation for 90 paired (RasterA and RasterB) variables within a folder. I am unfamiliar with python, but I have the time and resources to learn it. Any ideas??

Thanks,
Jason
0 Kudos
4 Replies
SolomonPulapkura
Occasional Contributor III
If RasterA and RasterB are in the same folder, you will need to somehow distinguish the 2 in your code logic so that they can be passed as A and B parameters respectively.
Otherwise whats is variable A for one loop might be variable B for another loop. Hope this makes sense?
0 Kudos
JasonAdelaars
New Contributor
They are distinguishable. Each pair needs to be input into the model for each iteration. To my understanding right now the iterator does not allow multiple inputs into a model.
0 Kudos
JonathanQuinn
Esri Notable Contributor
You can create two separate iterators that exist in their own models.  Then, add both models to a "final" model, and set preconditions so the iterators need to run to collect the values of the iterators before the final processes run in your full model.  Take a look at this resource here for guidance.
0 Kudos
JasonAdelaars
New Contributor
Thanks Jonathan, i think this is on the right track. But the iterator models pass over all the files in the folder and only runs the last two rasters through the final model.

I need it to take a pair of rasters, run them through the model, and produce an output. Then take the next pair of rasters, run through model, produce output...etc.

Jason
0 Kudos