dalito / ucumvert Goto Github PK
View Code? Open in Web Editor NEWPython parser for UCUM (Unified Code for Units of Measure) incl. converter to pint units
License: MIT License
Python parser for UCUM (Unified Code for Units of Measure) incl. converter to pint units
License: MIT License
coverage report -> markdown -> job summary
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'
> g.m2-1
No terminal matches '-' in the current parser context, at line 1 col 5
g.m2-1
^
Expected one of:
* ANNOTATION
* OPERATOR
This is fine according to the validator:
https://lhncbc.github.io/ucum-lhc/demo.html
These all work:
m2
g/m2
g.m-1
(ok semantically doesn't make sense...)So it's some combination
pip install -e .
ERROR: File "setup.py" or "setup.cfg" not found. Directory cannot be installed in editable mode: /Users/cjm/repos/ucumvert
(A "pyproject.toml" file was found, but editable mode currently requires a setuptools-based build.)
this did work for me however:
hatch run ucumvert
Enter UCUM unit code to parse, or 'q' to quit.
but I also needed to add pydot to the dependencies to avoid runtime error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.