Is Null (Spatial Analyst)

This ArcGIS 2.7 documentation has been archived and is no longer updated. Content and links may be outdated. See the latest documentation.

Available with Spatial Analyst license.

Available with Image Analyst license.

Summary

Determines which values from the input raster are NoData on a cell-by-cell basis.

Returns a value of 1 if the input value is NoData and 0 for cells that are not.

Illustration

Is Null illustration
OutRas = IsNull(InRas1)

Usage

Syntax

IsNull(in_raster)
ParameterExplanationData Type
in_raster

The input raster being tested to identify the cells that are NoData (null).

The input can be either integer or floating-point type.

Raster Layer

Return Value

NameExplanationData Type
out_raster

The output raster.

The output identifies with an integer value of 1 which cells in the input are NoData. If the input is any other value, the output is 0.

Raster

Code sample

IsNull example 1 (Python window)

This example identifies which cells in the input raster are NoData, and outputs the result as an IMG raster.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outIsNull = IsNull("degs")
outIsNull.save("C:/sapyexamples/output/outisnull.img")
IsNull example 2 (stand-alone script)

This example identifies which cells in the input raster are NoData, and outputs the result as a Grid raster.

# Name: IsNull_Ex_02.py
# Description: Find which cell values of the input raster are NoData
# Requirements: Spatial Analyst Extension

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

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

# Set local variables
inRaster = "degs"

# Execute IsNull
outIsNull = IsNull(inRaster)

# Save the output 
outIsNull.save("C:/sapyexamples/output/outisnull")

Licensing information

  • Basic: Requires Spatial Analyst or Image Analyst
  • Standard: Requires Spatial Analyst or Image Analyst
  • Advanced: Requires Spatial Analyst or Image Analyst

Related topics