0

i'm using a ArcGIS 10.3 modelbuilder for comparing two subdatasets in a HDF file. model runs for multiple inputs i.e. it has an iterator. model runs fine for many inputs but sometimes it throws an exception and stops. I debugged the model and found out that when Con tool compare two subdatasets in the model and if it doesn't find data (i.e. null raster) it trows an exception and whole model stops. I searched a solution for it and came out is using a script tool.

My question is i want to write a script tool that checks if input raster is null and outputs two Booleans 'true' or 'false'. if False then model runs as usual and if True it comes to next input in iteration and keep running.

1

You can do this with arcpy, but if you don't have any experience with it, you might prefer a ModelBuilder solution. You can check whether your raster has only NoData values, and skip the Con tool if does:

  • First add the Get Raster Properties tool and connect it to the iterated raster. Choose ALLNODATA as Property Type parameter.
  • Then add a Stop tool (it's a ModelBuilder only tool) and choose True for the 'Stops when inputs are' parameter.
  • And at last set the Continue box as Precondition of the Con tool as shown in the image below:

enter image description here

  • I modified my model as you suggested but when i feed Property variable of Get Raster Properties tool to Input Value parameter of Stop tool it says 'input value data-set doesn't exist or not supported'. – Ritesh Porwal Mar 22 '18 at 4:37
  • I converted output of Get Raster Properties tool to Boolean using Calculate Value (Model Only) tool and i got this thing working. but whole model stops when this thing works. this is what was happening in the first place. I wanted to keep running this model with other inputs even if some of the inputs throw an exception. – Ritesh Porwal Mar 22 '18 at 5:13

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.