7

is there a way to handle an error within the ArcGIS ModelBuilder? I have a model which iterates over hundreds of raster files. some of them may be corrupt. i`m looking for a way in which the ModelBuilder skips any corrupt raster files and proceeds with the next file.

2 Answers 2

2

ModelBuilder is great but has its limitations even with the new (to v 10) iterations and much depends on how you define 'corrupt'. While it would not be impossible to do what you want in ModelBuilder, I think it would get messy and you would probably have to write a script to test whether the file meets your criteria anyway. Therefore, it would probably be simpler to export your model to Python and add a try-except test.

I regularly used ModelBuilder to prototype a process and then export it to Python and add tests for validity, iterations etc. Just note that the export from ModelBuilder will not include the iteration but that is straight forward to add.

2
  • thanks mappagnosis, that was my plan b. i will try it that way. Commented Feb 28, 2013 at 12:03
  • I always opt for pragmatism over coercion when it comes to model builder :) Commented Feb 28, 2013 at 16:38
1

Another alternative to skipping errors would be to instead pre-test for issues that would lead to errors. So, in your example above, after you iterate to the next raster, you could write a small Python script that could pre-test the raster and either pass or fail the raster, at which point your model could read the results (True/False?) either pass the layer to the remaining portion of skip it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.