Edit Signatures (Spatial Analyst)
Summary
Edits and updates a signature file by merging, renumbering, and deleting class signatures.
Usage
-
The Edit Signatures tool allows the modification of an existing signature file by all or any of the following operations:
- Merging signatures of a set of classes
- Renumbering a signature class ID
- Deleting unwanted signatures
-
The input signature file must be an ASCII signature file. The file can be the output of any Multivariate tool that produces the file containing the required statistical information—for example, Iso Cluster and Create Signatures. The file must have a minimum of two classes. Such a file can be recognized by its .gsg extension.
-
The input signature remap file is an ASCII file consisting of two columns of values per line, separated by a colon. The first column is the value of the original class ID. The second column contains the new class IDs for updating in the signature file. All of the entries in the file must be sorted in ascending order based on the first column
To merge a set of classes, put the same new class ID for the second value for each class ID of that set. Only classes that need to be edited have to be placed in the signature remap file; any class not present in the remap file will remain unchanged. To delete a class signature, use -9999 as the value for the second column of that class. A class ID can also be renumbered to a value that does not exist in the input signature file. The following is an example of an input signature remap file:
2 : 3 4 : 11 5 : -9999 9 : 3
The example above will merge classes 2 and 9 with 3, merge class 4 with 11, and delete class 5.
-
If the input signature file carries names for the class signatures and if the signatures in the input signature remap file are to be merged, the name associated with the value in which to merge will be transferred to the output signature file.
-
If the input is a layer created from a multiband raster with more than three bands, the operation will consider all the bands associated with the source dataset, not just the three bands that were loaded (symbolized) by the layer.
There are several ways you can specify a subset of bands from a multiband raster to use as input into the tool.
- If using the tool dialog box, navigate to the multiband raster using the browse button next to Input raster bands, open the raster, and select the desired bands.
- If the multiband raster is a layer in the Table of Contents, you can use the Make Raster Layer tool create a new multiband layer containing only the desired bands.
- You can also create a new dataset that contains only the desired bands with Composite Bands and use the resulting dataset as input to the tool.
- In Python, the desired bands can be directly specified in the tool parameter as a list.
Syntax
Parameter | Explanation | Data Type |
in_raster_bands [in_raster_band,...] |
The input raster bands for which to edit the signatures. | Raster Layer |
in_signature_file |
Input signature file whose class signatures are to be edited. A .gsg extension is required. | File |
in_signature_remap_file |
Input ASCII remap table containing the class IDs to be merged, renumbered, or deleted. The extension can be .rmp, .asc or .txt. The default is .rmp. | File |
out_signature_file |
The output signature file. A .gsg extension must be specified. | File |
sample_interval (Optional) |
The interval to be used for sampling. The default is 10. | Long |
Code Sample
This example will edit the signature file based on the input remap file.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
EditSignatures("redl123", "c:/sapyexamples/data/zsamp12.gsg",
"c:/sapyexamples/data/zsamp7.rmp",
"c:/sapyexamples/output/redlremap.gsg", "")
This example will edit the signature file based on the input remap file.
# Name: EditSignatures_Ex_02.py
# Description: Edits and updates a signature file by merging, renumbering,
# and deleting class signatures.
# 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 = "redl123"
oldSig = "c:/sapyexamples/data/zsamp12.gsg"
sigRemap = "c:/sapyexamples/data/zsamp7.rmp"
outNewSig = "c:/sapyexamples/output/redlsig.gsg"
interval = ""
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute EditSignatures
EditSignatures(inRaster, oldSig, sigRemap, outNewSig, interval)