Calculate Statistics (Data Management) |
|
Release 9.2
Last modified November 29, 2010 |
![]() ![]() ![]() Print all topics in : "Tools" |
Calculates statistics for a raster dataset.
Statistics are required for your raster dataset to perform certain tasks, such as applying a contrast stretch or classifying your data.
Usage tips
Command line and Scripting
Calculating statistics for a raster is required for rendering your raster dataset with any sort of contrast stretch.
A skip factor is the parameter that controls the portion of the raster dataset that is used when calculating the statistics. The input value indicates the horizontal or vertical skip factor, where a factor of one will use each pixel and a value of two will use every second pixel. The skip factor can only range from one to the number of columns/rows.
The skip factors for raster datasets stored in a file geodatabase or an ArcSDE geodatabase are quite different. First, if the x and the 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) then 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, ERS, and all geodatabase raster datasets.
Calculating statistics on a grid always uses a skip factor of 1.
The ignore value 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.
The following environment setting affects this tool: current workspace.
Command line syntax
An overview of the Command Line window
CalculateStatistics_management <in_raster_dataset> {x_skip_factor} {y_skip_factor} {ignore_values;ignore_values...}
Parameter | Explanation | Data Type |
<in_raster_dataset> |
The input raster dataset. |
Composite Geodataset |
{x_skip_factor} |
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 dataset. The default is one 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 the 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, then the number is rounded down to the next pyramid level and those statistics are used. |
Long |
{y_skip_factor} |
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 one or the last y skip factor used. For raster datasets in a file or ArcSDE geodatabase, if the skip values are not equal, then the smaller number is used. If skip factor is not equal to a pyramid level, then the value will be rounded down to match a pyramid level. |
Long |
{ignore_values;ignore_values...} |
The pixel values that are not to be included in the statistics calculation. The default is no value or the last ignore values used. |
Long |
CalculateStatistics_management D:\images\OverviewImage.img 2 2 999
Scripting syntax
About getting started with writing geoprocessing scripts
CalculateStatistics_management (in_raster_dataset, x_skip_factor, y_skip_factor, ignore_values)
Parameter | Explanation | Data Type |
in_raster_dataset (Required) |
The input raster dataset. |
Composite Geodataset |
x_skip_factor (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 dataset. The default is one 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 the 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, then the number is rounded down to the next pyramid level and those statistics are used. |
Long |
y_skip_factor (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 one or the last y skip factor used. For raster datasets in a file or ArcSDE geodatabase, if the skip values are not equal, then the smaller number is used. If skip factor is not equal to a pyramid level, then the value will be rounded down to match a pyramid level. |
Long |
ignore_values (Optional) |
The pixel values that are not to be included in the statistics calculation. The default is no value or the last ignore values used. |
Long |
# Create the geoprocessing object import arcgisscripting gp = arcgisscripting.create() gp.workspace = "c:/redlands_data" # Calculate stats with skip factor of 1,1, and ignore value of 0 gp.CalculateStatistics_management("redlands1.tif","1","1","0")
Map Algebra syntax
See BuildSta.
ArcObjects syntax
There is no corresponding ArcGIS Spatial Analyst object to perform calculate statistics for a raster. However, in core ArcGIS, similar functionality can be found in the IRasterStatistics.Recalculate method.
For more information, see ArcObjects Developer Help.