Skip to content

Commit

Permalink
upate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bkt92 committed May 12, 2024
1 parent 232e643 commit 4158409
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 194 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
site/
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

Binary file added data/database.xlsx
Binary file not shown.
8 changes: 6 additions & 2 deletions docs/about.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Unit Converter is a simple Python package, allowing you to perform various unit conversions
GHGpy is a python pakage, backbone for our GHG Inventory platform.

This component is lightweight, high performance and does not require any additional dependencies.
This is an intuitive, lightweight, high performance GHG accouting tool.

With special number type: `ufnum` easy to evaluate the data uncertainly.

Compliant with IPCC 2006 and GHG Protocol, with the latest database update (limited free database).

For more information on how to start using the package, check:

Expand Down
35 changes: 17 additions & 18 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
## How To Convert Units?

The `converter` Python package helps you perform various unit conversions.
## How Calculate your factory emission?

The `ghgpy` Python package helps you doing ghg invertory in the easy way and more ...
Before using the package, you need to install it on your system. You can do it by using pip:

pip install python-unitconverterermac
pip install ghgpy

Inside of your python script you can now import the
converter from the `unitconverter`
converter from the `ghgpy`
package:

# your_script.py
from unitconverter import converter
from ghgpy import factory

After you've imported the package, you can use it
to perform various unit conversions:
After you've imported the package, you can use it:

# your_script.py
from unitconverter import converter

print(converter.convertLength(20, "m", "cm")) # OUTPUT: 200.0
print(converter.convertWeight(5, "kilogram", "g")) # OUTPUT: 5000.0
from ghgpy import factory
from ghgpy.activities.energy import combustion

You can also import conversion functions for specific units:
First you need to crete a factory with basic information:
# your_script.py
from unitconverter.converter import convertLength
your_factory = factory("your inpu here")

You can then call the specific function to convert units:
Then you can add a process to your factory with fuel data:
# your_script.py
from unitconverter.converter import convertLength
your_factory.add_process(combustion(fuel, "type of combustion"))

print(convertLength(5, "meter", "centimeter")) # OUTPUT: 500.0
Get the total emission of your factory
your_factory.emission()


Modules available for conversion include: `convertLength`, `convertWeight`, `convertVolume`, `convertPressure`, `convertEnergy`, `convertData`, `convertSpeed`, `convertTime`, `convertTemperature`
Activity modules: `combustion`, `refrigerant_use`, `refrigerant_use`
Fuel modules: `BaseFuel`, `DefaultFuel`
Material and GHG gas modules: `GHGGas`
4 changes: 3 additions & 1 deletion docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ This page contains in-depth documentation of `unitconverter` package. Use it as
reference for the technical implementation of the
`converter` project code.

::: src.ghgpy.datamodel.fuel
::: src.ghgpy.datamodel.fuel
::: src.ghgpy.datamodel.ghggas
::: src.ghgpy.datamodel.unit_converters
52 changes: 12 additions & 40 deletions notebooks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
"metadata": {},
"outputs": [],
"source": [
"from src.ghgpy.datamodel.fuel import DefaultFuel, BaseFuel\n",
"from src.ghgpy.datamodel.fuel import DefaultFuel, BaseFuel, ufnum, FuelData, dict_to_fuel\n",
"from src.ghgpy.datamodel.ghggas import GHGGas\n",
"\n",
"from src.ghgpy.data.fuels import default_fuel_database\n",
"from uncertainty.utypes import ufloat\n",
"from typing import Optional\n",
"from pydantic import BaseModel, ConfigDict"
"from src.ghgpy.data.fuels import default_fuel_database"
]
},
{
Expand All @@ -21,41 +18,33 @@
"metadata": {},
"outputs": [],
"source": [
"fuel0 = BaseFuel(\"H2\", \"Hydrogen\", 10, 10, 10, 20, \"kg\")"
"fuel0 = BaseFuel(\"H2\", \"Hydrogen\", ufnum(10), ufnum(10), ufnum(10), ufnum(20000, 2000), \"kg\")\n",
"fuel1 = DefaultFuel(default_fuel_database, 'DO', ufnum(1000), 'l')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"fuel1 = DefaultFuel(default_fuel_database, 'DO', (10, 2), 'l')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ufloat(10.000, 2.000)"
"ufloat(74066.667, 1466.667)"
]
},
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fuel1.to_litre()"
"(44/12)*fuel1.calc_cc()/fuel1.cal_energy()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -64,30 +53,13 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"fuel(name='CO2', amount=2.7755575615628914e-17 tCO2e)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"co2 + co2 + co2 - co2 - co2 - co2"
"def load_json(data: FuelData):\n",
" return data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Binary file modified src/ghgpy/data/__pycache__/fuels.cpython-311.pyc
Binary file not shown.
17 changes: 10 additions & 7 deletions src/ghgpy/data/fuels.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
default_fuel_database = {
"DO": {
"desc": "Gas/Diesel Oil",
"ncv": 43.0,
"ccf": 20.2,
"density": 844
"ncv": {"value": 43.0,
"uncertainty": 0
},
"ccf": {"value": 20.2,
"uncertainty": 0.4
},
"density": {"value": 844,
"uncertainty": 0
}
},
"RFO": {

}
}
}
Binary file modified src/ghgpy/datamodel/__pycache__/fuel.cpython-311.pyc
Binary file not shown.
Binary file modified src/ghgpy/datamodel/__pycache__/unit_converters.cpython-311.pyc
Binary file not shown.
Loading

0 comments on commit 4158409

Please sign in to comment.