I am not sure how to solve the error message to solve my raster calculator algorithm.

The process I am trying to run is to sum pixel values of two raster files of the same area but that represent different years.

The error message is found below:

Executing: RasterCalculator ""rice_v2_2000_india_new.tif" + "rice_v2_2001_india_new.tif"" F:\Rice_Fallow_Mapping\Data_Biradarsir\India_rice\Fallows\rice_paddy\rice_xiao_v2_india_newboundary\geographic\test
Start Time: Thu Sep 15 19:00:54 2016
Raster(r"rice_v2_2000_india_new.tif") + Raster(r"rice_v2_2001_india_new.tif")
ERROR 000539: Error running expression: rcexec() 
Traceback (most recent call last):
  File "<expression>", line 1, in <module>
  File "<string>", line 2, in rcexec
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\__init__.py", line 24, in <module>
    from arcpy.toolbox import *
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\toolbox.py", line 355, in <module>
    from .management import Graph, GraphTemplate
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 26, in <module>
    import _management
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\_management.py", line 14, in <module>
    import _graph
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\_graph.py", line 27, in <module>
    import numpy
  File "C:\Python27\ArcGIS10.3\lib\site-packages\numpy\__init__.py", line 180, in <module>
    from . import add_newdocs
  File "C:\Python27\ArcGIS10.3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Python27\ArcGIS10.3\lib\site-packages\numpy\lib\__init__.py", line 4, in <module>
    from type_check import *
  File "C:\Python27\ArcGIS10.3\lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "C:\Python27\ArcGIS10.3\lib\site-packages\numpy\core\__init__.py", line 20, in <module>
    import function_base
  File "C:\Python27\ArcGIS10.3\lib\site-packages\numpy\core\function_base.py", line 6, in <module>
    from .numeric import result_type, NaN, shares_memory, MAY_SHARE_BOUNDS, TooHardError
ImportError: cannot import name shares_memory

This is the output

Failed to execute (RasterCalculator).
Failed at Thu Sep 15 19:00:54 2016 (Elapsed Time: 0.03 seconds)
  • 1
    it would help if you laid out what you are trying to do in raster calculator then we will have a better chance at interpreting the error message. Please indicate what the algorithm is along with the process you have created including any custom code you might have created. – spk578 Sep 15 '16 at 13:41
  • I just want to add pixel values of two raster files of the same area but different year. when I start to run, above error was shown. – Raj Sep 15 '16 at 13:49
  • Were you running the standard in ArcMap Raster calculator tool as shown here? desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/… – spk578 Sep 15 '16 at 14:13
  • Yes, Arcmap raster calculator – Raj Sep 15 '16 at 14:19
  • I've seen this error before when trying to call Raster Calc from a script as well as when the syntax is incorrect...an alternative is to try Map Algebra tools instead – spk578 Sep 15 '16 at 15:39

Taking from the example given in the ArcGIS help I would suggest trying the following code:

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/mySamples"

# Set local variables
inRaster1 = Raster("rice_v2_2000_india_new.tif")
inRaster2 = Raster("rice_v2_2001_india_new.tif")

# Execute Plus
outPlus = inRaster1 + inRaster2

# Save the output
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.