xrspatial.convolution.convolution_2d(agg, kernel)[source]

Calculates, for all inner cells of an array, the 2D convolution of each cell via Numba. To account for edge cells, a pad can be added to the image array. Convolution is frequently used for image processing, such as smoothing, sharpening, and edge detection of images by eliminating spurious data or enhancing features in the data.

  • agg (xarray.DataArray) – 2D array of values to processed and padded.

  • kernel (array-like object) – Impulse kernel, determines area to apply impulse function for each cell.


convolve_agg – 2D array representation of the impulse function.

Return type