Select to view content in your preferred language

Raster Calculator Error

942
1
05-02-2014 07:18 AM
AndrewMontreuil
New Contributor
I am getting an error running raster calculator that I can't figure out.

I have 2 rasters, narr_grid_Clip and sc_neg15. The first (narr...) has values ranging from 1 to 10. The second (sc...) only has data when the first is equal to 1. The calculation I am trying to run is very long, but repetitive with other layers similar to sc_neg15 that correspond to other values of narr_grid_Clip . I have trimmed it down to just the part dealing with sc_neg15, but the error remains exactly the same. I figure it will be easier to debug the small version, and then apply it to the larger one as a whole.

Here is the simplified calculation:
[INDENT]Con("narr_grid_Clip" == 1,"sc_neg15")[/INDENT]


And the error messages:
[INDENT]xecuting: RasterCalculator Con("narr_grid_Clip" == 1,"sc_neg15") H:\ajm236.gdb\rastercalc3
Start Time: Fri May 02 11:07:21 2014
Con(Raster(r"narr_grid_Clip") == 1,Raster(r"sc_neg15"))
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.1\arcpy\arcpy\sa\Functions.py", line 240, in Con
    where_clause)
  File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\sa\Utils.py", line 47, in swapper
    result = wrapper(*args, **kwargs)
  File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\sa\Functions.py", line 225, in wrapper
    return _wrapLocalFunctionRaster(u"Con_sa", ["IfThen", in_conditional_raster, in_true_raster_or_constant])
RuntimeError: ERROR 010422: Error in processing the environment mask.

Failed to execute (RasterCalculator).
Failed at Fri May 02 11:07:24 2014 (Elapsed Time: 3.00 seconds)[/INDENT]


Any help would be greatly appreciated.
1 Reply
PatrickOswald1
New Contributor

Same problem for me.

Exporting a tool that works well in Model builder to Python and running it as a script produces this error.

 

Band_1 = "D:\\tmp\\raster.png\\Band_1"
Band_2 = "D:\\tmp\\raster.png\\Band_2"
Band_3 = "D:\\tmp\\raster.png\\Band_3"

# Process: Raster Calculator (Raster Calculator) (ia)
ap_tmpCon = "D:\\tmp\\lcFromRaster.gdb\\ap_tmpCon"
Raster_Calculator = ap_tmpCon
ap_tmpCon = Con((Band_1 == 176) & (Band_2 == 176) & (Band_3 == 176), 1, 0)
ap_tmpCon .save(Raster_Calculator)

gets me the same error. I assume its a but with the Con function in arcpy.ia . 

Any ideas how to fix?

 

0 Kudos