fastfocal: accelerating moving-window raster operations through the Fast Fourier Transform in R

Read full text
Authors: Ho Yi Wan
Cited by: 0
References: 14

Abstract

Moving-window (focal) operations are central to spatial statistics and image processing but become computationally prohibitive for large rasters or wide neighborhoods. fastfocal is an open-source R package that accelerates additive focal calculations (i.e., sum and mean) using the Fast Fourier Transform (FFT). The software preserves computational accuracy while substantially reducing runtime and energy use for large rasters and wide neighborhoods. Because FFT-based convolution is most advantageous for large kernels, fastfocal includes an adaptive “smart switch” that automatically selects between direct spatial-domain computation and FFT-based convolution depending on raster and kernel size, ensuring comparable performance for small neighborhoods and substantial gains for larger ones. Benchmark results indicate that performance gains begin to emerge for kernel radii of approximately 400–500 m (i.e., 13 to 17 cells in radius at 30 m resolution), with increasingly larger gains for wider neighborhoods and larger rasters. For large rasters and wide kernels, fastfocal reduced computation time by roughly 75% and energy consumption by ∼75% compared with widely used reference implementations. By enabling rapid, large-scale focal operations in standard R workflows, fastfocal makes multi-scale spatial analysis more practical and energy efficient.

Fields of Study & Subjects

Data Analysis with R Spatial and Panel Data Analysis Digital Image Processing Techniques

Publication details

Journal / source
SoftwareX
Volume
34
Pages
102604–102604
Publication date
13 March 2026
Language
EN