RemapRange (arcpy.sa)

Summary

A list identifying what ranges of input values should be reclassified to in an output raster.

Illustration

Example RemapRange remap table image
Example RemapRange remap table for the Reclassify functions.

Discussion

The RemapRange object can be used in the Reclassify tool and the WOTable class.

The input values to remap can be either integer or floating point.

The old values can be assigned to NoData by entering NoData (a string) as the newValue for the startValue to endValue range.

Reclassifying a range of values is usually done when the input values are continuous, for example, elevation or distance, or when changing groups of categorical data as in the land-use example above.

To reclassify individual values to new values, make the startValue and endValue the same (to the desired value to reclassify).

The input ranges of values should not overlap except at the boundary of two input ranges. When overlapping occurs, the higher end of the lower input range is inclusive, and the lower end of the higher input range is exclusive. For example:

1 3 : 5   (where  1 <= value <= 3, values remapped to 5)
3 5 : 3   (where  3 <  value <= 5, values remapped to 3)
5 7 : 1   (where  5 <  value <= 7, values remapped to 1)

Syntax

RemapRange (remapTable)
ParameterExplanationData Type
remapTable
[[startValue, endValue, newValue],...]

The remap table to be used to remap the old values (specified by ranges) to new values.

It defines a list of input values, specified by ranges, to be reclassified to new values. It is a list of lists, with the inner lists being composed of three components.

The components are:

  • startValue—The lower boundary of the range of values to be assigned a new output value. (data type: double)
  • endValue—The upper boundary of the range of values to be assigned a new output value. (data type: double)
  • newValue—The new value to be assigned to the range of input values defined by the start and end values. (data type: integer)

List

Properties

PropertyExplanationData Type
remapTable
(Read and Write)

The remap table that is used to remap the original values to new values.

List

Code Sample

RemapRange example 1 (Python window)

Demonstrates how to create a RemapRange class and use it in the Reclassify tool within the Python window.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myRemapRange = RemapRange([[-3, 0, 0], [0, 1.75, 25], [1.75, 3.5, 50],
                            [3.5, 5.25, 75], [5.25, 7, 100]])
outReclassRR = Reclassify("inreclass", "VALUE", myRemapRange)
outReclassRR.save("C:/sapyexamples/output/rclassremran")
RemapRange example 2 (stand-alone script)

Performs a reclassification with the RemapRange class.

# Name: RemapRange_Ex_02.py
# Description: Uses the RemapRange object to execute Reclassify tool.
# 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 = "inreclass"

# Define the RemapValue Object 
myRemapRange = RemapRange([[-3, -1.75, 1], [-1.75, -0.5, 2], [-0.5, 0.75, 3],
                            [0.75, 2, 4], [2, 3.25, 5], [3.25, 4.5, 6],
                            [4.5, 5.75, 7], [5.75, 7, 8]])

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

# Execute Reclassify
outReclassRR = Reclassify(inRaster, "VALUE", myRemapRange)

# Save the output 
outReclassRR.save("C:/sapyexamples/output/reclassreran2")

Related Topics

3/7/2014