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

The Statistics option allows you to build statistics for the output raster dataset. Statistics are required for the raster dataset to perform certain tasks in the application, such as applying a contrast stretch or classifying data. It is not essential to build statistics, since they are calculated the first time they are needed, if they have not already been calculated. It is, however, recommended that you calculate statistics before using the raster dataset if certain features that require statistics are to be used.

## Usage notes

- Statistics are required for a raster dataset to perform certain tasks in the application, such as applying a contrast stretch or classifying data.
- It is recommended that you calculate statistics for raster datasets before using them if you want to use certain features that require statistics.
- The skip factor allows you to speed up the process of calculating statistics by skipping pixels.
- The ignore values apply to the values that will not participate in the statistics calculation. Typically, you can ignore the values of the background.
- The skip factors for raster datasets stored in a 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 specified. 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.
- Review the Raster storage matrix to learn which raster storage formats can be controlled when using this setting.

## Dialog syntax

- Calculate statistics—To calculate statistics, check the check box.
- Statistics skip factor—Choose to skip pixels between samples.
- 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 1 or the last skip factor used.
- 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 dataset. The default is 1 or the last skip factor used.

- Statistics ignore value—One or more ignore values, such as a background value, that will not participate in the statistics calculation. Multiple values are separated by a semicolon.

## Scripting syntax

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

Parameter | Explanation |
---|---|

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) | One or more ignore values, such as a background value, that will not participate in the statistics calculation. Multiple values are separated by a space. |

### Script example

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