Python-Custom-Unit-Converter


NamePython-Custom-Unit-Converter JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryPyCUC: A lightweight Python package for creating custom unit conversions.
upload_time2024-09-18 07:09:45
maintainerNone
docs_urlNone
authorSina Gilassi
requires_python>=3.6
licenseMIT
keywords python chemical engineering custom unit conversion pycuc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Python Custom Unit Converter (PyCUC)



![Downloads](https://img.shields.io/pypi/dm/PyCUC) ![PyPI](https://img.shields.io/pypi/v/PyCUC) ![Python Version](https://img.shields.io/pypi/pyversions/PyCUC.svg) ![License](https://img.shields.io/pypi/l/PyCUC) 



Python Custom Unit Converter (PyCUC) is an open-source package designed to simplify unit conversions in Python. With PyCUC, you can effortlessly create custom conversion factors, convert between units, and streamline calculations in various fields, such as physics, engineering, and scientific computing.



**Key Features:**

* Custom Conversion Factors: Define your own conversion factors for unique units.

* Flexible Unit Conversions: Convert between units with ease, using a simple and intuitive methods.

* Lightweight: Minimal dependencies and optimized for performance.

* Easy to Use: Simple installation and straightforward usage.



## Installation



Install PyCUC with pip



```python

import pycuc

# check version

print(pycuc.__version__)

```



## Usage Example



* CREATE A CUSTOM UNIT CONVERTER



```python

# ! pressure

my_cuc_1 = pycuc.create_cuc(1, 'MPa')

# convert to Pa

print(my_cuc_1.convert('Pa'))

print(my_cuc_1.convert('bar'))

print(my_cuc_1.convert('kPa'))

print("-"*50)



# ! temperature

my_cuc_2 = pycuc.create_cuc(358, 'K')

# convert to K

print(my_cuc_2.convert('C'))

print(my_cuc_2.convert('F'))

print(my_cuc_2.convert('R'))

print("-"*50)

```



* CONVERT FROM TO



```python

# ! pressure

print(pycuc.convert_from_to(1, 'MPa', 'Pa'))

# ! temperature

print(pycuc.convert_from_to(358, 'K', 'C'))

print(pycuc.convert_from_to(25, 'C', 'K'))

print("-"*50)

```



* DEFINE A NEW UNIT



```python

# ! heat capacity unit: J/mol.K

my_cuc_3 = pycuc.create_cuc(25, 'J/mol.K')

# add custom

my_cuc_3.add_custom_unit('J/mol.K', 1)

my_cuc_3.add_custom_unit('kJ/mol.K', 1000)

# conversion

print(my_cuc_3.convert('J/mol.K'))

print(my_cuc_3.convert('kJ/mol.K'))

print("-"*50)

```



* CHECK REFERENCE



```python

# ! pressure

print(my_cuc_3.check_reference('pressure'))

# ! temperature

print(my_cuc_3.check_reference('temperature'))

# ! custom

print(my_cuc_3.check_reference('custom'))

```



## FAQ



For any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/) 





## Authors



- [@sinagilassi](https://www.github.com/sinagilassi)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "Python-Custom-Unit-Converter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "python, chemical engineering, custom unit conversion, PyCUC",
    "author": "Sina Gilassi",
    "author_email": "<sina.gilassi@gmail.com>",
    "download_url": null,
    "platform": null,
    "description": "\r\n# Python Custom Unit Converter (PyCUC)\r\n\r\n\r\n\r\n![Downloads](https://img.shields.io/pypi/dm/PyCUC) ![PyPI](https://img.shields.io/pypi/v/PyCUC) ![Python Version](https://img.shields.io/pypi/pyversions/PyCUC.svg) ![License](https://img.shields.io/pypi/l/PyCUC) \r\n\r\n\r\n\r\nPython Custom Unit Converter (PyCUC) is an open-source package designed to simplify unit conversions in Python. With PyCUC, you can effortlessly create custom conversion factors, convert between units, and streamline calculations in various fields, such as physics, engineering, and scientific computing.\r\n\r\n\r\n\r\n**Key Features:**\r\n\r\n* Custom Conversion Factors: Define your own conversion factors for unique units.\r\n\r\n* Flexible Unit Conversions: Convert between units with ease, using a simple and intuitive methods.\r\n\r\n* Lightweight: Minimal dependencies and optimized for performance.\r\n\r\n* Easy to Use: Simple installation and straightforward usage.\r\n\r\n\r\n\r\n## Installation\r\n\r\n\r\n\r\nInstall PyCUC with pip\r\n\r\n\r\n\r\n```python\r\n\r\nimport pycuc\r\n\r\n# check version\r\n\r\nprint(pycuc.__version__)\r\n\r\n```\r\n\r\n\r\n\r\n## Usage Example\r\n\r\n\r\n\r\n* CREATE A CUSTOM UNIT CONVERTER\r\n\r\n\r\n\r\n```python\r\n\r\n# ! pressure\r\n\r\nmy_cuc_1 = pycuc.create_cuc(1, 'MPa')\r\n\r\n# convert to Pa\r\n\r\nprint(my_cuc_1.convert('Pa'))\r\n\r\nprint(my_cuc_1.convert('bar'))\r\n\r\nprint(my_cuc_1.convert('kPa'))\r\n\r\nprint(\"-\"*50)\r\n\r\n\r\n\r\n# ! temperature\r\n\r\nmy_cuc_2 = pycuc.create_cuc(358, 'K')\r\n\r\n# convert to K\r\n\r\nprint(my_cuc_2.convert('C'))\r\n\r\nprint(my_cuc_2.convert('F'))\r\n\r\nprint(my_cuc_2.convert('R'))\r\n\r\nprint(\"-\"*50)\r\n\r\n```\r\n\r\n\r\n\r\n* CONVERT FROM TO\r\n\r\n\r\n\r\n```python\r\n\r\n# ! pressure\r\n\r\nprint(pycuc.convert_from_to(1, 'MPa', 'Pa'))\r\n\r\n# ! temperature\r\n\r\nprint(pycuc.convert_from_to(358, 'K', 'C'))\r\n\r\nprint(pycuc.convert_from_to(25, 'C', 'K'))\r\n\r\nprint(\"-\"*50)\r\n\r\n```\r\n\r\n\r\n\r\n* DEFINE A NEW UNIT\r\n\r\n\r\n\r\n```python\r\n\r\n# ! heat capacity unit: J/mol.K\r\n\r\nmy_cuc_3 = pycuc.create_cuc(25, 'J/mol.K')\r\n\r\n# add custom\r\n\r\nmy_cuc_3.add_custom_unit('J/mol.K', 1)\r\n\r\nmy_cuc_3.add_custom_unit('kJ/mol.K', 1000)\r\n\r\n# conversion\r\n\r\nprint(my_cuc_3.convert('J/mol.K'))\r\n\r\nprint(my_cuc_3.convert('kJ/mol.K'))\r\n\r\nprint(\"-\"*50)\r\n\r\n```\r\n\r\n\r\n\r\n* CHECK REFERENCE\r\n\r\n\r\n\r\n```python\r\n\r\n# ! pressure\r\n\r\nprint(my_cuc_3.check_reference('pressure'))\r\n\r\n# ! temperature\r\n\r\nprint(my_cuc_3.check_reference('temperature'))\r\n\r\n# ! custom\r\n\r\nprint(my_cuc_3.check_reference('custom'))\r\n\r\n```\r\n\r\n\r\n\r\n## FAQ\r\n\r\n\r\n\r\nFor any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/) \r\n\r\n\r\n\r\n\r\n\r\n## Authors\r\n\r\n\r\n\r\n- [@sinagilassi](https://www.github.com/sinagilassi)\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "PyCUC: A lightweight Python package for creating custom unit conversions.",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        " chemical engineering",
        " custom unit conversion",
        " pycuc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6d0ef5b4a878a146f454886ef8c63f6708e301394e83c390b62628239929bd8",
                "md5": "a2b1dec692fea52a6e3acaa91bffd1ea",
                "sha256": "b1b4c0fa0cbdccfc61d82ef18d81204b73d513b0dc0c2212b89de84185fbcfa1"
            },
            "downloads": -1,
            "filename": "Python_Custom_Unit_Converter-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a2b1dec692fea52a6e3acaa91bffd1ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6905,
            "upload_time": "2024-09-18T07:09:45",
            "upload_time_iso_8601": "2024-09-18T07:09:45.777099Z",
            "url": "https://files.pythonhosted.org/packages/c6/d0/ef5b4a878a146f454886ef8c63f6708e301394e83c390b62628239929bd8/Python_Custom_Unit_Converter-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-18 07:09:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-custom-unit-converter"
}
        
Elapsed time: 0.54817s