Iterate and add rasters from multiple folders

694
1
01-18-2013 06:41 PM
GeorgeSutherland
New Contributor
Hello,

I am trying to add raster files from four folders together (i.e. file1 from folder1 + file1 from folder2 +file1 from folder3 + file1 from folder4). This would be easy enough to do with the Raster Calculator tool, however there are 90 files in each folder, each needing to be combined with the corresponding files in separate folders.

Using Model Builder I have create a model that allows me to select four input files to be added together, and assigns the output raster to a new location. I can batch process this, but when I press "fill" to fill in the other 90 files for each of the four folders, the original four files just get filled in the whole way, resulting in me having to manually change each of the names.

Just wondering if there is any way to build a model or write a script that will iterate through all four folders, pull out the same file in each folder, and add them together, for example:

file1 from folder1 + file1 from folder2 +file1 from folder3 + file1 from folder4 = output1,
file2 from folder1 + file2 from folder2 +file2 from folder3 + file2 from folder4 = output 2
.....
file'n' from folder1 + file'n' from folder2 +file'n' from folder3 + file'n' from folder4 = output'n'

Thanks in advance for any help!
Tags (2)
0 Kudos
1 Reply
CHETHANVA
New Contributor

Hey, ..this is Chethan . can you please share the answer for this question if you had got

0 Kudos