Available with Spatial Analyst license.
The Set Null tool sets identified cell locations to NoData based on a specified criterion.
The tool returns NoData for an output cell if the evaluation on an input conditional raster is true; otherwise, it returns the value identified by the false input, which can be a raster or a constant value.
There are two ways in geoprocessing to identify whether a cell location evaluates to true or false: by an input conditional raster or by an input conditional raster on which an optional expression is applied. If only an input raster is used, all nonzero values on the input raster are considered true and all zero values false. Cells evaluating to true will receive NoData as output. A cell containing NoData as input does not equate to false, and NoData will be assigned as the output for the location.
A number of Spatial Analyst tools can be used to identify which cell locations will be evaluated to true and which to false. In particular, the logical tools in the Math toolbox can be used, with the Test tool being particularly useful.
Similarly, Set Null is often used to change all values that meet a specified condition to NoData. It can be used for processing the remaining selected cells, to create a mask, or to eliminate certain cells for future consideration within a model.
Examples
Using an expression
To set any cell with a value greater than 5 to NoData and have the remaining cells retain their original values, the following parameters could be used on the tool dialog box:
Input conditional raster : InRas1
Expression : "Value > 5"
Input false raster or constant value : InRas1
Output raster : setnull_1
The equivalent using an expression in Map Algebra is as follows:
OutRas = SetNull(InRas1 > 5, InRas1)
Without an expression
The image below uses an input raster (InRas1) as the condition. When the value for a cell on InRas1 is true (not 0 or NoData), NoData is assigned to that cell location; otherwise, the value in InRas2 is written as the output value.