Raster statistics (Environment setting)

Tools that honor the Raster Statistics environment control how statistics are built for output raster datasets.

The Statistics option enables you to build statistics for the output raster dataset. Statistics are required for the raster dataset to perform certain tasks in ArcMap or ArcCatalog, such as applying a contrast stretch or classifying data. It is not essential to build statistics at this point, since they are calculated the first time they are needed, if they have not already been calculated. It is, however, recommended that you calculate raster datasets before using them if certain features that require statistics are to be used. The default display of a raster in ArcMap or ArcCatalog will be improved in most cases if statistics have already been calculated, because a standard deviation stretch is applied if statistics are present. In other cases, if the data to be displayed shouldn't be displayed with stretch by default, it would be appropriate not to calculate statistics for the dataset.

Setting a skip factor speeds up the process of calculating statistics by skipping pixels. Ignore values applies to the values that will not participate in the statistics calculation. Normally, you may want to ignore the values of the background. This setting is used for tools that create raster datasets in ArcGIS. Refer to the Raster Storage Matrix to see which raster storage formats can be controlled when using this setting.

Usage notes

Dialog syntax

Scripting syntax

arcpy.env.rasterStatistics = "calculate_statistics {x_skip_factor} {y_skip_factor} {statistics_ignore_value}"



calculate_statistics (Required)

To calculate statistics, use STATISTICS; otherwise, specify NONE.

x_skip_factor (Optional)

The skip factor for the X axis.

y_skip_factor (Optional)

The skip factor for the Y axis.

statistics_ignore_value (Optional)

An ignore value, such as a background value, that will not participate in the statistics calculation. The ignore value is entered in round brackets.

rasterStatistics syntax
import arcpy

# Statistics using a skip factor of 100 for x and y, and 
#   an ignore value of 0.
arcpy.env.rasterStatistics = 'STATISTICS 100 100 (0)'	

Related Topics