import platform
print('Operating System: ' + platform.system() + platform.release())
print('Python Version: '+ platform.python_version())

"""
Explanation: Units and unit conversions are BIG in engineering. Engineers solve the world's problems in teams. Any problem solved has to have a context. How heavy can a rocket be and still make it off the ground? What thickness bodypannels keep occupants save during a crash? In engineering, a number without a unit is like a fish without water. It just flops around hopelessly without context around it is useless. 
How can we get help using units? Programming is one way. We are going to complete some uit conversion problmes using Python and Pint. Pint is a Python package used for unit conversions.
See the (Pint documentation) for more examples.
I recommend that undergraduate engineers use Python 3 (Python 2.7 is legacy python) and the Anaconda distribution. To use Pint, we need to install pint in our wroking version of Python. Open up the Anaconda Prompt:
```

pip install pint
```

I am working on a Windows 10 machine. You can check your operating system and Python version using the code below:
End of explanation
"""


import pint
ureg = pint.UnitRegistry()

"""
Explanation: Before we can complete a unit conversion with the Pint package, we need to import the Pint module and instantiate a UnitRegistry object. The new ureg object contains all the units used in the examples below.
End of explanation
"""


power = 252*ureg.kW
print(power)

"""
Explanation: For our first problem, we will complete the following converison:
Convert 252 kW to Btu/day
We'll create a variable called power with units of kilowatts (kW). To create the kW unit, we'll use our ureg object.
End of explanation
"""


power_in_Btu_per_day = power.to(ureg.Btu / ureg.day)
print(power_in_Btu_per_day)

"""
Explanation: To convert power to Btu/day, we use Pint's .to() method. The .to() method does not change the units of power in place. We need to assign the output of the .to() method to another variable power_in_Btu_per_day
End of explanation
"""


stress = 722*ureg.MPa

stress_in_ksi = stress.to(ureg.ksi)
print(stress_in_ksi)

"""
Explanation: Another probem:
Convert 722 MPa to ksi
End of explanation
"""


accel = 1.620 *ureg.m/(ureg.s**2)
print(accel)

"""
Explanation: Next problem:
Convert 1.620 m/s<sup>2</sup> to ft/min<sup>2</sup>
End of explanation
"""


accel.ito(ureg.ft/(ureg.min**2))
print(accel)

"""
Explanation: This time we will use the .ito() method. Using .ito() will convert the units of accel in place.
End of explanation
"""


quant = 14.31e8 * ureg.kJ * ureg.kg * ureg.mm**(-3)
print(quant)

quant.ito( ureg.cal*ureg.lb / (ureg.inch**3))
print(quant)

"""
Explanation: Convert 14.31 x 10<sup>8</sup> kJ kg mm<sup>-3</sup> to cal lb<sub>m</sub> / in<sup>3</sup>
End of explanation
"""


