Package: barril
What is Barril?Python package to manage units for physical quantities.Quick example:frombarril.unitsimportScalars1=Scalar(10,"m")s2=Scalar(500,"cm")asserts1+s2==Scalar(15,"m")FeaturesPre-defined unit database containing several physical quantities for the Oil & Gas industry.Data types with an associated unit:Scalar,Array,Quantity,FixedArray.Automatic conversion during arithmetic operations.DevelopmentFor complete description of what type of contributions are possible,
see the fullCONTRIBUTINGguide.Here is a quick summary of the steps necessary to setup your environment to contribute tobarril.Create a virtual environment and activate it:$ python -m virtualenv .env
$ .env\Scripts\activate  # windows
$ source .env/bin/activate  # linuxNoteIf you useconda, you can installvirtualenvin the root environment:$ conda install -n root virtualenvDon’t worry as this is safe to do.Updatepip:$ python -m pip install -U pipInstall development dependencies:$ pip install -e .[testing]Install pre-commit:$ pre-commit installRun tests:$ pytest --pyargs barrilGenerate docs locally:$ tox -e docsThe documentation files will be generated indocs/_build.ReleaseA reminder for the maintainers on how to make a new release.Note that the VERSION should folow the semantic versioning as X.Y.Z
Ex.: v1.0.5Create arelease-VERSIONbranch fromupstream/master.UpdateCHANGELOG.rst.Push a branch with the changes.Once all builds pass, push aVERSIONtag toupstream.Merge the PR.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.2.0.1 (2024-02-15)Added support for Python 3.11 and 3.12.Dropped support for EOL Python 3.6 and 3.7.Add categorie and quantity typehenry solubility coefficient(mol/m3.Pa)Add categorie and quantity typecrystallization kinetic rate(mol/m2.s.Pa)1.19.0 (2023-08-10)Define the category and quantity typedensity derivative in respect toenthalpy``(defaultunit: ``kg2/m3.J).1.18.0 (2023-06-01)Define categoriesforchheimer linear productivity indexandforchheimer linear productivity index.Define quantity typesforchheimer linear productivity indexandforchheimer quadratic productivity index.Add units to categoriesforchheimer linear productivity indexandforchheimer quadratic productivity index.1.17.0 (2023-05-02)Standardize the usage oflbmolAdd more valid units formole per masscategory1.16.0 (2023-04-26)Add more units formole per massquantity.Define amolalitycategory.1.15.0 (2023-04-03)Addcubic meter per day perkilogram-forceper square centimeter(m3/d/kgf/cm2) unit toproductivity indexcategory.Add gauge pressures unitsPa(g),kPa(g),bar(g), andkgf/cm2(g)topressurecategory.1.14.1 (2022-11-03)Addmole per massquantity (mol/kg).1.13.0 (2021-11-30)UpdateNewton second per meterunit fromNs/mtoN.s/mto get unit display consistent with other units in the same category (support for the old unit input added).Addforce per velocity squaredquantity (N.s2/m2,lbf.s2/ft2,lbf.s2/in2,kgf.s2/m2).1.12.0 (2021-11-08)barrilis now fully type annotated, being tested withmypy.ArrayandFixedArrayareGenericsubclasses, parametrized by the container type.1.11.1 (2021-10-08)Fixed typos in unit names:kilkodynes(unit=kdyne) fixed tokilodynes,killowatts/cubic metre degree Kelvin(unit=kW/m3.K) fixed tokilowatts/cubic metre degree Kelvin.1.11.0 (2021-06-18)Add new unit: “Stokes” (St).UseTypeCheckingSupportfromoop-ext1.1.Addcubic feet per day per psi(ft3/psi.d) unit toproductivity indexcategory.Addcalories/metre hour degree Celsius(cal/m.h.degC) unit tothermal conductivitycategory.Addcalorie/hour square metre deg C(cal/h.m2.degC) unit toheat transfer coefficientcategory.Addstd cubic metres/second(sm3/s) unit tostandard volume per timecategory.Addmillion std cubic feet/stock tank barrel(MMscf/stb),stock tank barrel/std cubic feet(stb/scf) andstock tank barrel/million std cubic feet(stb/MMscf) units tostandard volume per standard volumecategory.1.10.0 (2020-10-22)Removingthermodynamic temperatureas default category fordegFanddegRunits.1.9.0 (2020-02-20)NewclassmethodArray.FromScalarsthat creates anArrayfrom aList[Scalar].Add new unit: “barrel per second” (bbl/s).1.8.0 (2020-01-10)Add new category: “standard volume per standard volume”.Move unitsm3/sm3from “volume per volume” to “standard volume per standard volume”.1.7.2 (2019-10-16)_foundationhas been renamed to_util, and a lot of functions which were not being
used anymore have been removed.Add new unit category mass temperature per mol (kg.K/mol).Some units have been renamed as they were deemed out-of-place in the oil industry to something more usual (for example,1000ft3/dbecameMcf/d).
The old representation of those units is still supported, but they will be automatically translated duringQuantitycreation, so this change should not affect users much.Fix division1.0 / awhereais aScalarorArrayand also add support for floor
division, i.e., operations likea // bwhereaandbareScalarorArray(and combinations withfloatorint).Add new unit category for Joule-Thomson coefficient (K/Pa).Add new temperature unit for density derivative in respect to temperature (kg/m3.K).1.7.1 (2019-10-03)Fixed bug in/and-operators forFixedArray.1.7.0 (2019-06-18)Add unit system.1.6.1 (2019-04-11)Change export to include ICurve and Curve and exclude IReadOnlyScalar.1.6.0 (2019-04-10)Add curve implementation.Add support to interfaces from oop-ext.Drop support to Python 2.1.5.0 (2019-01-09)Quantity.CheckValuenow raisesQuantityValidationErrorinstead ofValueError.1.4.0 (2018-12-17)Add new category for “concentration ratio”.1.3.0 (2018-10-13)Add “per micrometre” unit to “per length” category.Remove internalbarril.fixturesmodule as it is not necessary or part of the public API.1.2.0 (2018-09-26)Add units for defining Spring-Dashpot movements.1.1.0 (2018-09-24)Addnumberandfractionproperties toFractionValue.Addunitread-only property toQuantity.1.0.0 (2018-09-21)First feature release.0.1.0 (2018-09-03)First release on PyPI.