Skip to content

Commit

Permalink
Add bar to unit lookup table
Browse files Browse the repository at this point in the history
  • Loading branch information
twmr committed Sep 9, 2019
1 parent 41bf39c commit 4824bfe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions unyt/_unit_lookup_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
("C", (1.0, dimensions.charge_mks, 0.0, r"\rm{C}", True)),
("T", (1.0, dimensions.magnetic_field_mks, 0.0, r"\rm{T}", True)),
("Pa", (1.0, dimensions.pressure, 0.0, r"\rm{Pa}", True)),
("bar", (1.0e5, dimensions.pressure, 0.0, r"\rm{bar}", True)),
("V", (1.0, dimensions.electric_potential, 0.0, r"\rm{V}", True)),
("F", (1.0, dimensions.capacitance, 0.0, r"\rm{F}", True)),
("Ω", (1.0, dimensions.resistance, 0.0, r"\Omega", True)),
Expand Down
6 changes: 6 additions & 0 deletions unyt/tests/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,3 +771,9 @@ def test_show_all_units_doc_table_ops():
(1 * u).in_cgs()
except UnitsNotReducible:
pass


def test_hPa_mbar():
assert Unit("hPa").dimensions == Unit("bar").dimensions
assert (5 * Unit("hPa") == 5 * Unit("mbar")).all()
assert (5 * Unit("hPa") != 1 * Unit("bar")).all()

0 comments on commit 4824bfe

Please sign in to comment.