weac.parser.plotting package

Submodules

Module contents

Debug plotting for penetration-resistance-first parsers (SMP, SnowScope).

class weac.parser.plotting.ForcePenetrationParser(*args, **kwargs)[source]

Bases: Protocol

SMP or SnowScope parser with extract_profile / extract_layers.

extract_profile(**kwargs)[source]
Return type:

ForcePenetrationProfile

extract_layers(*args, **kwargs)[source]
Return type:

tuple[list[Layer], list[str]]

__init__(*args, **kwargs)
class weac.parser.plotting.ForcePenetrationProfile(*args, **kwargs)[source]

Bases: Protocol

Profile from SMP or SnowScope (resistance–depth signal plus derived density).

depth_mm: ndarray
penetration_resistance_kPa: ndarray
density_kg_m3: ndarray
density_method: str
__init__(*args, **kwargs)
weac.parser.plotting.plot_force_penetration_layers(profile, layers, *, slope_angle_deg=0.0, depth_axis='plumb', title=None, layer_label='layers', save_path=None, show=True, figsize=(13.0, 6.5))[source]

Plot penetration resistance, density, slope-normal density, and layers on a depth axis.

Parameters:
  • profile (ForcePenetrationProfile) – SMPProfile or SnowScopeProfile (must expose depth_mm, penetration_resistance_kPa, density_kg_m3, density_method).

  • layers (list[Layer]) – WEAC layers ordered surface -> ground (from extract_layers). Layer.h is slope-normal, so the reconstructed staircase is drawn on the slope-normal axis (panels 3-4). For a plumb profile, pass the same slope_angle_deg used to extract the layers so the slope-normal density panel and the staircase share one axis. The staircase bottom overshoots the last sample by one cell because the binning helpers repeat the final sample spacing (an intentional part of their cell model, see layer_binning).

  • slope_angle_deg (float) – Slope angle [deg] for a plumb profile; sets the cos(phi) compression of the slope-normal depth axis. Ignored when depth_axis is "slope-normal" (must stay 0).

  • depth_axis (Literal['plumb', 'slope-normal']) – "plumb" (SnowScope) compresses panels 3-4 by cos(phi). "slope-normal" (SMP) uses the recorded depth as the slope-normal axis with no further scaling.

  • title (str | None) – Figure suptitle; defaults to the density method name.

  • layer_label (str) – Legend/title label for the segmented panel.

  • save_path (str | Path | None) – If given, save the figure (PNG) to this path.

  • show (bool) – Call plt.show() before returning (default True).

  • figsize (tuple[float, float]) – Figure size in inches.

Returns:

The created Figure.

Return type:

Figure

weac.parser.plotting.plot_force_penetration_parser(parser, *, method='bin', slope_angle_deg=0.0, density_method=None, semilog_slope=None, semilog_intercept=None, layer_thickness_mm=None, gradient_threshold=12.0, **plot_kwargs)[source]

Extract from an SMP or SnowScope parser and plot the debug view.

Dispatches to plot_smp_penetration_parser() or plot_snowscope_penetration_parser(). semilog_slope / semilog_intercept and slope_angle_deg apply only to SnowScope (SMP depths are already slope-normal). **plot_kwargs (e.g. title, save_path, show) pass through to plot_force_penetration_layers().

Parameters:
  • parser (ForcePenetrationParser)

  • method (Literal['bin', 'gradient'])

  • slope_angle_deg (float)

  • density_method (str | None)

  • semilog_slope (float | None)

  • semilog_intercept (float | None)

  • layer_thickness_mm (float | None)

  • gradient_threshold (float)

Return type:

Figure

weac.parser.plotting.plot_smp_penetration_parser(parser, *, method='bin', density_method=None, layer_thickness_mm=None, gradient_threshold=12.0, **plot_kwargs)[source]

Extract from an SMP parser and plot the penetration-resistance debug view.

SMP depths are already slope-normal, so this does not accept slope_angle_deg and does not compress the depth axis.

Parameters:
  • parser (SMPParser)

  • method (Literal['bin', 'gradient'])

  • density_method (Literal['P2015', 'CR2020', 'K2020a', 'K2020b'] | None)

  • layer_thickness_mm (float | None)

  • gradient_threshold (float)

Return type:

Figure

weac.parser.plotting.plot_snowscope_penetration_parser(parser, *, method='bin', slope_angle_deg=0.0, density_method=None, semilog_slope=None, semilog_intercept=None, layer_thickness_mm=None, gradient_threshold=12.0, **plot_kwargs)[source]

Extract from a SnowScope parser and plot the penetration-resistance debug view.

Parameters:
  • parser (SnowScopeParser)

  • method (Literal['bin', 'gradient'])

  • slope_angle_deg (float)

  • density_method (Literal['HAGENMULLER2018'] | None)

  • semilog_slope (float | None)

  • semilog_intercept (float | None)

  • layer_thickness_mm (float | None)

  • gradient_threshold (float)

Return type:

Figure