mescla.prep.units

Unit conversion for major-ion chemistry.

Mixing algebra is linear in any consistent concentration unit, so Mescla never requires a conversion. You want one anyway for two reasons: charge balance is only meaningful in meq/L, and reaction stoichiometry is only readable in molar units.

Species names are matched case-insensitively and ignore charge notation, so "Ca", "Ca2+", "CA++" and "calcium" all resolve to the same ion.

Functions

conversion_factors

The factors used to convert each species, and where they come from.

equivalent_weight

Equivalent weight (g/eq) of a named ion, or NaN when unknown or neutral.

lookup_ion

Return the Ion matching name, or None if it is unknown.

to_meq_per_l

Convert concentrations to milliequivalents per litre: C / equivalent weight.

to_mmol_per_l

Convert concentrations to millimoles per litre: C / molar mass.

Classes

Ion

A dissolved species: molar mass in g/mol and formal charge.