ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Batch Calculate Statistics

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Calculates statistics for multiple raster datasets.

Usage

  • Calculating statistics allows ArcGIS applications to properly stretch and symbolize raster data for display.
  • A skip factor controls the portion of the raster that is used when calculating the statistics. The input value indicates the horizontal or vertical skip factor, where a value of 1 will use each pixel and a value of 2 will use every second pixel. The skip factor can only range from 1 to the number of columns/rows in the raster.

  • Calculating statistics on the Esri Grid and the RADARSAT2 formats always uses a skip factor of 1.

  • The skip factors for raster datasets stored in a file geodatabase or an ArcSDE geodatabase are quite different. First, if the x and y skip factors are different, the smaller skip factor will be used for both the x and y skip factors. Second, the skip factor is related to the pyramid level that most closely fits the skip factor chosen. If the skip factor value is not equal to the number of pixels in a pyramid (for example, if the skip factor is 5 and the closest pyramid level is 4 x 4 pixels, which is level 2), the software will round down to the next pyramid level (in this case, 2) and use that value as the skip factor.

  • A skip factor is not used for all raster formats. The raster formats that will calculate statistics and take advantage of the skip factor include TIFF, IMG, NITF, DTED, RAW, ADRG, CIB, CADRG, DIGEST, GIS, LAN, CIT, COT, ERMapper, ENVI DAT, BIL, BIP, BSQ, and geodatabase.

  • The Ignore Values option allows you to exclude a specific value from the calculation of statistics. You may want to ignore a value if it is a NoData value or if it will skew your calculation.

Syntax

BatchCalculateStatistics_management (Input_Raster_Datasets, {Number_of_columns_to_skip}, {Number_of_rows_to_skip}, {Ignore_values}, {Skip_Existing})
ParameterExplanationData Type
Input_Raster_Datasets
[input_raster_dataset,...]

The input raster datasets.

Raster Dataset
Number_of_columns_to_skip
(Optional)

The number of horizontal pixels between samples.

The value must be greater than zero and less than or equal to the number of columns in the raster. The default is 1 or the last skip factor used.

The skip factors for raster datasets stored in a file geodatabase or an ArcSDE geodatabase are different. First, if the x and y skip factors are different, the smaller skip factor will be used for both the x and y skip factors. Second, the skip factor is related to the pyramid level that most closely fits the skip factor chosen. If the skip factor value is not equal to the number of pixels in a pyramid layer, the number is rounded down to the next pyramid level, and those statistics are used.

Long
Number_of_rows_to_skip
(Optional)

The number of vertical pixels between samples.

The value must be greater than zero and less than or equal to the number of rows in the raster. The default is 1 or the last y skip factor used.

The skip factors for raster datasets stored in a file geodatabase or an ArcSDE geodatabase are different. First, if the x and y skip factors are different, the smaller skip factor will be used for both the x and y skip factors. Second, the skip factor is related to the pyramid level that most closely fits the skip factor chosen. If the skip factor value is not equal to the number of pixels in a pyramid layer, the number is rounded down to the next pyramid level, and those statistics are used.

Long
Ignore_values
[ignore_value,...]
(Optional)

The pixel values that are not to be included in the statistics calculation.

The default is no value.

Double
Skip_Existing
(Optional)

Specify whether to calculate statistics only where they are missing or regenerate them even if they exist.

  • OVERWRITE —Statistics will be calculated even if they already exist; therefore, existing statistics will be overwritten. This is the default.
  • SKIP_EXISTING —Statistics will only be calculated if they do not already exist.
Boolean

Code sample

BatchCalculateStatistics example 1 (Python window)

This is a Python sample for BatchCalculateStatistics.

import arcpy
arcpy.BatchCalculateStatistics_management(
     "C:/data/img1.tif;C:/data/img2.jp2",
     "5", "5", "0;255", "SKEP_EXISTING")
BatchCalculateStatistics example 2 (stand-alone script)

This is a Python script sample for BatchCalculateStatistics.

#Calculate Statistics for multiple raster datasets with 
#multiple ignore values. 
#Skip datasets that already have the statistics.

import arcpy
arcpy.env.workspace = "C:/Workspace"

    
inras = "image1.tif;image2.img;fgdb.gdb/image3"
skipcol = "5"
skiprow = "5"
ignoreval = "0;255;21"
skipexist = "SKIP_EXISTING"

arcpy.BatchCalculateStatistics_management(
     inras, skipcol, skiprow, ignoreval,skipexist)

Environments

  • Current Workspace
  • Scratch Workspace

Licensing information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Raster toolset
  • Environment settings for raster data
  • Raster data statistics
  • Calculating statistics using geoprocessing tools
  • Calculating statistics in ArcCatalog
  • Setting the statistics settings for the geoprocessing environment
  • Set Raster Properties
  • Build Pyramids And Statistics

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal