morpho_dem.calculate_maximal_curvature#

calculate_maximal_curvature(dem: ndarray, resolution: float = 1) ndarray[source]#

Compute the maximal curvature (k_max) of a DEM using vectorized calculations.

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

  • resolution (float, optional) – The spatial resolution of the DEM (default is 1.0).

Returns:

A 2D array containing the maximal curvature values.

Return type:

numpy.ndarray

Notes

This function computes the following terms: - p: dz/dx (first derivative in x direction) - q: dz/dy (first derivative in y direction) - r: d²z/dx² (second derivative in x direction) - t: d²z/dy² (second derivative in y direction) - s: d²z/dxdy (second mixed derivative)

The maximal curvature is then computed as: k_max = H + sqrt(H² - K) where: H = -((1 + q²)r - 2pqs + (1 + p²)t) / (2 * (1 + p² + q²)^(3/2)) K = (rt - s²) / (1 + p² + q²)²