# Zonal Statistics function

## Overview

Calculates statistics on values of a raster within the zones of another dataset.

A zone is defined as all areas in the input that have the same value. These areas do not have to be contiguous. When the zone and value inputs are both rasters of the same resolution, they will be used directly. If the resolutions are different, an internal nearest neighbor resampling is applied to make the resolutions match to that of the coarser input before the zonal operation is performed.

For more information, see the How the zonal statistics tools work topic in the Spatial Analyst tool help.

This is a global raster function.

## Notes

The Zone Raster must be an integer raster input. If you have feature zones, first convert the feature data into a raster with the Rasterize Features function before using it in this function. Set the cell size and snap raster environment to the Value Raster when converting the feature data to raster.

When specifying the input zone data, the default Zone Field will be the first available integer or text field.

To calculate circular statistics, check the Calculate Circular Statistics parameter, and specify a Circular Wrap Value.

The supported statistics type depends on the data type of the Value Raster, and the statistics calculation type specified by the Calculate Circular Statistics parameter.

The Value Raster can be either integer or floating point. If the data type is integer, arithmetic statistics calculation supports Mean, Majority, Maximum, Median, Minimum, Minority, Percentile, Range, Standard deviation, Sum, and Variety statistics types; circular statistics calculation supports Mean, Majority, Minority, Standard deviation, and Variety statistics types.

If the Value Raster data type is float, arithmetic statistics calculation supports Mean, Maximum, Median, Minimum, Percentile, Range, Standard deviation, and Sum statistics types; circular statistics calculation supports Mean and Standard deviation statistics types.

The data type of the output is dependent on the zonal calculation being performed and the input Value Raster type. See How the zonal statistics tools work in the Spatial Analyst tool help for more information.

For Majority and Minority calculations, when there is a tie, the output is the lowest of the tied values.

## Parameters

Parameter nameDescription

Zone Raster

(Required)

The dataset that defines the zones. The zones can be defined by an integer raster.

Zone Field

(Required)

The field that contains the values that define each zone. It can be an integer or a string field of the zone raster.

Value Raster

(Required)

The raster that contains the values on which to calculate a statistic.

Statistics Type

Specifies the statistic type to be calculated.

• Mean—Calculates the average of all cells in the Value Raster that belong to the same zone as the output cell. This is the default.
• Majority—Determines the value that occurs most often of all cells in the Value Raster that belong to the same zone as the output cell.
• Maximum—Determines the largest value of all cells in the Value Raster that belong to the same zone as the output cell.
• Median—Determines the median value of all cells in the Value Raster that belong to the same zone as the output cell.
• Minimum—Determines the smallest value of all cells in the Value Raster that belong to the same zone as the output cell.
• Minority—Determines the value that occurs least often of all cells in the Value Raster that belong to the same zone as the output cell.
• Percentile—Calculates a percentile of all cells in the Value Raster that belong to the same zone as the output cell. The 90th percentile is calculated by default. You can determine which percentile to calculate with the Percentile Value parameter.
• Range—Calculates the difference between the largest and smallest value of all cells in the Value Raster that belong to the same zone as the output cell.
• Standard Deviation—Calculates the standard deviation of all cells in the Value Raster that belong to the same zone as the output cell.
• Sum—Calculates the total value of all cells in the Value Raster that belong to the same zone as the output cell.
• Variety—Calculates the number of unique values for all cells in the Value Raster that belong to the same zone as the output cell.

Percentile Value

The percentile to calculate. The default is 90, for the 90th percentile.

The value can range from 0 through 100. The 0th percentile is essentially equivalent to the Minimum statistic, and the 100th percentile is equivalent to Maximum. A value of 50 will produce essentially the same result as the Median statistic.

This option is only available if the Statistics type parameter is set to Percentile.

Percentile Interpolation Type

Specifies the method of interpolation to be used when the specified percentile value lies between two input cell values from the input value raster.

• Auto-detect—If the input value raster is of integer pixel type, the Nearest method is used. If the input value raster is of floating point pixel type, the Linear method is used. This is the default.
• Nearest—The nearest available value to the desired percentile is used. In this case, the output pixel type is the same as that of the input value raster.
• Linear—The weighted average of the two surrounding values from the desired percentile is used. In this case, the output pixel type is floating point.

This option is only available if the Statistics type parameter is set to Median or Percentile.

Calculate Circular Statistics

Specifies how the statistics type will be calculated.

• Arithmetic—Calculates arithmetic statistics. This is the default.
• Circular—Calculates circular statistics that are appropriate for cyclic quantities, such as compass direction in degrees, daytimes, and fractional parts of real numbers.

Circular Wrap Value

The highest possible value (upper bound) in the cyclic data. It is a positive number, with a default value of 360. This value also represents the same quantity as the lowest possible value (lower bound).

This parameter is applicable only when circular statistics is calculated.

Ignore NoData in Calculations

Specifies whether NoData values in the Value Raster will influence the results of the zone that they fall within.

• Yes—Within any particular zone, only cells that have a value in the Value Raster will be used in determining the output value for that zone. NoData cells in the Value Raster will be ignored in the statistic calculation. This is the default.
• No—Within any particular zone, if any NoData cells exist in the Value Raster, they will not be ignored, and their existence indicates that there is insufficient information to perform statistical calculations for all the cells in that zone. Consequently, the entire zone will receive the NoData value on the output raster.

Process as Multidimensional

Specifies how the input rasters will be processed if they are multidimensional.

• Current Slice—Statistics will be calculated from the current slice of a multidimensional dataset. This is the default.
• All Slices—Statistics will be calculated for all dimensions (such as time or depth) of a multidimensional dataset.

## Environment settings

Geoprocessing environment settings for global functions are controlled at the application level. Setting processing environments in ArcGIS Pro can be done by clicking the Environments button on the Analysis tab. See Analysis environments and Spatial Analyst for additional details on environment settings.

The following environments are supported by this global function: