Focal Statistics
Each cell gets a statistic (mean, sum, minimum, ...) of the cells in a window around it.
Pitfall. Cells near the edge have incomplete windows; engines use the partial window, return nodata, or pad.
| Also called | neighborhood statistics, moving window, mean filter, focal mean, r.neighbors |
|---|---|
| Group | raster/neighborhood |
| Checks | raster.nodata |
| Pitfalls | 1 listed above |
| Columbus tool | Not stated |
| Notes | Not stated |
| Status | active |
| Broader | Not stated |
| Narrower | Not stated |
| Related |
Parameters
| Name | Type | Required | Default | Values | Note |
|---|---|---|---|---|---|
statistic | enum | no | mean | mean, sum, min, max, median, std | Not stated |
size | integer | no | 3 | Not stated | Window width in cells (an odd number). |
Inputs and outputs
| Direction | Name | Type | Geometry | Note |
|---|---|---|---|---|
| Input | raster | raster | Not stated | Not stated |
| Output | output | raster | Not stated | Not stated |
In each engine
| Engine | Tool | Parameters | Differences |
|---|---|---|---|
gdal | gdal raster neighbors |
|
Preset: {"kernel":"equal"} |
grass | r.neighbors |
|
|
terra | terra::focal |
|
|
whiteboxtools | MeanFilter |
| None noted |
xarray-spatial | xrspatial.focal.focal_stats |
| None noted |