weac.parser.utils.layer_binning module¶
Group a windowed density profile into WEAC slab layers.
Shared binning helper for the parser package (used by the SMP bin mode and,
later, SnowScope / gradient modes). The input is a depth-ordered
(surface -> ground) density series; the output is Layer
objects in that same top-down order.
Binning model¶
Each sample owns a “cell” whose thickness is the spacing to the next sample (the
native Loewe hop for SMP); the final sample repeats the last spacing so every
sample contributes a cell. Layers are contiguous runs of cells, so
sum(layer.h) equals the summed cell thickness (times depth_scale).
Thickness (Layer.h) is scaled by depth_scale to convert a plumb probe
depth to WEAC’s slope-normal thickness; density (Layer.rho) is the
cell-thickness-weighted mean over the run.
- weac.parser.utils.layer_binning.bin_profile_to_layers(depth_mm, density_kg_m3, *, layer_thickness_mm=None, min_thickness_mm=1.0, depth_scale=1.0)[source]¶
Bin a density profile into WEAC slab layers (top-down).
- Parameters:
depth_mm (ndarray) – Depth-ordered (surface -> ground) sample positions [mm].
density_kg_m3 (ndarray) – Density at each sample [kg m^-3]; same shape as
depth_mm.layer_thickness_mm (float | None) – Target layer thickness.
Nonegroups at the native sample spacing (each cell is its own layer) subject to themin_thickness_mmfloor; a value groups adjacent cells until each run reaches roughly that thickness.min_thickness_mm (float) – Minimum layer thickness [mm]. Adjacent cells are merged until a run reaches this floor; a trailing remainder below the floor is folded into the previous layer.
depth_scale (float) – Plumb -> slope-normal factor applied to every
h(cos(phi));1.0leaves thicknesses unscaled.
- Returns:
Layers ordered surface -> ground.
sum(layer.h)equals the summed cell thickness timesdepth_scale.- Return type:
list[Layer]