I am trying to automate a process in ArcPro and I'm getting an error when running my model that doesn't occur when I tested manually. Here's the basics of what I'm doing:
I have one raster (DEM) and one feature class (polygon). I'm iterating through each feature in the feature class and clipping the raster with that individual polygon. I'm using the FID field as the iterating value. Once the raster is clipped to the individual polygon, I need to run an expression using Raster Calculator as follows:
Con( "%DrainageDitch1_clp_%FID%.tif%" >= (0.8*( "%DrainageDitch1_clp_%FID%.tif%".maximum - "%DrainageDitch1_clp_%FID%.tif%".minimum) + "%DrainageDitch1_clp_%FID%.tif%".minimum), "%DrainageDitch1_clp_%FID%.tif%")
This gives me the cells that have elevations in the top 20% of the polygon area. When this is run manually using Raster Calculator (without the %), it works as expected. However, when run in ModelBuilder, I receive an error:
ERROR 000539: Traceback (most recent call last):
File "<expression>", line 1, in <module>
File "<string>", line 5, in rcexec_DC684390_0C54_4F14_9EBF_B34DF3F2E1B1
AttributeError: 'str' object has no attribute 'maximum'
Failed to execute (Raster Calculator).
I've tried rewriting the expression in many different ways, including removing the %% and "" around the raster input (except for around FID), and I still get the same error. Also, the iteration runs fine before the Raster Calculator part is added.
Ideas to get around this?
Solved! Go to Solution.