Cell statistics in modelbuilder (multiple input, single output)

6934
3
Jump to solution
10-07-2012 11:00 PM
FlorianRenner
New Contributor
Hello,
I have a problem utilizing the cell statistics tool in modelbuilder. My intention was to select a whole folders content of raster data to create a single "sum"-raster. Problem is, I cannot select the content of a specific folder, just the files/raster data themself. I tryed runnig an iteration but the output is multiple (for each selected folder content). So is there a possibility to not just select single input files rather than a folder's content?

Thanks

FR
0 Kudos
1 Solution

Accepted Solutions
EricRice
Esri Regular Contributor
Florian,

The input to Cell Statistics is a list of rasters, not a workspace. You can however accomplish what you want in model builder by using a sub model to iterate the workspace and collect the values. This is the first model. The second model is only the Cell Statistics tool with the output from the sub model as the input to the tool. You have to do it this way since you only want Cell Statistics to execute once, rather than for each iteration. You can review the section "Advanced use of model iterators" within the help topic, Integrating a model within a model. Below are some screenshots of a model I made this morning that is very similar to the one in the help. I just replaced Merge with Cell Statistics, and I used a different iterator (for raster data). Also included in the screenshots is what the finished tool dialog could potentially look like for an end user of the tool.

Best Regards,
Eric

View solution in original post

3 Replies
EricRice
Esri Regular Contributor
Florian,

The input to Cell Statistics is a list of rasters, not a workspace. You can however accomplish what you want in model builder by using a sub model to iterate the workspace and collect the values. This is the first model. The second model is only the Cell Statistics tool with the output from the sub model as the input to the tool. You have to do it this way since you only want Cell Statistics to execute once, rather than for each iteration. You can review the section "Advanced use of model iterators" within the help topic, Integrating a model within a model. Below are some screenshots of a model I made this morning that is very similar to the one in the help. I just replaced Merge with Cell Statistics, and I used a different iterator (for raster data). Also included in the screenshots is what the finished tool dialog could potentially look like for an end user of the tool.

Best Regards,
Eric
FlorianRenner
New Contributor
Dear Eric,
thank you for your reply and visualization. I was able to create a comparable model and insert it (twice) in my final one. Additionally is this a nice way to work with more than one iterator in a single model. My last question refers to the submodel creating the list of rasters: is it necessary to include this submodel separately in a toolbox to run a different model where the submodel is included?

Thank you,

Florian
0 Kudos
curtvprice
MVP Esteemed Contributor

Yes. Sub models  is how nesting loops (iterating inside a model that runs once) are implemented.

0 Kudos