Class Probability (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Creates a multiband raster of probability bands, with one band being created for each class represented in the input signature file.

Learn more about how Class Probability works

Usage

Syntax

ClassProbability (in_raster_bands, in_signature_file, {maximum_output_value}, {a_priori_probabilities}, {in_a_priori_file})
ParameterExplanationData Type
in_raster_bands
[in_raster_band,...]

The input raster bands.

Raster bands can be integer or floating point.

Raster Layer
in_signature_file

Input signature file whose class signatures are used to generate the a priori probability bands.

A .gsg extension is required.

File
maximum_output_value
(Optional)

Factor for scaling the range of values in the output probability bands.

By default, the values range from 0 to 100.

Long
a_priori_probabilities
(Optional)

Specifies how a priori probabilities will be determined.

  • EQUAL All classes will have the same a priori probability.
  • SAMPLE A priori probabilities will be proportional to the number of cells in each class relative to the total number of cells sampled in all classes in the signature file.
  • FILEThe a priori probabilities will be assigned to each class from an input ASCII a priori probability file.
String
in_a_priori_file
(Optional)

A text file containing a priori probabilities for the input signature classes.

An input for the a priori probability file is only required when the FILE option is used.

The extension for the a priori file can be .txt or .asc.

File

Return Value

NameExplanationData Type
out_multiband_raster

The output multiband raster dataset.

If the output is an Esri Grid, the filename cannot have more than 9 characters.

Raster

Code Sample

ClassProbability example 1 (Python window)

This example creates a multiband raster of probability bands for each class in a signature file.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outClassProbability = ClassProbability("redlands","C:/sapyexamples/data/wedit5.gsg",
                    100,"EQUAL","")
outClassProbability.save("c:/sapyexamples/output/classprob")
ClassProbability example 2 (stand-alone script)

This example creates a multiband raster of probability bands for each class in a signature file.

# Name: ClassProbability_Ex_02.py
# Description: Creates probability layers for each class in a signature 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 = "redl123"
inSigFile = "c:/sapyexamples/data/wedit5.gsg"
maxValue = 100
aPrioriWeight = "EQUAL"
aPrioriFile = ""

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

# Execute ClassProbability
outClassProbability = ClassProbability(inRaster,inSigFile,
                    maxValue, aPrioriWeight, aPrioriFile)

# Save the output 
outClassProbability.save("c:/sapyexamples/output/classprob01")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst
4/10/2014