Metadata-Version: 2.1
Name: unitc
Version: 0.0.2
Summary: Measurement units conversion.
Home-page: https://gitlab.com/mnn/unitc
Author: M. Nuño
Author-email: mnunos@outlook.com
License: UNKNOWN
Project-URL: Documentation, https://mnn.gitlab.io/unitc/
Project-URL: Source, https://gitlab.com/mnn/unitc
Project-URL: Bug Reports, https://gitlab.com/mnn/unitc/-/issues
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
License-File: LICENSE

UNITC
=====

Python module to perform conversions between measurement units.


Usage example
-------------
   
.. code:: python

    >>> from unitc import unit_conversion
    # Convert 1 kg to pounds
    >>> unit_conversion(1, 'kg', 'lb')
    2.204623
    >>> unit_conversion(1, from_unit='kg', to_unit='lb')
    2.204623
    
    # If the conversion is done to or from SI units, they don't need to be specified explicitely
    >>> unit_conversion(1, 'ft')  # Converts 1 ft to m
    0.3047999902464003
    >>> unit_conversion(1, to_unit='HP') # Converts 1 W to horse power (HP)
    0.001341022

    # Unit conversion works also with lists and arrays
    >>> a = [1, 2, 3, 4, 5]
    >>> unit_conversion(a, 'kPa', 'lbf/ft²')
    array([ 20.88543648,  41.77087296,  62.65630944,  83.54174592, 104.42718239])

    >>> b = np.array([2, 5, 8, 7])
    >>> unit_conversion(b, 'kt', 'm/s')
    array([1.02888947, 2.57222367, 4.11555787, 3.60111313])
    
    # Input units can be specified in the input value as a string
    >>> unit_conversion('4 g/cm³', to_unit='lb/in³')
    0.14450917891460638


