xrspatial.morphology.morph_black_tophat#
- xrspatial.morphology.morph_black_tophat(agg, kernel=None, boundary='nan', name='black_tophat')[source]#
Black top-hat: closing minus original.
Isolates dark 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
'black_tophat') – Name for the output DataArray.
- Returns:
Black top-hat raster (closing - original).
- Return type:
xarray.DataArray
Examples
>>> from xrspatial.morphology import morph_black_tophat >>> dark = morph_black_tophat(elevation, kernel=circle_kernel)