I have two rasters containing bathymetry data: one containing the bathymetry of the sea floor, we'll call this raster1, and another containing the difference between two previous scans of the same area, but only where the difference is negative. We'll call this raster2. I have to query raster2 such that any areas where the value is >10% of raster1's value will be highlighted.

I can do this in Raster Calculator in ArcGIS with this expression:

abs("raster2") > 0.1 * "raster1"

However I'm trying to write a script to do this and as we know, you can not use Raster Calculator in Python. So I tried this code:

outAbs = Abs(raster2)
outTimes = Times(raster1, 0.1)
outFinal = outAbs > outTimes

But I get:

RuntimeError: ERROR 010422: Error in processing the environment mask.

To be clear, raster1 and raster 2 are both in GRID format.

Any ideas why I might be getting this error?


The ArcGIS help for many tools can usually point you towards potential culprits of errors. The error in your case mentions environment mask.

The Mask help states the following:

If the analysis mask is a feature dataset, it will internally be converted to a raster on execution. For this reason, you should take care to ensure that the Cell Size and Snap Raster are set appropriately for your analysis.

In other words, make sure the cell size of all rasters involved are the same.

Be sure to also ensure all data involved have the same projections.


You can use map algebra syntax in Python, similar to the Raster Calculator:

import arcview, arcpy
from arcpy.sa import *

raster1 = Raster('/path/to/raster1')
raster2 = Raster('/path/to/raster2')

out_final = (Abs(raster2) > 0.1) * raster1

I'm not sure why you're getting the RuntimeError: ERROR 010422: Error in processing the environment mask.. If you are setting arcpy.env.mask (or running script as a script tool from the toolbox and setting the mask environment), make sure you are setting it to an existing dataset.

  • It turns out that the cell size of the two inputs were not even close to eachother, so that explains the Runtime Error. Thanks for the map algebra syntax, what I originally had worked anyways but I'll use your's for efficiency's sake. – purelyp93 Aug 5 '15 at 22:55

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.