hydromodpy.core.units.parse#

Pint-based helpers to parse TOML-style unit payloads.

The normalizers that live alongside flow configs receive raw user input such as 12.5, "12.5 m" or "12.5" paired with an explicit unit= field. This module converts them into a canonical magnitude using the shared hydromodpy.core.units.UREG, so that call sites stop depending on the per-quantity factor tables (parse_to_m / parse_to_m2_per_s / …).

Functions

canonical_unit_short_form(unit, *, ...)

Return the pint short-form alias of unit (e.g. "centimeter" -> "cm").

check_unit_compatible(unit, *, ...)

Validate that unit is convertible to canonical_unit.

parse_to_canonical_magnitude(value, *, ...)

Parse one scalar + unit payload into a float magnitude in canonical_unit.