Reclass by ASCII File (Spatial Analyst)
Summary
Reclassifies (or changes) the values of the input cells of a raster using an ASCII remap file.
Usage
-
The input raster must have valid statistics. If the statistics do not exist, they can be created using the Calculate Statistics tool in the Data Management Tools toolbox.
-
The output raster will always be of integer type. If the output assignment values in the ASCII file are floating-point values, an error message will be returned and the program will halt.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The input raster to be reclassified. | Raster Layer |
in_remap_file |
ASCII remap file defining the single values or ranges to be reclassified and the values they will become. Allowed extensions for the ASCII remap files are .rmp, .txt, and .asc. | File |
missing_values (Optional) |
Denotes whether missing values in the reclass file retain their value or get mapped to NoData.
| Boolean |
Return Value
Name | Explanation | Data Type |
out_raster |
The output reclassified raster. The output will always be of integer type. | Raster |
Code Sample
example uses an ASCII remap file to reclassify the input raster.
import arcpy
from arcpy.sa import *
from arcpy import env
env.workspace = "C:/sapyexamples/data"
outReclass = ReclassByASCIIFile("slope","remapslope.rmp")
outReclass.save("C:/sapyexamples/output/recslope")
This example uses an ASCII remap file to reclassify the input raster.
# Name: reclassbyasciifile_example02.py
# Description: Reclassifies values of the input raster using an ASCII remap file
# 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 = "slope"
inRemapFile = "remapslope.rmp"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute Reclassify
outRaster = ReclassByASCIIFile(inRaster, inRemapFile)
# Save the output
outRaster.save("C:/sapyexamples/output/recslope")