weac.parser.utils.knappe_surface module

Knappe surface detection for SnowMicroPen force profiles.

Gradient detector: a 1 mm moving linear regression, Hanning-smoothed, then a threshold of 5× the population standard deviation of the quietest 20 mm inside the first 100 mm (air above the snow). The surface is the first sample after the top 1000 where the gradient exceeds that threshold and the next 1 mm stays above it. The fraction of that window still below the threshold must itself be smaller than the threshold, which rejects isolated noise spikes.

weac.parser.utils.knappe_surface.detect_knappe_surface(samples)[source]

Return the Knappe surface distance in mm along the SMP profile.

samples needs distance and force columns (snowmicropyn’s Profile.samples). Falls back to the first sample when the profile is shorter than the 1 mm window or no surface rises out of the air noise.

Return type:

float