Skip to content

Commit

Permalink
Merge pull request #160 from l-johnston/mil_unit
Browse files Browse the repository at this point in the history
Add the imperial unit mil.
  • Loading branch information
ngoldbaum authored Jul 13, 2020
2 parents d51595d + fe93834 commit 1ca658f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions unyt/_unit_lookup_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
("degC", (1.0, dimensions.temperature, -273.15, r"^\circ\rm{C}", True)),
("delta_degC", (1.0, dimensions.temperature, 0, r"\Delta^\circ\rm{C}", True)),
# Imperial and other non-metric units
("mil", (1e-3 * m_per_inch, dimensions.length, 0.0, r"\rm{mil}", False)),
("inch", (m_per_inch, dimensions.length, 0.0, r"\rm{in}", False)),
("ft", (m_per_ft, dimensions.length, 0.0, r"\rm{ft}", False)),
("yd", (0.9144, dimensions.length, 0.0, r"\rm{yd}", False)),
Expand Down Expand Up @@ -434,6 +435,7 @@
("lx", ("lux",)),
("degC", ("degree_celsius", "degree_Celsius", "celcius", "celsius", "°C")),
# Imperial and other non-metric units
("mil", ("thou", "thousandth")),
("inch", ("in",)),
("ft", ("foot",)),
("yd", ("yard",)),
Expand Down
4 changes: 4 additions & 0 deletions unyt/tests/test_unyt_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2411,3 +2411,7 @@ def test_delta_degF():
assert t3 + t1 == 11 * degF
assert 1 * delta_degF + 2 * delta_degF == 3 * delta_degF
assert 2 * delta_degF == unyt_quantity(2, "delta_degF")


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

0 comments on commit 1ca658f

Please sign in to comment.