connorferster / forallpeople

Python SI units library: your 'daily driver' for calculations.
Apache License 2.0
272 stars 38 forks source link

kilograms og Tonns #86

Open skipsing opened 1 year ago

skipsing commented 1 year ago

Is it possible to enforce either kilograms or tonnes?

Currently it shows Gigagrams (Gg) for values in range above 1000tonnes (1000 10^3 kg) , and Megagrams (Mg) in range 100 tonnes (100 10^3 kg) . Please advise.

defencedog commented 7 months ago

This a problem for me as well.

In [12]: 1000*kg_m3
Out[12]: 1.000 kkg·m⁻³

In [13]: 1000*kg_m3.prefix('unity')
Out[13]: 1000.000 kg·m⁻³

However it's not easy let me give you another example with g/cm^3. First I defined it in .json

"g_cm3": {
        "Dimension": [1,-3,0,0,0,0,0],
        "Factor": "1*0.001",
        "Prefixed": "unity",
        "Symbol": "kg*m⁻³"},

Then I tried using it

In [14]: 1000*kg_m3 + 1*g_cm3
Out[14]: 2.000 kkg·m⁻³

In [15]: (1000*kg_m3 + 1*g_cm3).prefix('unity')
Out[15]: 2000.000 kg·m⁻³

Problem is there no other way, .json Prefixed settings has no effect