I am using Raster Calcuator in ModelBuilder with ArcMap 10.5.
I used Get Raster Properties to extract Standard Deviation and Mean from a previously calculated raster.
I would like to use Raster Calc again to create a raster where raster = (mean + 3*(SD)) or (mean -3*(SD))
. I attempted to use a Con statement with a boolean or (|) operator. Con statement I am using is as follows:
Con(("difference_mean_normalized_.tif" < (float(%Mean%) - 3 * (float(%Standard Deviation%)))) | ("difference_mean_normalized_.tif" > (float(%Mean%) + 3 * (float(%Standard Deviation%)))), 0, 1)
Where difference_mean_normalized_.tif
is my output raster.
This fails and I am getting a 000539 Error:
Start Time: Wed Oct 17 07:12:01 2018
Con(("difference_mean_normalized_.tif" < (float(-4.6467203950133E-06) - 3 * (float(0.036299477806278)))) | ("difference_mean_normalized_.tif" > (float(-4.6467203950133E-06) + 3 * (float(0.036299477806278)))), 0, 1)
ERROR 000539: Error running expression: rcexec()
Traceback (most recent call last):
File "<expression>", line 1, in <module>
File "<string>", line 5, in rcexec
File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\Functions.py", line 263, in Con
where_clause)
File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\Utils.py", line 53, in swapper
result = wrapper(*args, **kwargs)
File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\Functions.py", line 250, in Wrapper
["IfThenElse", in_conditional_raster, in_true_raster_or_constant, in_false_raster_or_constant])
RuntimeError: ERROR 999998: Unexpected Error.
Failed to execute (Raster Calculator (3)).
Some notes: I double-click or drag the variables in from the list in Raster Calc, and "float" is automatically added to the expression for each variable. I manually type in the output raster name. I have tried wrapping the raster name with the % symbol as well, although this is not shown in the screenshot. Also, my original bands were integer, and I had to use the float() operator to convert.
How do I use Raster Calc in ModelBuilder to create a raster +/- 3SD from mean?
difference_mean_normalized.tif_
&difference_mean_normalized_.tif
supposed to refer to the same raster? – Bjorn Oct 17 '18 at 12:46