Skip to content

Order units #2086

Open
Open
@SpazzNon

Description

Hi, when I multiply units of force with length or its simplification results in force times length the result always gives in order length times force, I would like that to change because I am using handcalcs and generate reports so it is unusual to read length times force, when I am used to it being force times length. Attached is the configuration.

from IPython.display import Latex

import handcalcs.render
import pandas as pd
pd.options.display.float_format = "{:.2f}".format
from math import sqrt, sin, tan, pi,cos
import pint
un = pint.UnitRegistry(auto_reduce_dimensions=True)
preferred_units = [
    un.m,
    un.kg,
    un.s, 
    un.K,
    un.kN,
    un.W,
    un.kip,
]

un.default_preferred_units = preferred_units
un.define('tonf = 1000 * kg * 9.80665 * m / s**2')
un.define('kgf = 1 * kg * 9.80665 * m / s**2')
#un.define('ksi = 1 * kg * 1* m / s**2*6894757.29316836/m**2')
un.define('ksi = 1 * kip / inch**2')

m= un.m
mm= un.mm
inch = un.inch
MPa = un.MPa
tonf= un.tonf
kgf= un.kgf
cm = un.cm
ksi = un.ksi
kip = un.kip
lb= un.lb
ft= un.ft
N= un.N

un.default_preferred_units = preferred_units
handcalcs.set_option("preferred_string_formatter", "~L")```

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions