morpho_dem.fast_adaptive_gaussian_blur#

fast_adaptive_gaussian_blur(grid: ndarray, curvature: ndarray, cellsize: float, sigma_max: float, num_bins: int = 10) ndarray[source]#

Applies a fast adaptive Gaussian blur by grouping pixels into bins based on local curvature values.

Parameters:
  • grid (numpy.ndarray) – A 2D array representing the Digital Elevation Model (DEM).

  • curvature (numpy.ndarray) – A 2D array of local curvature values corresponding to the DEM.

  • cellsize (float) – The size of the raster cells in meters.

  • sigma_max (float) – The maximum kernel width for the Gaussian blur.

  • num_bins (int, optional) – The number of bins used to approximate the sigma values. Default is 10.

Returns:

A 2D array representing the smoothed DEM after applying the adaptive Gaussian blur.

Return type:

numpy.ndarray

Notes

The function performs the following steps: 1. Calculates the sigma value for each pixel based on the local curvature, limited by sigma_max. 2. Groups pixels into bins according to their sigma values. 3. Applies a Gaussian blur for each bin using a fixed sigma value. 4. Interpolates results to produce a smooth output.

The adaptive Gaussian blur ensures that flat areas are smoothed more aggressively while preserving sharp features like ridges and peaks.