I have a model that runs through a series of Rasters in a folder and extracts individual crops as layers cyclically.

The problem is that if the crop is not grown in a particular state, the model will die as the "extract by attribute" step is trying to operate on a null set.

Is there a way to test to see if the attribute exists in the raster before trying to extract it?

If it doesn't exist, how do I get the model to move on to the next raster rather than dying?

An image of the model Diagram:

Model structure


You can use a precondition to control if the model executes. The following model assumes your raster is an integer grid so the SOY class is an integer value. This means you can use the raster in the select by attribute tool. So get count should return 1 if SOY exists in the raster and as it is a precondition to the raster to polygon tool that part of the model only ever executes if count is TRUE.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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