Skip to content

Commit

Permalink
Merge pull request #162 from otaithleigh/master
Browse files Browse the repository at this point in the history
Add US customary units kip and ksi
  • Loading branch information
ngoldbaum authored Jul 22, 2020
2 parents 1ca658f + 32028d5 commit e957e4c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
22 changes: 22 additions & 0 deletions unyt/_unit_lookup_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@
False,
),
),
(
"kip",
(
1000 * kg_per_pound * standard_gravity_m_per_s2,
dimensions.force,
0.0,
r"\rm{kip}",
False,
),
),
("lb", (kg_per_pound, dimensions.mass, 0.0, r"\rm{lb}", False)),
("atm", (pascal_per_atm, dimensions.pressure, 0.0, r"\rm{atm}", False)),
("hp", (watt_per_horsepower, dimensions.power, 0.0, r"\rm{hp}", False)),
Expand Down Expand Up @@ -193,6 +203,16 @@
False,
),
),
(
"ksi",
(
1000 * kg_per_pound * standard_gravity_m_per_s2 / m_per_inch ** 2,
dimensions.pressure,
0.0,
r"\rm{ksi}",
False,
),
),
("smoot", (1.7018, dimensions.length, 0.0, r"\rm{smoot}", False)),
# dimensionless stuff
("dimensionless", (1.0, dimensions.dimensionless, 0.0, r"", False)),
Expand Down Expand Up @@ -443,13 +463,15 @@
("degF", ("degree_fahrenheit", "degree_Fahrenheit", "fahrenheit", "°F")),
("R", ("degree_rankine", "rankine")),
("lbf", ("pound_force",)),
("kip", ("kilopound", "kipf")),
("lb", ("pound", "pound_mass", "lbm")),
("atm", ("atmosphere",)),
("hp", ("horsepower",)),
("oz", ("ounce",)),
("cal", ("calorie",)),
("BTU", ("british_thermal_unit",)),
("psi", ("pounds_per_square_inch",)),
("ksi", ("kips_per_square_inch",)),
# dimensionless stuff
("dimensionless", ("_", "")),
("B", ("bel",)),
Expand Down
8 changes: 8 additions & 0 deletions unyt/tests/test_unyt_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2415,3 +2415,11 @@ def test_delta_degF():

def test_mil():
assert_allclose_units(unyt_quantity(1, "mil"), unyt_quantity(0.001, "inch"))


def test_kip():
assert_allclose_units(unyt_quantity(1, "lbf"), unyt_quantity(0.001, "kip"))


def test_ksi():
assert_allclose_units(unyt_quantity(1, "lbf/inch**2"), unyt_quantity(0.001, "ksi"))

0 comments on commit e957e4c

Please sign in to comment.