Select to view content in your preferred language

Model Builder Error Collect Values to Mosaic to New Raster

4567
2
04-09-2015 06:11 AM
HeatherWelch2
Deactivated User

Hello,

I'm working on a model to iterate through a series of rasters, perform a couple operations to each raster, collect the values, and then mosaic them together into a new raster. My submodel includes Iterate Rasters>Make Raster Layer>Copy Raster>Collect Values, and then my main model has the Mosaic to New Raster. When I try to connect the output from my submodel to Mosaic to New Raster, I get the error that the number of bands from the input raster must match the number in the output, and I cannot run the model. My original data has 4 bands, but during the submodel I reduce the number to 1, and then my output also has 1. Has anyone else run into this problem in model builder? Any ideas how to get around it?

0 Kudos
2 Replies
curtvprice
MVP Esteemed Contributor

Without your tbx file it's a bit difficult to give you advice.

Model validation can be very tricky for sure. I would the the copy raster would do the trick by creating a verifiably one-band dataset. Perhaps running that output through the Select Data tool will enforce the output's one-banded raster reality.

0 Kudos
HeatherWelch2
Deactivated User

I'm interested to try the Select Data tool and see if it allows Mosaic to New Raster to recognize the number of bands.

As it is, I found a work around. I fed my sub model 'scan1'

submodel.PNG

into the Mosaic tool with Create Raster Dataset run as a precondition - which allowed me to set the number of bands without the model needing to recognize the number of bands in the input.

model.PNG

A little clunky, but it works.

0 Kudos