Skip to content

Commit

Permalink
Merge branch 'version0.11' of https://github.com/LLNL/units into vers…
Browse files Browse the repository at this point in the history
…ion0.11
  • Loading branch information
phlptp committed Dec 26, 2024
2 parents 3c52ee3 + 188ca6a commit c0974a0
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions docs/user-guide/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ The units library is available through a pypi_ package
pip install units-llnl
Usage
Usage
-----------

.. code-block:: python
from units_llnl import Unit
u1 = Unit('m')
u2 = Unit('s')
u3=u1/u2
speed=20
desired='mph'
u1 = Unit("m")
u2 = Unit("s")
u3 = u1 / u2
speed = 20
desired = "mph"
# convert the unit to miles per hour
result = u3.convert(speed,desired)
result = u3.convert(speed, desired)
print(f"{20} {u3} = {result} {desired}")
This will print a result `20 m/s = 44.73872584108805 mph`
Expand All @@ -31,10 +31,10 @@ This will print a result `20 m/s = 44.73872584108805 mph`
from units_llnl import Measurement
m1 = Measurement('220 m')
m2 = Measurement('11 s')
m3=m1/m2
desired='mph'
m1 = Measurement("220 m")
m2 = Measurement("11 s")
m3 = m1 / m2
desired = "mph"
# convert the unit to miles per hour
result = m3.convert_to(desired)
print(f"{m3} = {result}")
Expand All @@ -46,4 +46,3 @@ See the pypi_ landing page for a complete description of all methods and functio
.. _pypi: https://pypi.org/project/units-llnl/

Future expansions will include uncertain units and some additional math operations on measurements

0 comments on commit c0974a0

Please sign in to comment.