Band Collection Statistics (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Calculates the statistics for a set of raster bands.

Learn more about how Band Collection Statistics works

Usage

Syntax

BandCollectionStats (in_raster_bands, out_stat_file, {compute_matrices})
ParameterExplanationData Type
in_raster_bands
[in_raster_band,...]

The input raster bands.

Raster Layer
out_stat_file

The output ASCII file containing the statistics.

A .txt extension is required.

File
compute_matrices
(Optional)

Specifies whether covariance and correlation matrices are calculated.

  • BRIEF Only the basic statistical measures (minimum, maximum, mean, and standard deviation) will be calculated for every layer. This is the default.
  • DETAILED In addition to the standard statistics calculated with {BRIEF}, the covariance and correlation matrices will also be determined.
Boolean

Code Sample

BandCollectionStatistics example 1 (Python window)

This example calculates the statistics for a set of raster bands.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
BandCollectionStats("redlands", "c:/sapyexamples/output/redbandstats.txt", "BRIEF")
BandCollectionStatistics example 2 (stand-alone script)

This example calculates the statistics for a set of raster bands.

# Name: BandCollectionStats_Ex_02.py
# Description: Calculates the statistics for a set of raster bands.
# 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
inRasterBand1 = "sb/sbc1"
inRasterBand2 = "sb/sbc2"
outStatFile = "C:/sapyexamples/output/bandstatfile.txt"

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

# Execute BandCollectionStats
BandCollectionStats([inRasterBand1, inRasterBand2], outStatFile, "DETAILED")

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
11/8/2012