I have created a random raster in ArcGIS Pro using the following Python command:

arcpy.CreateRandomRaster_management(Path, "rnraster", "INTEGER", "", 10)

Which works fine.

Performing map algebra operations on this raster is possible when the second parameter is an integer such as:

addition = Plus("rnraster", 6)

However, performing operations that involve any existing raster fail with an enexpected error, such as when I try to add this random raster to my elevation raster/DEM:

addition = Plus("rnraster", "elevdata")
addition = Raster("rnraster") + Raster("elevdata")

I know that the elevdata raster works in map algebra expressions with other rasters, so my question is:

What must I do to the randomly generated raster to enable map algebra operations with existing rasters?

I have already tried matching bit depth, cell size and raster format (16 bit unsigned, 10 and Esri Grid respectively). Does the random raster require spatial referencing first?

Error Log:

    Traceback (most recent call last):
  File "Monte Carlo Simulation.py", line 29, in <module>
    demError = arcpy.Raster("elevdata") + arcpy.Raster(rnRaster)
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\sa\Functions.py", line 4328, in Plus
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\sa\Utils.py", line 53, in swapper
    result = wrapper(*args, **kwargs)
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\sa\Functions.py", line 4325, in Wrapper
    ["Plus", in_raster_or_constant1, in_raster_or_constant2])
RuntimeError:  ERROR 999998: Unexpected Error.
Failed to execute (MonteCarloSim)

Elevation Data Raster Properties:

enter image description here

Random Raster Properties:

enter image description here

The random raster has no coordinate system or projection set, whereas the elevation raster does, but would this cause the problem?

  • Is that all it says, "Unknown Error"?
    – phloem
    Commented Feb 23, 2017 at 21:53
  • Make that "Unexpected error", even after changing the command to "demError = arcpy.Raster("elevdata") + arcpy.Raster("rnRaster")". I have added the full error to the question.
    – Unencoded
    Commented Feb 23, 2017 at 22:03
  • Does it work in ArcMap or same error?
    – phloem
    Commented Feb 23, 2017 at 22:30
  • Same error in both ArcMap and an independent IDE, thank you for the suggestion though.
    – Unencoded
    Commented Feb 23, 2017 at 22:40
  • I can't test this Pro right now, but I can use Plus("random","elevation") in ArcMap, so I'm guessing it's a data issue. Are both similarly projected?
    – phloem
    Commented Feb 23, 2017 at 23:31

1 Answer 1


I would say that trying to add two rasters together that don't have the same coordinate system is what's causing your problem.

When you create your random raster, set the coordinate system in the environment settings of the tool. Alternatively, you could try defining a projection on your existing random raster.

  • You were spot on, specifically it seems the extent of the random raster needed to match, which is perfectly logical now I think about it! Thanks for the assistance.
    – Unencoded
    Commented Feb 24, 2017 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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