DynamicQuantities.jl icon indicating copy to clipboard operation
DynamicQuantities.jl copied to clipboard

Feature Suggestion: SymbolicAffineDimensions

Open Deduction42 opened this issue 8 months ago • 8 comments

I've worked with numerous unit packages (like Python's Pint and Unitful.jl) and really love the fundamental approach of this package, which is really the fundamental approach of the SI units system. Unfortunately, real-world units are weird, and I find that in engineering applications, affine units are everywhere (pressure units are gauge, so zero at atmospheric, and temperatures are always either Fahrenheit or Celsius), and it's difficult for this package to handle them. I basically have to fallback to Unitful.jl first and then apply conversions from Unitful to DynamicQuantities which means that if I have to set up unit tables for data sources, there's a lot of dynamic dispatch happening.

Would it be possible to extend AbstractSymbolicDimensions to include a SymbolicAffineDimensions? It's basically a SymbolicDimensions with an offset property. Moreover, a SymbolicDimensions is easy to promote to a SymbolicAffineDimensions, as you just set offset=0. Also, any function that uses a Quantity{T,SymbolicAffineDimesnions} simply converts subtracts the offset first, and then treats it as a Quantity{T, SymbolicDimesnions}. This would allow me to be rid of Unitful.jl dependencies altogether, as well as make custom unit tables that behave much more performantly.

Deduction42 avatar Jun 17 '24 15:06 Deduction42