Units#
The xara.units submodule contains predefined constants that can help with keeping track of units.
Systems#
The following systems are implemented (see Symbols below for definitions of the symbols):
si | sim | us(f) | usi | |
---|---|---|---|---|
Length | meter | mm | foot | inch |
Force | N | N | lbf | lbf |
Mass | kg | tonne | slug | lbf s2/inch |
Stress | Pa | MPa | lbf/ft2 | psi (lbf/inch2) |
Energy | J (N × m) | mJ (10−3 J) | ft lbf | in lbf |
Density | kg/m3 | tonne/mm3 | slug/ft3 | lbf s2/in4 |
The idiom for importing constants from a system takes the form:
from xara.units.<system> import <symbols>...
where <system>
is one of the implemented systems.
For example, to import the symbols inch
, kip
, N
and Pa
from the us
system,
from xara.units.us import inch, kip, N, Pa
Occasionally it is convenient to import all symbols using a star-import
from xara.units.us import *
Note, however, that this is generally considered bad programming style.
Symbols#
Each submodule exports the following symbols:
Length#
Symbols |
Description |
---|---|
|
Milimeter |
|
Centimeter |
|
Meter |
|
Kilometer |
|
|
|
International foot |
|
International yard |
|
Mile |
Force#
Symbols |
Description |
---|---|
|
Newton (force) |
|
Dyne |
|
Poundal |
|
|
|
Stress#
Pa |
pascal |
Pascal, N/m:sup:2 |
torr |
||
kPa |
kilopascal |
Kilopascal, 10:sup:3 Pa |
MPa |
megapascals |
Megapascal, N/mm:sup:2 = 10:sup:6 Pa |
bar |
||
atm |
atmosphere |
Standard atmosphere |
MPa |
megapascal |
|
GPa |
gigapascal |
|
psi |
Pound-square-inch |
|
ksi |
Mass#
slug |
||
lbm |
lbm |
International avoirdupois pound |
gm |
gram |
|
kg |
kilogram |
Kilogram |
tonne |
Metric tonne, 10 3 kg |
|
oz |
ounce |
International avoirdupois ounce |
Density#
|
Pounds per cubic foot |
Note
The p
in pcf
represents the pound mass (lbm
), not the pound force (lbf
) as it does psi
unit.
Angular Velocity#
rpm |
revpm |
Revolution per minute |
radps |
Radian per second |