HOW TO

Steps for finding the percentage of a particular cell value within a defined focal neighborhood.

- Create an intermediate grid with values of 1 where the input grid meets your desired condition, and 0 or NODATA everywhere else.
- Use the FOCALSUM function, with the DATA option on the intermediate grid, to determine the number of cells in the focal neighborhood that have a value of 1.
- Divide the sum by the number of cells in the focal neighborhood for the percentage.
**Code:**

PERCENTAGE_GRID = FOCALSUM( con( <input_grid> == <value>, 1 ), RECTANGLE, 3, 3, DATA) / 9

**Note:**

The above example nests the three steps into one expression, which determines the percentage of <value> within a 3 by 3 focal area containing 9 cells.

Get help from ArcGIS experts

Download the Esri Support App