Show Navigation | Hide Navigation
You are here:
Extensions > Spatial Analyst > Spatial Analyst functional reference > Reclass (Spatial Analyst)

Slice

Release 9.2
Last modified January 3, 2008
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Reclass (Spatial Analyst)"


Related Topics

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

Learn more about how Slice works


Usage tips

Command line syntax
An overview of the Command Line window
Slice_sa <in_raster> <out_raster> <number_zones> {EQUAL_INTERVAL | EQUAL_AREA | NATURAL_BREAKS} {base_output_zone}

Parameter Explanation Data Type
<in_raster>

An input Raster, RasterDataset, RasterBand, or RasterDescriptor.

Composite Geodataset
<out_raster>

The raster to be created.

Raster Dataset
<number_zones>

When the Slice method is Equal_Area, the output raster will have number_zones with a similar number of cells in each.

When Equal_Interval is used, the output raster will have number_zones, each containing equal value ranges on the output raster.

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

Long
{EQUAL_INTERVAL | EQUAL_AREA | NATURAL_BREAKS}

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 number_zones. Each zone on the sliced output raster has the potential of having input cell values that have the same range from the extremes.
  • EQUAL_AREA  — Specifies that the input values will be divided into the number of zones specified by number_zones with each zone having a similar number of cells (each zone represents 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_output_zone}

Defines the lowest zone value on the output raster dataset.

The default value is one.

Long
Data types for geoprocessing tool parameters


Command line example

Slice_sa c:/data/ras_1 c:/data/final_1 3 EQUAL_INTERVAL 1

Scripting syntax
About getting started with writing geoprocessing scripts
Slice_sa (in_raster, out_raster, number_zones, slice_type, base_output_zone)

Parameter Explanation Data Type
in_raster (Required)

An input Raster, RasterDataset, RasterBand, or RasterDescriptor.

Composite Geodataset
out_raster (Required)

The raster to be created.

Raster Dataset
number_zones (Required)

When the Slice method is Equal_Area, the output raster will have number_zones with a similar number of cells in each.

When Equal_Interval is used, the output raster will have number_zones, each containing equal value ranges on the output raster.

When Natural_Breaks is used, the output raster will have number_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_INTERVAL  — Determines the range of the input values and divides the range into number_zones. Each zone on the sliced output raster has the potential of having input cell values that have the same range from the extremes.
  • EQUAL_AREA  — Specifies that the input values will be divided into the number of zones specified by number_zones with each zone having a similar number of cells (each zone represents 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_output_zone (Optional)

Defines the lowest zone value on the output raster dataset.

The default value is one.

Long

Data types for geoprocessing tool parameters


Script example

# Slice.py
# Description:
#   Slices a range of values of the input cells of a raster by
#   zones of equal interval or equal area.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005
# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

try:
    # Set the input files
    inRaster = "c:/data/ras_1"

    # Set the output raster name
    outRaster = "c:/data/final_1"

    # Check out ArcGIS Spatial Analyst extension license
    gp.CheckOutExtension("Spatial")

    # Set the base zone value and the number of slices
    baseZoneForInput = 1
    numberOfSlices = 3

    # Process: Slice
    gp.Slice_sa(inRaster, outRaster, numberOfSlices, "EQUAL_INTERVAL", baseZoneForInput)

except:
    # If an error occurred while running a tool, then print the messages
    print gp.GetMessages()

Map Algebra syntax
Slice(<grid>, TABLE, <remap_table>, {in_item}, {out_item}, {in_min})

Slice(<grid>, EQAREA, {nzones}, {base_zone#}, {in_min}, {in_max})

Slice(<grid>, EQINTERVAL, {nzones}, {base_zone#}, {in_min}, {in_max})

Slice(<grid>, NATURALBREAKS, {nzones}, {base_zone#}, {in_min}, {in_max})

The differences in the usages are the types of remapping the function performs according to the keywords. The usage utilizing the TABLE keyword remaps data using a step function with a remap table. EQAREA slices data using an equal area criterion — all zones must have similar area on the output. EQINTERVAL slices data into fixed, specified intervals. NATURALBREAKS specifies that the classes will be based on natural groupings inherent in the data.

Parameter Explanation
<grid> An input integer, floating-point raster, or an expression resulting in a raster.
The values contained in this raster will be the values that are sliced.
TABLE Keyword specifying that a remap table will be used in the slicing process.
<remap_table> An ASCII or INFO remap table specifying which values are to be changed and to what output values.
See How Slice works for the format of a remap table.
{in_item} Specifies the input item in an INFO remap table.
The values in {in_item} specify the levels into which the raster will be sliced. This option is not available if the remap table is an ASCII file.
{out_item} Specifies the output item in an INFO remap table.
The values in {out_item} specify the output values for each level after slicing. This option is not available if the remap table is an ASCII file.
{in_min} A number that identifies the minimum value from the input raster for slicing.
If the keyword TABLE is used when an input value for a cell location is below the {in_min} number, the cell will be assigned NoData and won't be considered in the slice calculations.
When the keywords EQAREA, EQINTERVAL, and NATURALBREAKS are used, the cells with values smaller than the {in_min} value will be assigned NoData and won't be considered in the calculations. The output results will vary depending on the number of input values on the input raster that exceeds the {in_min} value.
EQAREA Keyword specifying that the input values will be divided into the numbers of zones specified by {nzones} with each zone having a similar number of cells — each zone represents a similar amount of area.
{nzones} Defines the number of zones that should be used with the calculations of equal area, equal interval, and natural breaks slicing methods.
When the keyword EQAREA is used, the output raster will have {nzones} with a similar number of cells. When the keyword EQINTERVAL is used, the output raster will have {nzones}, each containing equal value ranges on the output raster. When the keyword NATURALBREAKS is used, the output raster will have {nzones} based on inherent groupings in the data.
{base_zone#} An integer that defines the lowest zone value on the output raster.
When the keywords EQAREA, EQINTERVAL, and NATURALBREAKS are used, the number that is input for the {base_zone#} identifies the value to assign to the output sliced zones. The zones will begin with the value assigned to the {base_zone#} and increment by one.
If no {base_zone#} is specified, Slice will begin the value assignment at one.
{in_max} A number that identifies the maximum acceptable value from the input raster.
When the keywords EQAREA, EQINTERVAL, and NATURALBREAKS are used, the cells with values above the {in_max} number will be assigned NoData and won't be considered in the area and interval slice calculations. The output results will vary depending on the number of input values on the input raster that exceed {in_max}.
EQINTERVAL The EQINTERVAL slice determines the range of the input values and divides the range into {nzones}.
Each zone on the sliced output raster has the potential of having input cell values that have the same range from the extremes.
NATURALBREAKS Keyword specifying 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 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.

Map Algebra example

slice(ingrid1, TABLE, remap_tab)
slice(ingrid1, table, remap_tab, #, #, 10)
slice(ingrid1, EQAREA, 5)
slice(ingrid1, eqarea, 10, 3, 20, 500)
slice(ingrid1, eqinterval, 20)
slice(ingrid1, EQINTERVAL, 15, #, 20)

ArcObjects syntax
IReclassOp::Slice (geoDataset As IGeoDataset, sliceType As esriGeoAnalysisSliceEnum, zoneCount As Long, [baseZone As Variant]) As IGeoDataset

Parameter Explanation
geoDataset An input Raster, RasterDataset, RasterBand, or RasterDescriptor.
The values contained in this raster will be the values that are sliced.
sliceType An esriGeoAnalysisSliceEnum specifying the manner in which to slice the values in the input geoDataset.
  • EsriGeoAnalysisSliceEqualArea  — EqualArea specifies that the input values will be divided into the number of zones specified by zoneCount with each zone having a similar number of cells — each zone represents a similar amount of area.
  • EsriGeoAnalysisSliceEqualInterval  — The EqualInterval slice determines the range of the input values and divides the range into zoneCounts. Each zone on the sliced output raster has the potential of having input cell values that have the same range from the extremes.
  • EsriGeoAnalysisSliceNaturalBreaks  — The NaturalBreaks slice 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 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.
zoneCount Defines the number of zones that should be used with the calculations of equal area and equal interval slicing methods.
When the sliceType EqualArea is used, the output raster will have zoneCounts with similar numbers of cells. When the sliceType EqualInterval is used, the output raster will have zoneCounts, each containing equal value ranges on the output raster. When the sliceType NaturalBreaks is used, the output raster will have zoneCounts with the number of cells in each determined by the class breaks.
baseZone An integer that defines the lowest zone value on the output raster.
When the sliceTypes EqualArea, EqualInterval, and NaturalBreaks are used, the number that is input for the baseZone identifies the value to assign to the output sliced zones. The zones will begin with the value assigned to the baseZone and increment by one.
If no base zone is specified, Slice will begin the value assignment at one.

ArcObjects example

' Create the RasterReclassOp object
Dim pReclassOp As IReclassOp
Set pReclassOp = New RasterReclassOp

' Declare the input raster object
Dim pInputDataset As IGeoDataset

' Calls function to open a raster dataset from disk
Set pInputDataset = OpenRasterDataset("D:\SpatialData", "inputdataset")

' Declare the output raster object
Dim pOutputRaster As IGeoDataset

' Calls the method	
Set pOutputRaster = pReclassOp.Slice(pInputDataset, esriGeoAnalysisSliceEqualArea, 10)

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.