Available with Spatial Analyst license.
The Spatial Analyst module, arcpy.sa, is a Python module for analyzing raster and vector data with the functionality provided by the ArcGIS Spatial Analyst extension. It provides access to all the geoprocessing tools available in the Spatial Analyst toolbox as well as other functions and classes that allow you to automate your raster processing workflows.
The module has four major components: Classes, Functions, Geoprocessing functions, and Operators.
The functional components of Spatial Analyst, and some other useful components, are identified below.
Spatial Analyst components
Spatial Analyst classes are primarily used for defining parameters for Spatial Analyst tools that may have varying numbers of arguments depending on the parameter type selected (for example, the neighborhood type) or when the number of entries in the parameters can vary depending on the specific situation (for example, a reclass table). By using classes for parameters, you can access and programmatically change any of the individual entries in the parameter.
Functions can create, manage, and process raster datasets, as well as analyze raster data.
The ArcGIS Spatial Analyst module provides a rich set of spatial analysis and modeling geoprocessing functions for both raster (cell-based) and feature (vector) data.
Map algebra supports a series of operators. The operators can be grouped into Arithmetic, Bitwise, Boolean, and Relational categories. The map algebra operators are available with the ArcGIS Spatial Analyst license and the ArcGIS Image Analyst license.
Along with the classes, functions, and operators available in the arcpy.sa module, you can use functions and classes from ArcPy or other ArcPy modules in your Python scripts to accomplish your workflows. The Raster ArcPy class creates a raster object that can be used in Python scripting, and it is required for much of the processing available in the arcpy.sa module. The NumPyArrayToRaster ArcPy function and the RasterToNumPyArray ArcPy function may also be useful for your scripting workflows.
Certain functionality is also available if you have an ArcGIS Image Analyst extension license, including all of the mathematical operators and certain classes. For more information, see the Image Analyst module.