xrspatial.morphology.morph_dilate#
- xrspatial.morphology.morph_dilate(agg, kernel=None, boundary='nan', name='dilate')[source]#
Apply morphological dilation (local maximum) to a 2D raster.
Each output cell receives the maximum value found within the structuring element footprint centred on that cell.
- Parameters:
agg (xarray.DataArray) – 2D raster of numeric values.
kernel (numpy.ndarray or None) – 2D structuring element with odd dimensions. Non-zero entries mark the footprint. Defaults to a 3x3 square.
boundary (str, default
'nan') – Edge handling:'nan','nearest','reflect', or'wrap'.name (str, default
'dilate') – Name for the output DataArray.
- Returns:
Dilated raster.
- Return type:
xarray.DataArray
Examples
>>> from xrspatial.morphology import morph_dilate >>> dilated = morph_dilate(raster, kernel=np.ones((5, 5), dtype=np.uint8))