epconversions
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.
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.
Metadata
Release files for epconversions 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| epconversions-0.2.2.tar.gz | 28.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| epconversions-0.2.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 46.7 kB
Release files / epconversions-0.2.2.tar.gz
| Download URL | epconversions-0.2.2.tar.gz |
|---|---|
| Size | 28.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6cd0e7941b0dea4fde70c8c2ce820520a0b92ea2e36182d6fe94755022b7bd0
|
|
BLAKE2b-256 checksum How to use checksums |
89330390c20ef692a62d6240d6c5e106e9b9b7b5393181036ba12d3b051a7270
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / epconversions-0.2.2-py2.py3-none-any.whl
| Download URL | epconversions-0.2.2-py2.py3-none-any.whl |
|---|---|
| Size | 18.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
008cd89030ad7c2e0258bda0250df88da1579caab9a4463e9e80dc745b23a435
|
|
BLAKE2b-256 checksum How to use checksums |
01f0f5a15a47e18b292bb457a2dd50c4784c545a5f650cda191119c2801192d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for epconversions 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.