xrspatial.edge_detection.sobel_x#

xrspatial.edge_detection.sobel_x(agg, name='sobel_x', boundary='nan')[source]#

Compute the horizontal gradient of a raster using the Sobel operator.

Detects vertical edges by convolving with the Sobel-X kernel:

[[-1, 0, 1],
 [-2, 0, 2],
 [-1, 0, 1]]
Parameters:
  • agg (xarray.DataArray) – 2D raster. Supports NumPy, CuPy, Dask+NumPy, and Dask+CuPy backends.

  • name (str, default='sobel_x') – Name for the output DataArray.

  • boundary (str, default='nan') – How to handle edges: ‘nan’, ‘nearest’, ‘reflect’, or ‘wrap’.

Returns:

Horizontal gradient with the same shape and backend as the input.

Return type:

xarray.DataArray