xrspatial.morphology.morph_white_tophat#

xrspatial.morphology.morph_white_tophat(agg, kernel=None, boundary='nan', name='white_tophat')[source]#

White top-hat: original minus opening.

Isolates bright features that are smaller than the structuring element.

Parameters:
  • agg (xarray.DataArray) – 2D raster of numeric values.

  • kernel (numpy.ndarray or None) – 2D structuring element with odd dimensions. Defaults to a 3x3 square.

  • boundary (str, default 'nan') – Edge handling: 'nan', 'nearest', 'reflect', or 'wrap'.

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

Returns:

White top-hat raster (original - opening).

Return type:

xarray.DataArray

Examples

>>> from xrspatial.morphology import morph_white_tophat
>>> bright = morph_white_tophat(elevation, kernel=circle_kernel)