Skip to content

Add conversion from pint to UCUM code #10

@dalito

Description

@dalito

This should be not too difficult to add. Most unclear is how to extend pint best for this kind of conversion.

The idea is to add methods get the corresponding UCUM string from pint quantities and pint units:

>>> q = 5 * ureg("m/kg**3)
>>> q
<Quantity(5, 'kilogram / meter ** 3')>
>>> q.to_ucum()
'kg.m-3'
>>> u = q.units
>>> u
<Unit('kilogram / meter ** 3')>
>>> u.to_ucum()
'kg.m-3'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions