Skip to content

Commit

Permalink
remove conversion factor TJ to kWh
Browse files Browse the repository at this point in the history
  • Loading branch information
han16nah committed May 5, 2024
1 parent 522ed6d commit 4ffb06f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 2 additions & 7 deletions co2calculator/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from ._types import Kilogram, Kilometer
from .constants import (
KWH_TO_TJ,
Size,
CarFuel,
BusFuel,
Expand Down Expand Up @@ -68,9 +67,7 @@ def calc_co2_electricity(
# Get the co2 factor
co2e = emission_factors.get(params.dict())

# co2 equivalents for heating and electricity refer to a consumption of 1 TJ
# so consumption needs to be converted to TJ
return consumption * energy_share / KWH_TO_TJ * co2e
return consumption * energy_share * co2e


def calc_co2_heating(
Expand Down Expand Up @@ -110,9 +107,7 @@ def calc_co2_heating(
else:
consumption_kwh = consumption

# co2 equivalents for heating and electricity refer to a consumption of 1 TJ
# so consumption needs to be converted to TJ
return consumption_kwh * area_share / KWH_TO_TJ * co2e
return consumption_kwh * area_share / co2e


def calc_co2_businesstrip(
Expand Down
1 change: 0 additions & 1 deletion co2calculator/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import iso3166
import pandas as pd

KWH_TO_TJ = 277777.77777778

DF_AIRPORTS = pd.read_csv(
"https://davidmegginson.github.io/ourairports-data/airports.csv"
Expand Down

0 comments on commit 4ffb06f

Please sign in to comment.