Error 000539 running Raster Calulator

18250
7
08-30-2016 07:04 PM
MihaiGrosu
New Contributor

Hello, I am trying to combine a few rasters together and getting the 000539 error.

I checked out a few forums for solutions but could not resolve the issue. I know it has something to do with Python not being able to communicate with Arc, but I cant find the solution to my own error anywhere online. Can someone interpret the message and provide a possible solution please?

Executing (Raster Calculator): RasterCalculator ""shadowmap_1" + "shadowmap_2" + "shadowmap_3" + "shadowmap_4" + "shadowmap_5"" C:\Users\Mihai\Desktop\Shade_Analysis\March20\ShadowAnalysis2.gdb\sum_shadowmap_temp
Start Time: Tue Aug 30 21:54:54 2016
Raster(r"shadowmap_1") + Raster(r"shadowmap_2") + Raster(r"shadowmap_3") + Raster(r"shadowmap_4") + Raster(r"shadowmap_5")
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.4\arcpy\arcpy\sa\Functions.py", line 4329, in Plus
in_raster_or_constant2)
File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\sa\Utils.py", line 53, in swapper
result = wrapper(*args, **kwargs)
File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\sa\Functions.py", line 4326, in Wrapper
["Plus", in_raster_or_constant1, in_raster_or_constant2])
RuntimeError: ERROR 999998: Unexpected Error.

Failed to execute (Raster Calculator).
Failed at Tue Aug 30 21:54:54 2016 (Elapsed Time: 0.26 seconds)

0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

they all share the same extent.... correct?

the output filename is too long if they are esri grids

did you try to just add 2? if it worked, add one more

the spatial analyst extension is toggle on (customize extensions, toggle on)

just a start

0 Kudos
MihaiGrosu
New Contributor

Yes they are all allocated in the same GDB

I narrowed my output filename to 9 letters

Been trying with a small batch as a test (out of 145 rasters)

Extension is on (Spatial Analyst)

Yet I get the same error

I even tried this on another computer, hoping that its just my machine that causes this issue, but I get the same error.

Thanks for the help!

P.S. I have also tried running the raster calculator tool on its own and got the same error message.

0 Kudos
DanPatterson_Retired
MVP Emeritus

well, if you can't communicate with arc* in any way, then you have a bad install.

Provide information on that.

Do you use a separate python IDE?  Did you try to install a different version?

Can you go to your IDE and do an   ...  import arcpy  ....

If it doesn't work, then the issues are related to the installs.

The only solutions that I saw relating to that error message involved reinstallations

UPDATE  Error: ERROR 000539: Error running expression: rcexec() 

0 Kudos
curtvprice
MVP Esteemed Contributor

If the inputs are model variables they should have percents around them so the input paths or layer names will be handled correctly. When you use the Raster Calculator dialog instead of typing in layer names in the tool, the percents should appear for you. One of those cases (like SQL expressions) where using the UI can save you a lot of suffering.

"%shadowmap_1%" + "%shadowmap_2%"‍‍‍‍

I would also suggest using the Cell Statistics tool - which will be a lot easier to work (and faster) than the raster calculator if you are simply adding rasters together, especially many rasters.

If you did that, you could use a submodel to generate the list of rasters (using an iterator) so you don't need to add 145 rasters to your model.

0 Kudos
Dr_Jason_VanHorn
New Contributor II

If you are simply trying to do mathematical operations on one raster
(convert from feet to meters OR meters to feet, etc...) or

on two rasters: (addition, subtraction, multiplication, or division),

then just used the ArcToolbox > Spatial Analyst Tools > Math:

  • Plus
  • Minus
  • Times
  • Divide

    For example, 


    or

0 Kudos
curtvprice
MVP Esteemed Contributor

Also worth mentioning: the Cell Statistics tool is a good choice for adding a list of rasters (and it has the handy option to ignore NoData).

0 Kudos
GarretDuffy
Occasional Contributor

I also experienced this Error Code 000539 and fixed it by ensuring that all input rasters were in the same projection.