StatisticsHistogram

Summary

Computes the statistics and histogram of a raster.

Discussion

For more information about how this function works, see the Statistics and Histogram raster function.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

Syntax

StatisticsHistogram (raster, statistics, histogram)
ParameterExplanationData Type
raster

The input raster.

Raster
statistics

List of statistical information, based on predefined statistics for each band. Statistics specified for a single-band raster are, for example: statistics = [{"min": 0, "max": 23.06, mean": 4.547517, "standardDeviation": 2.6870, "count": 10000, "median": 5, "mode": 6}].

Statistics specified for a three-band raster are, for example: statistics = [{"min": 0, "max": 23.06, "mean": 4.547517, "standardDeviation": 2.6870, "count": 10000, "median": 5, "mode": 6}, {"min":2, "max": 25, "mean": 5.32, "standardDeviation": 3.42, "count": 10000, "median": 6, "mode": 6}, {"min": 5, "max": 53.06, "mean": 35.23, "standardDeviation": 6.3270, "count": 10000, "median": 36, "mode": 6}].

List
histogram

Dictionary of histogram information, based on predefined histogram for each band.

Enter the dictionary of histogram information using the example below:

{
  "rasterFunction": "StatisticsHistogram",
  "rasterFunctionArguments": {
    "histograms": [{
      "size": 256,
      "min": 0,
      "max": 23.064547032777931,
      "counts": [559,
        172,
        217,
        ... //256 elements for each of the bins in this example
     ]
   }]
Dictionary
Return Value
Data TypeExplanation
Raster

The output raster with the statistics and histogram defined.

Code sample

StatisticsHistogram example

Computes the statistics and histogram of a raster.

import arcpy

StatisticsHistogram_raster = arcpy.sa.StatisticsHistogram(imagePath1, [-4.514, 4.338, 0.0043, 1.0], None)

Related topics