Class Probability (Spatial Analyst)


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



ClassProbability (in_raster_bands, in_signature_file, {maximum_output_value}, {a_priori_probabilities}, {in_a_priori_file})
ParameterExplanationData Type

The input raster bands.

Raster bands can be integer or floating point.

Raster Layer

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

A .gsg extension is required.


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

By default, the values range from 0 to 100.


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.

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.


Return Value

NameExplanationData Type

The output multiband raster dataset.

If the output is an ESRI GRID, the filename cannot have more than 9 characters.


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 import *
env.workspace = "C:/sapyexamples/data"
outClassProbability = ClassProbability("redlands","C:/sapyexamples/data/wedit5.gsg",
ClassProbability example 2 (stand-alone script)

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

# Name:
# Description: Creates probability layers for each class in a signature file.
# Requirements: Spatial Analyst Extension
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env
from 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

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

# Save the output"c:/sapyexamples/output/classprob01")


Related Topics

Licensing Information

ArcView: Requires Spatial Analyst
ArcEditor: Requires Spatial Analyst
ArcInfo: Requires Spatial Analyst