epconversions


Nameepconversions JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/pyenergyplus/epconversions
SummaryUnit conversions for E+
upload_time2024-05-12 14:43:41
maintainerNone
docs_urlNone
authorSantosh Philip
requires_python>=3.6
licenseMIT license
keywords epconversions
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            =============
epconversions
=============


.. image:: https://img.shields.io/pypi/v/epconversions.svg
        :target: https://pypi.python.org/pypi/epconversions

.. image:: https://img.shields.io/travis/pyenergyplus/epconversions.svg
        :target: https://travis-ci.com/pyenergyplus/epconversions

.. image:: https://readthedocs.org/projects/epconversions/badge/?version=latest
        :target: https://epconversions.readthedocs.io/en/latest/?version=latest
        :alt: Documentation Status


.. image:: https://pyup.io/repos/github/pyenergyplus/epconversions/shield.svg
     :target: https://pyup.io/repos/github/pyenergyplus/epconversions/
     :alt: Updates



Unit conversions for E+


* Free software: Mozilla Public License 2.0 (MPL 2.0)
* Documentation: https://epconversions.readthedocs.io.


Energyplus has a bunch of conversion factors at the top of the `Energy+.idd` file. It looks like this::

    ! Default IP conversions (no \ip-units necessary)
    !      $/(m3/s)               =>   $/(ft3/min)         0.000472000059660808
    !      $/(W/K)                =>   $/(Btu/h-F)         0.52667614683731
    !      $/kW                   =>   $/(kBtuh/h)         0.293083235638921
    !      $/m2                   =>   $/ft2               0.0928939733269818
    !      $/m3                   =>   $/ft3               0.0283127014102352
    !      (kg/s)/W               =>   (lbm/sec)/(Btu/hr)  0.646078115385742
    !      1/K                    =>   1/F                 0.555555555555556
    !      1/m                    =>   1/ft                0.3048
    !      A/K                    =>   A/F                 0.555555555555556
    !      C                      =>   F                   1.8 (plus 32)
    !      cm                     =>   in                  0.3937
    !      cm2                    =>   inch2               0.15500031000062
    !      deltaC                 =>   deltaF              1.8
    !      deltaC/hr              =>   deltaF/hr           1.8
    !      deltaJ/kg              =>   deltaBtu/lb         0.0004299
    !      g/GJ                   =>   lb/MWh              0.00793664091373665
    !      g/kg                   =>   grains/lb           7

Note the `cm` in the middle of that text snippet. It shows the conversion form `cm` to `in` and the multipier to use to convert





Features
--------

The library `epconversions` has functions that will do these conversions::

    from epconversions import epconversions

    print(epconversions.convert2ip(100, 'cm'))
    >> (39.37, 'in')

Can I convert to SI units ? Yes.::

    epconversions.convert2si(100, 'in')
    >> (254.00050800101602, 'cm')

What if I want only converted value. I don't want the unit string::

    epconversions.convert2si(100, 'in', unitstr=False)
    >> 254.00050800101602

Nice !!

Why does it convert ``cm`` to ``in``. Would it convert to ``m``::

    epconversions.convert2si(100, 'in', 'm')
    >> (2.5399999999999987, 'm')

    # for clarity
    epconversions.convert2si(100, 'in', siunit='m')
    (2.5399999999999987, 'm')


What are all the units it can convert ``in`` to ?::

    epconversions.getsiunits('in')
    >> {'cm', 'm'}

How do I know what it converts it to by default?::

    epconversions.defaultsiunit('in')
    >> 'cm'
    epconversions.defaultsiunit('ft')
    >> 'm'

What are all the units it can convert?::

    epconversions.allsiunits()
    >> ['$/(m3/s)',
    '$/(W/K)',

    <snip>

    'A/K',
    'C',
    'cm',
    'cm2',
    'deltaC',
    'deltaC/hr',
    'deltaJ/kg',
    'g/GJ',
    'g/kg',
    'g/MJ',


    <snip>

    'W',
    'W/((m3/s)-Pa)',
    'W/(m3/s)',
    'W/K',
    'W/m',
    'W/m2',

    <snip>

    'years']

    # around 128 now

    # also try out ``allipunits()``


This is all to complicated. Don't you have an easy way to convert from Fahrenheit to Celsius ?

Yes! There is an easier way::

    from epconversions import ec
    c = ec.f2c(77)
    print(c)
    
    >> 25.0

That is as easy as it gets. Right now we have ``f2c`` and ``c2f``. If you want more easy functions, open an issue and add to them yourself.


Thats all for now


Credits
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage


=======
History
=======

release 0.2.2
-------------


2024-05-11
----------

fixed issue #19

:Problem: easy functions needed like f2c and c2f
:Solutions: added ec.f2c and ec.c2f



2024-05-10
----------

fixed issue #16

:Problem: convert2ip and convert2si do not convert strings to floats
:Solution: strings are converted to floats if possible


release 0.1.0
-------------

* First release on PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pyenergyplus/epconversions",
    "name": "epconversions",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "epconversions",
    "author": "Santosh Philip",
    "author_email": "santosh@noemail.com",
    "download_url": "https://files.pythonhosted.org/packages/89/33/0390c20ef692a62d6240d6c5e106e9b9b7b5393181036ba12d3b051a7270/epconversions-0.2.2.tar.gz",
    "platform": null,
    "description": "=============\nepconversions\n=============\n\n\n.. image:: https://img.shields.io/pypi/v/epconversions.svg\n        :target: https://pypi.python.org/pypi/epconversions\n\n.. image:: https://img.shields.io/travis/pyenergyplus/epconversions.svg\n        :target: https://travis-ci.com/pyenergyplus/epconversions\n\n.. image:: https://readthedocs.org/projects/epconversions/badge/?version=latest\n        :target: https://epconversions.readthedocs.io/en/latest/?version=latest\n        :alt: Documentation Status\n\n\n.. image:: https://pyup.io/repos/github/pyenergyplus/epconversions/shield.svg\n     :target: https://pyup.io/repos/github/pyenergyplus/epconversions/\n     :alt: Updates\n\n\n\nUnit conversions for E+\n\n\n* Free software: Mozilla Public License 2.0 (MPL 2.0)\n* Documentation: https://epconversions.readthedocs.io.\n\n\nEnergyplus has a bunch of conversion factors at the top of the `Energy+.idd` file. It looks like this::\n\n    ! Default IP conversions (no \\ip-units necessary)\n    !      $/(m3/s)               =>   $/(ft3/min)         0.000472000059660808\n    !      $/(W/K)                =>   $/(Btu/h-F)         0.52667614683731\n    !      $/kW                   =>   $/(kBtuh/h)         0.293083235638921\n    !      $/m2                   =>   $/ft2               0.0928939733269818\n    !      $/m3                   =>   $/ft3               0.0283127014102352\n    !      (kg/s)/W               =>   (lbm/sec)/(Btu/hr)  0.646078115385742\n    !      1/K                    =>   1/F                 0.555555555555556\n    !      1/m                    =>   1/ft                0.3048\n    !      A/K                    =>   A/F                 0.555555555555556\n    !      C                      =>   F                   1.8 (plus 32)\n    !      cm                     =>   in                  0.3937\n    !      cm2                    =>   inch2               0.15500031000062\n    !      deltaC                 =>   deltaF              1.8\n    !      deltaC/hr              =>   deltaF/hr           1.8\n    !      deltaJ/kg              =>   deltaBtu/lb         0.0004299\n    !      g/GJ                   =>   lb/MWh              0.00793664091373665\n    !      g/kg                   =>   grains/lb           7\n\nNote the `cm` in the middle of that text snippet. It shows the conversion form `cm` to `in` and the multipier to use to convert\n\n\n\n\n\nFeatures\n--------\n\nThe library `epconversions` has functions that will do these conversions::\n\n    from epconversions import epconversions\n\n    print(epconversions.convert2ip(100, 'cm'))\n    >> (39.37, 'in')\n\nCan I convert to SI units ? Yes.::\n\n    epconversions.convert2si(100, 'in')\n    >> (254.00050800101602, 'cm')\n\nWhat if I want only converted value. I don't want the unit string::\n\n    epconversions.convert2si(100, 'in', unitstr=False)\n    >> 254.00050800101602\n\nNice !!\n\nWhy does it convert ``cm`` to ``in``. Would it convert to ``m``::\n\n    epconversions.convert2si(100, 'in', 'm')\n    >> (2.5399999999999987, 'm')\n\n    # for clarity\n    epconversions.convert2si(100, 'in', siunit='m')\n    (2.5399999999999987, 'm')\n\n\nWhat are all the units it can convert ``in`` to ?::\n\n    epconversions.getsiunits('in')\n    >> {'cm', 'm'}\n\nHow do I know what it converts it to by default?::\n\n    epconversions.defaultsiunit('in')\n    >> 'cm'\n    epconversions.defaultsiunit('ft')\n    >> 'm'\n\nWhat are all the units it can convert?::\n\n    epconversions.allsiunits()\n    >> ['$/(m3/s)',\n    '$/(W/K)',\n\n    <snip>\n\n    'A/K',\n    'C',\n    'cm',\n    'cm2',\n    'deltaC',\n    'deltaC/hr',\n    'deltaJ/kg',\n    'g/GJ',\n    'g/kg',\n    'g/MJ',\n\n\n    <snip>\n\n    'W',\n    'W/((m3/s)-Pa)',\n    'W/(m3/s)',\n    'W/K',\n    'W/m',\n    'W/m2',\n\n    <snip>\n\n    'years']\n\n    # around 128 now\n\n    # also try out ``allipunits()``\n\n\nThis is all to complicated. Don't you have an easy way to convert from Fahrenheit to Celsius ?\n\nYes! There is an easier way::\n\n    from epconversions import ec\n    c = ec.f2c(77)\n    print(c)\n    \n    >> 25.0\n\nThat is as easy as it gets. Right now we have ``f2c`` and ``c2f``. If you want more easy functions, open an issue and add to them yourself.\n\n\nThats all for now\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\nrelease 0.2.2\n-------------\n\n\n2024-05-11\n----------\n\nfixed issue #19\n\n:Problem: easy functions needed like f2c and c2f\n:Solutions: added ec.f2c and ec.c2f\n\n\n\n2024-05-10\n----------\n\nfixed issue #16\n\n:Problem: convert2ip and convert2si do not convert strings to floats\n:Solution: strings are converted to floats if possible\n\n\nrelease 0.1.0\n-------------\n\n* First release on PyPI.\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Unit conversions for E+",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://github.com/pyenergyplus/epconversions"
    },
    "split_keywords": [
        "epconversions"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "01f0f5a15a47e18b292bb457a2dd50c4784c545a5f650cda191119c2801192d0",
                "md5": "3830e19b70f74882c2d2c3fa7e1d22a5",
                "sha256": "008cd89030ad7c2e0258bda0250df88da1579caab9a4463e9e80dc745b23a435"
            },
            "downloads": -1,
            "filename": "epconversions-0.2.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3830e19b70f74882c2d2c3fa7e1d22a5",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 18224,
            "upload_time": "2024-05-12T14:43:39",
            "upload_time_iso_8601": "2024-05-12T14:43:39.819845Z",
            "url": "https://files.pythonhosted.org/packages/01/f0/f5a15a47e18b292bb457a2dd50c4784c545a5f650cda191119c2801192d0/epconversions-0.2.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89330390c20ef692a62d6240d6c5e106e9b9b7b5393181036ba12d3b051a7270",
                "md5": "254ea61f2791cf770a935cf4ebbc5615",
                "sha256": "f6cd0e7941b0dea4fde70c8c2ce820520a0b92ea2e36182d6fe94755022b7bd0"
            },
            "downloads": -1,
            "filename": "epconversions-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "254ea61f2791cf770a935cf4ebbc5615",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 28457,
            "upload_time": "2024-05-12T14:43:41",
            "upload_time_iso_8601": "2024-05-12T14:43:41.750127Z",
            "url": "https://files.pythonhosted.org/packages/89/33/0390c20ef692a62d6240d6c5e106e9b9b7b5393181036ba12d3b051a7270/epconversions-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-12 14:43:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pyenergyplus",
    "github_project": "epconversions",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "epconversions"
}
        
Elapsed time: 3.07102s