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")
OR
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
in_raster_or_constant2)
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:
Random Raster Properties:
The random raster has no coordinate system or projection set, whereas the elevation raster does, but would this cause the problem?