Skip to content

Interoperability forms and unit dialects: openff-units, ASDF, CF/UDUNITS, UCUM, QUDT #85

Description

@dprada

What. Reviewing how others serialize and exchange quantities (#83, "Alternatives and prior experience") surfaced conversions PyUnitWizard could offer. They would let a user move quantities between ecosystems in one call, and let PyUnitWizard's own serialization codec (#82) interoperate instead of standing alone.

Target Kind What conversion would mean Why
openff-units form (a pint subclass with its own registry) convert(q, to_form="openff.units") and back Molecular force-field ecosystem. Blocked today by cross-registry support (#84).
ASDF quantity tag serialized form read and write the value + unit node, with ndarray blocks Astronomy's archival format; asdf-astropy already maps it for astropy, and a PyUnitWizard bridge would reach every backend
CF / UDUNITS unit strings string dialect parse and emit the units attribute of NetCDF and Zarr Lets the codec write a CF units attribute next to its verified manifest, so CF tools keep working
UCUM codes string dialect parse and emit UCUM (mol/L, %, case-sensitive; M is mega, not molar) The portable spelling used in clinical and biomedical exchange (HL7/FHIR, LOINC); proposed as the third-party spelling in #83
QUDT (and OBO UO) identifiers semantic annotation map a unit to its QUDT unit IRI and an optional quantity-kind IRI Distinguishes Hz/Bq and J/N·m, which dimensions cannot; pint does not model kinds (pint#676, closed)
OpenMM (existing) form already supported Listed for completeness; openff-units has its own to_openmm/from_openmm

How. Each item should be justified by a measured consumer case before it is implemented, following the lesson of #83's prior-art section. They can be optional extras loaded through DepDigest. Suggested order:

  1. cross-registry pint (a prerequisite, and a defect today);
  2. CF/UDUNITS and UCUM string dialects (needed by QuantityRecord: PyUnitWizard's native inert interchange form (verified quantity records) #82's bindings);
  3. openff-units;
  4. ASDF;
  5. QUDT kinds.

Why here. PyUnitWizard is already the interoperability layer across pint, openmm.unit, unyt, astropy, physipy and quantities (devguide/interop_future_directions.md, "Ecosystem integrations"). Conversions written in each consumer diverge, and that divergence is where units get lost.

Related: #83 (review and design record), #82 (codec), #81.

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

    needs-triageAwaiting maintainer triageproposalDesign or governance proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions