How Block Statistics works
The Block Statistics tool performs a neighborhood operation that calculates a statistic for input cells within a fixed set of non-overlapping windows or neighborhoods. The statistic (for example, maximum, average, or sum) is calculated for all input cells contained within each neighborhood. The resulting value for an individual neighborhood or block is assigned to all cell locations contained in the minimum bounding rectangle of the specified neighborhood.
Since the neighborhoods do not overlap, any particular cell will be included in the calculations for one block only.
The shape of a neighborhood can be an annulus (a donut), circle, rectangle, or wedge. The possible statistics that can be calculated within a neighborhood are mean, majority, maximum, median, minimum, minority, range, standard deviation, sum, and variety.
Conceptually, the Block Statistics tool works as follows:
- It creates the first specified neighborhood—for example, a circular neighborhood—in the top left corner of the analysis window.
- It calculates the minimum bounding rectangle to determine the size of the output block.
- It partitions the remaining area of the raster into defined blocks. Blocks cannot overlap.
- It identifies in each block the cell locations that will be used in the block calculations. The cell locations are determined by the definition of the specified neighborhood—for example, a circular neighborhood—that fits into the bounding rectangle.
- It calculates the output value for each neighborhood of each block. The resultant values are assigned to every cell location in the corresponding output block.
The shape of a neighborhood can be an annulus (a donut), circle, rectangle, or wedge. By using a kernel file, you can also define a custom neighborhood shape, as well as assign different weights to specific cells in the neighborhood before the statistic is calculated.
Following is a discussion of the different neighborhood shapes and how they are defined:
Uses for block statistics
The Block Statistics tool can be used instead of the Resample tool to resample a raster from a fine resolution to a coarser one. Instead of using the nearest neighbor, bilinear, or cubic resampling techniques, it may be preferable to assign the coarser raster cells the maximum, minimum, or average of the values in the new geographic extent that the coarser cells encompass. To do so, the appropriate statistics are applied to the block—the average (mean) or maximum, for example.
The Aggregate tool from the Generalization toolset is similar to Block Statistics in that it allows for the aggregation of cell locations based on the sum, mean, median, or minimum or maximum values within a spatial window, which is determined by the desired output resolution. There are two major differences between the two options, however:
- The output raster resulting from the Aggregate tool is resampled to the desired resolution.
- There is no concept of a specified neighborhood in the Aggregate tool. The neighborhood and the output block are the same, are always rectangular, and encompass the same cell locations. The size of the block in the Aggregate tool is determined by the aggregation of cells necessary to reach the desired resolution.