Slice (Spatial Analyst)

Available with Spatial Analyst license.

Available with 3D Analyst license.

Summary

Slices or reclassifies the range of values of the input cells into zones of equal interval or equal area, or by natural breaks.

Usage

  • Slice works best on data that is normally distributed. When using input raster data that is skewed, the output result may not contain all of the classes that you had expected or specified.

  • When using the Equal area method, sometimes not all of the output zones (classes) will have an equal, or even similar, number of cells. This may be an inherent result based on the nature of the input values and the specified number of zones. If the results are deemed undesirable, you can try using a fewer number of zones or applying a statistics transformation (for example, logarithm or square root) to the input dataset.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Parameters

LabelExplanationData Type
Input raster

The input raster to be reclassified.

Raster Layer
Number of output zones

The number of zones to reclassify the input raster into.

When the slice method is Equal area, the output raster will have the defined number of zones, with a similar number of cells in each.

When Equal interval is used, the output raster will have the defined number of zones, each containing equal value ranges on the output raster.

When Natural breaks is used, the output raster will have the defined number of zones, with the number of cells in each determined by the class breaks.

Long
Slice method
(Optional)

The manner in which to slice the values in the input raster.

  • Equal interval — Determines the range of the input values and divides the range into the specified number of output zones. Each zone on the sliced output raster has the potential of having input cell values that have the same range from the extremes. This is the default.
  • Equal area — Specifies that the input values will be divided into the specified number of output zones, with each zone having a similar number of cells. Each zone will represent a similar amount of area.
  • Natural breaks — Specifies that the classes will be based on natural groupings inherent in the data. Break points are identified by choosing the class breaks that best group similar values and that maximize the differences between classes. The cell values are divided into classes whose boundaries are set when there are relatively big jumps in the data values.
String
Base zone for output
(Optional)

Defines the lowest zone value on the output raster dataset.

The default value is 1.

Long

Return Value

LabelExplanationData Type
Output raster

The output reclassified raster.

The output will always be of integer type.

Raster

Slice(in_raster, number_zones, {slice_type}, {base_output_zone})
NameExplanationData Type
in_raster

The input raster to be reclassified.

Raster Layer
number_zones

The number of zones to reclassify the input raster into.

When the slice method is Equal area, the output raster will have the defined number of zones, with a similar number of cells in each.

When Equal interval is used, the output raster will have the defined number of zones, each containing equal value ranges on the output raster.

When Natural breaks is used, the output raster will have the defined number of zones, with the number of cells in each determined by the class breaks.

Long
slice_type
(Optional)

The manner in which to slice the values in the input raster.

  • EQUAL_INTERVALDetermines the range of the input values and divides the range into the specified number of output zones. Each zone on the sliced output raster has the potential of having input cell values that have the same range from the extremes. This is the default.
  • EQUAL_AREASpecifies that the input values will be divided into the specified number of output zones, with each zone having a similar number of cells. Each zone will represent a similar amount of area.
  • NATURAL_BREAKSSpecifies that the classes will be based on natural groupings inherent in the data. Break points are identified by choosing the class breaks that best group similar values and that maximize the differences between classes. The cell values are divided into classes whose boundaries are set when there are relatively big jumps in the data values.
String
base_output_zone
(Optional)

Defines the lowest zone value on the output raster dataset.

The default value is 1.

Long

Return Value

NameExplanationData Type
out_raster

The output reclassified raster.

The output will always be of integer type.

Raster

Code sample

Slice example 1 (Python window)

Reclassify the input raster into five classes based on natural groupings inherent in the data.

import arcpy
from arcpy import env  
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"

outslice = Slice("elevation", 5, "NATURAL_BREAKS") 
outslice.save("C:/sapyexamples/output/elev_slice")
Slice example 2 (stand-alone script)

Reclassify the input raster into ten classes based on natural groupings inherent in the data.

# Name: Slice_Ex_02.py
# Description: Slices a range of values of the input cells of a raster by
#    zones of equal interval or equal area.
# 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 = "elevation"
numberZones = 10
baseOutputZone = 5

# Execute Slice
outSlice = Slice(inRaster, numberZones, "NATURAL_BREAKS", baseOutputZone) 

# Save the output 
outSlice.save("C:/sapyexamples/output/outslice")

Licensing information

  • Basic: Requires Spatial Analyst or 3D Analyst
  • Standard: Requires Spatial Analyst or 3D Analyst
  • Advanced: Requires Spatial Analyst or 3D Analyst

Related topics