API Reference¶
This page contains the technical API documentation for the GHGPy package.
Activities Module¶
Energy Sector¶
GHG inventory for Energy sector Base on the IPCC 2006 w 2019 refinement (c) Bui Khac Tu (bkt92)
Combustion
¶
Bases: ADCombussion
Stationary combustion (SC)
name: Activity name
desc: More description
fuels_list: Fuel list
efs_list: List of emission factor corresponding to fuels
results: Emission evaluation result
Source code in src\ghgpy\activities\energy.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
add(name, amount, unit, fuel_db=None, efdb=None, force=False)
¶
Add a fuel to fuels list
- Required database for emission factors
- Required fuel class (datamodel)
- force = True: Overwrite existing fuel data
Source code in src\ghgpy\activities\energy.py
add_custom(fuel_data, ef_data, force=False)
¶
Add a custom fuel to fuels list with custom data fuel_data = { 'name': 'Diesel_Oil', 'amount': {'value': 1000.0, 'uncertainty': 0}, 'unit': 'l', 'properties': { 'desc': 'Gas/Diesel Oil', 'ncv': {'value': 43.0, 'uncertainty': 0.0}, 'ccf': {'value': 20.2, 'uncertainty': 0.4}, 'density': {'value': 844.0, 'uncertainty': 0.0}}}
ef_data = { "co2": {"value": 54600, "uncertainty": 0 }, "ch4": {"value": 1, "uncertainty": 0 }, "n2o": {"value": 0.1, "uncertainty": 0}
Source code in src\ghgpy\activities\energy.py
emission(unit='t')
¶
Total emission in unit of CO2e (Default in metric tonnes)
eval()
¶
Evaluate the activity for ghg emission - Current GHG: CO2, CH4 and N2O - Required GHG database - Return a list of GHG emission from this activity
Source code in src\ghgpy\activities\energy.py
list_fuels()
¶
load_data(data)
classmethod
¶
remove(name)
¶
Remove a fuel from the list
Use list_fuels() method to check the list
Source code in src\ghgpy\activities\energy.py
m_combustion
¶
Mobile combustion
Calculate GHG emissions from mobile sources (vehicles).
Source code in src\ghgpy\activities\energy.py
Data Model Module¶
Fuel Classes¶
iClimate - ghgpy
Fuel objects Represent a amount of a specific fuel (C) Bui Khac Tu (bkt92) (C) iClimate
BaseFuel
¶
Bases: FuelData
Base Fuel Object (use for all kind of fuel)
Representative by TJ
Allow "+, -" operators with the same kind of fuel
Allow convert to different property (Weight, Volume, Carbon Content)
Source code in src\ghgpy\datamodel\fuel.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
cal_energy(unit='tj')
¶
Energy of Fuel in unit
Default unit Tj
Source code in src\ghgpy\datamodel\fuel.py
cal_volume(unit='l')
¶
Volume of Fuel in unit
Default unit litre
Source code in src\ghgpy\datamodel\fuel.py
cal_weight(unit='kg')
¶
Weight of Fuel in unit
Unit default kg
Source code in src\ghgpy\datamodel\fuel.py
calc_cc(unit='kg')
¶
Carbon content of Fuel in unit
Default unit kg
Source code in src\ghgpy\datamodel\fuel.py
from_dict(data)
classmethod
¶
Load json file to fuel class schema: { name: Name/code of fuel, amount: Amount of fuel (unit), unit: Unit of amount fuel, properties: { desc: More information about fuel ncv: Net calorific value (Tj/Gg) ccf: Carbon content of fuel (kg/GJ) density: Density of fuel (kg/m3) } }
Source code in src\ghgpy\datamodel\fuel.py
DefaultFuel
¶
Bases: BaseFuel
amount: amount of fuel
unit: unit of fuel
Data Sources:
Calorific value: 2006 IPCC Guidelines for National Greenhouse Gas Inventories V2_Ch1 - TABLE 1.2: https://www.ipcc-nggip.iges.or.jp/public/2006gl/pdf/2_Volume2/V2_1_Ch1_Introduction.pdf
Density: IEA Database documentation: https://wds.iea.org/wds/pdf/oil_documentation.pdf
Source code in src\ghgpy\datamodel\fuel.py
from_json(database, data)
classmethod
¶
Load json file to fuel class Schema: { name: Name/code of fuel, amount: amount of fuel (unit), unit: unit of amount fuel }
Source code in src\ghgpy\datamodel\fuel.py
energy_units
¶
Convert between difference energy units
Source code in src\ghgpy\datamodel\unit_converters.py
volume_units
¶
Convert between difference volume units
Source code in src\ghgpy\datamodel\unit_converters.py
weigh_units
¶
Convert between difference weigh units
Source code in src\ghgpy\datamodel\unit_converters.py
dict_to_fuel(data, database)
¶
Schema: Class FuelData
Load json file to fuel class schema: { name: Name/code of fuel, amount: Amount of fuel (unit), unit: Unit of amount fuel, properties: { desc: More information about fuel ncv: Net calorific value (Tj/Gg) ccf: Carbon content of fuel (kg/GJ) density: Density of fuel (kg/m3) } }
Source code in src\ghgpy\datamodel\fuel.py
GHG Gas Classes¶
iClimate - ghgpy
GHG Gas objects Represent a amount of a specific ghg gas (C) Bui Khac Tu (bkt92) (C) iClimate
GHGGas
¶
Bases: GHGDATA
GHG Gas Object (use for all kind of GHG gas)
Representative by tCO2e
Allow "+, -" operators with the same kind of gas
Source code in src\ghgpy\datamodel\ghg.py
cal_weight(unit='tonne')
¶
Convert to metric unit /n Default unit metric tonnes
Source code in src\ghgpy\datamodel\ghg.py
from_dict(data)
classmethod
¶
{'name': {'title': 'Name', 'type': 'string'}, 'amount': {'title': 'Amount', 'type': 'number'}, 'unit': {'title': 'Unit', 'type': 'string'}, 'desc': {'title': 'Desc', 'type': 'string'}, 'gwp': {'title': 'Gwp', 'type': 'number'}, 'density': {'title': 'Density', 'type': 'number'}}
Source code in src\ghgpy\datamodel\ghg.py
energy_units
¶
Convert between difference energy units
Source code in src\ghgpy\datamodel\unit_converters.py
volume_units
¶
Convert between difference volume units
Source code in src\ghgpy\datamodel\unit_converters.py
weigh_units
¶
Convert between difference weigh units
Source code in src\ghgpy\datamodel\unit_converters.py
Unit Converters¶
Unit Converters for GHG inventory (c) Bui Khac Tu (bkt92)
energy_units
¶
Convert between difference energy units
Source code in src\ghgpy\datamodel\unit_converters.py
volume_units
¶
Convert between difference volume units
Source code in src\ghgpy\datamodel\unit_converters.py
weigh_units
¶
Convert between difference weigh units
Source code in src\ghgpy\datamodel\unit_converters.py
Database Handlers¶
iClimate - ghgpy
Data handle
Middleware between app and database
(C) Bui Khac Tu (bkt92) (C) iClimate
FuelDataHandle
¶
Data handle for fuel data in ghgpy
Source code in src\ghgpy\datamodel\db.py
fuels_database
¶
The database class for the default and custom data
Default data includes
- The NCVs are taken from IPCC 2006 w 2019 refinements
- Densitys are taken from
- EFs taken from IPCC 2006 w 2019 refinements
Source code in src\ghgpy\datamodel\db.py
Factory Module¶
iClimate - ghgpy
Factory objects Represent a factory which doing ghg inventory
(C) Bui Khac Tu (bkt92) (C) iClimate
FactoryGeneral
¶
Bases: BaseModel
Source code in src\ghgpy\factory.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
add_combustion(name, desc=None, force=False)
¶
Add a combussion process
- force = True: Overwrite existing fuel data
Source code in src\ghgpy\factory.py
add_elecuse(name, desc=None, process=None, force=False)
¶
Add a electriciy end-users
- force = True: Overwrite existing fuel data
Source code in src\ghgpy\factory.py
add_refrigerantuse(name, desc=None, process=None, force=False)
¶
Add a emission from refrigerant
- force = True: Overwrite existing fuel data
Source code in src\ghgpy\factory.py
load_data(data)
classmethod
¶
remove_combustion(name)
¶
Remove a combussion process
remove_elecuse(name)
¶
remove_refrigerantuse(name)
¶
Remove emission from refrigerant