Available with Spatial Analyst license.
Available with Image Analyst license.
All map algebra statements require input on which to apply the tools and operators (except for CreateNormalRaster and CreateRandomRaster, which have only optional arguments).
Input rules
The following are rules to follow when specifying input data.
- To use input data directly (data on disk, layers, tables, field names), it must be in a quoted string.
# The full path and name of the dataset is used outRas = Slope("C:/Data/elevation") # If the layer is in the Contents or in your workspace, # then just the quoted name is needed outRas2 = Slope("elevation")
# In the following statement Population is a field name outRas2 = KernelDensity("inpoints", "Population")
- Existing input data can be assigned to a variable, and the variable can be used in a statement. Variables are not quoted.
inputElevation = "C:/Data/dem" outRas = Slope(inputElevation)
- Raster objects can be used as input into subsequent statements. Since a raster object is a variable, it is not quoted.
outSource = ExtractByAttributes("inraster", "Value > 3000") # The output of ExtractByAttributes is used as input to EucDistance outDistance = EucDistance(outSource)
- Result objects can also be used as input into map algebra expressions.
# Buffer returns a Result object, which is used here as # input to EucDistance dist = EucDistance(arcpy.Select_analysis("schools", "#", "Pop>2000"))
- Many tools accept multiple inputs for a parameter (multivalue input). Inputs are separated by commas and enclosed in square brackets (denoting a Python list).
outStats = CellStatistics(["inraster1", "inraster2", "inraster3"], "MEAN")