JuliaPhysics / JuliaPhysics/Unitful.jl
More general unit parsing
- Dominant language
- Julia
- Stars
- 675
- Forks
- 124
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 1
Description
Currently Unitful hability to understand units in non standard form is limited. So I built up a small utility to parse units from a more general form, eg
```julia
julia> destructure_units("nanoamps3 seconds / micrometer^2")
3-element Array{Any,1}:
("n", "A", 3)
("", "s", 1)
("μ", "m", -2)
julia> reduce_units_expr("nanoamps3 seconds / micrometer^2")
"nA^3*s*μm^-2"
```
The code can be found as an unregistered package at https://github.com/Kolaru/UnitsParser.jl. It basically just is a simple parser that look up for prefix and units aliases in a table and replace them with the corresponding symbol.
If there is interest here, I can turn it into a PR to Unitful. Otherwise I can also have it as a separate one.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the issue examples and the unregistered UnitsParser.jl package linked in the report. Compare its general-form parsing and alias lookup with Unitful's current unit parsing entry points. Done would mean agreeing on whether this belongs in Unitful and, if so, defining and implementing the proposed parsing behavior as a PR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100