Skip to main content

Module curvature

Module curvature 

Source
Expand description

Profile and planform curvature of a DEM, as a fused kernel.

Mirrors TerraTexture.derivatives’ curvatures() exactly: the same “gradient of gradient” approximation (np.gradient applied twice), the same edge_order=1 boundary handling, and the same Zevenbergen & Thorne curvature formulas. Verified bit-parity against derivatives.py in tests/test_derivatives_rust.py.

§NaN handling

The DEM passed in must be NaN-free. The Python caller nan-fills it first (derivatives.py’s _fill_nan_nearest) and re-masks the NaN/void cells in the outputs afterwards. Rust owns the plain numeric math on a clean f32 array; Python owns the NaN bookkeeping.

Functions§

curvatures_core
Compute profile and planform curvature of a DEM.