More

How to fix a calculate value tool to work in a large model and skip featureless rasters?

How to fix a calculate value tool to work in a large model and skip featureless rasters?


I'm attempting to run a model that contains some rasters that do not have any features after being processed through my raster calculator. I have a calculate value tool from a previous question that works exactly as it is shown. The issue is that tool doesn't work when placed within the model. I changed the Data Type to Variant and the calculate value tool runs but returns this error:

The point of the calculate tool was to find these "bad" rasters and skip over them. The calculate value tool correctly identifies and skips rasters in a less complicated model.

Here is the calculate value:

Does anyone know how I can make this calculate value tool work in my big model?

I'm more than open to changing the calculate value code block to run a different process if using Getproperties is causing the issue.


You just need to tweak the code to do a find and replace, below is the updated code. This code assume that it will always find a symbol.

import arcpy,string def CheckRaster(r): #r will have  so we need to replace them with / r = string.replace(r,'','/') result = arcpy.GetRasterProperties_management(r, "MINIMUM") n = int(result.getOutput(0)) if n > 1: return True else: return False

Watch the video: Resampling Raster ArcGis. changing the cell size of Raster dataset in ArcGis