Skip to content

Find a solution for units that astropy cannot parse (ppm, ppb, degC, volume percent, ...) #176

Description

@DunklesArchipel

Several unit strings used in the literature metadata do not parse with astropy, which the website (and unitpackage's quantity) rely on, and have no direct astropy-compatible spelling:

Unit Occurrences Used for
volume percent 92 e.g. electrolyte compositions
ppb 21 impurities, water quality
ppm 11 gas/impurity concentrations

All other unit spelling issues (M, mol L⁻¹, degC, percent, MΩ cm, cm², uA cm-2, ...) have been normalized to astropy-parseable spellings on the branch fix-concentration-units.

The remaining units currently do not break the website build because the templates only call .quantity on concentrations of acid/base/alkaline/salt components. Any future template or API use that touches these fields will fail like the M unit did.

Possible directions:

  • register custom units (e.g. astropy.units.def_unit) centrally in unitpackage so ppm, ppb and volume percent parse everywhere,
  • convert them in the data to astropy-parseable equivalents (e.g. umol / mol for ppm — though this changes the familiar notation),
  • add a CI validation to this repository that every unit: string in literature/ parses with astropy, so unsupported units are caught in data PRs rather than at website build time.

Related observation:

  • briega-martos_2021_cation_48: the HClO4 component has a concentration with unit: mol / l but no value (needs to be looked up in the paper).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions