Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Oct 12, 2024
2 parents ff5224b + 6b47055 commit 6d10aaf
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions premise/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,7 @@ def run_electricity_checks(self):
self.check_efficiency()
self.save_log()


class FuelsValidation(BaseDatasetValidator):
def __init__(self, model, scenario, year, regions, database, iam_data):
super().__init__(model, scenario, year, regions, database)
Expand All @@ -1416,7 +1417,7 @@ def check_fuel_market_composition(self):
"market for natural gas, high pressure",
"market for hydrogen, gaseous",
"market for kerosene",
"market for liquefied petroleum gas"
"market for liquefied petroleum gas",
]

for ds in self.database:
Expand All @@ -1429,10 +1430,14 @@ def check_fuel_market_composition(self):

total = sum(
[
x["amount"] if x["unit"] == "cubic meter" else x["amount"] / 0.74
(
x["amount"]
if x["unit"] == "cubic meter"
else x["amount"] / 0.74
)
for x in ds["exchanges"]
if x["type"] == "technosphere"
and x["unit"] in ("kilogram", "cubic meter")
and x["unit"] in ("kilogram", "cubic meter")
]
)

Expand All @@ -1441,7 +1446,8 @@ def check_fuel_market_composition(self):
[
x["amount"]
for x in ds["exchanges"]
if x["type"] == "technosphere" and x["unit"] in ("kilogram", "cubic meter")
if x["type"] == "technosphere"
and x["unit"] in ("kilogram", "cubic meter")
]
)
if total < 0.99 or total > 1.1:
Expand All @@ -1467,12 +1473,13 @@ def check_electrolysis_electricity_input(self):
[
x["amount"]
for x in ds["exchanges"]
if x["type"] == "technosphere"
and x["unit"] == "kilowatt hour"
if x["type"] == "technosphere" and x["unit"] == "kilowatt hour"
]
)
if electricity < 40 or electricity > 60:
message = f"Electricity use for hydrogen production is {electricity}."
message = (
f"Electricity use for hydrogen production is {electricity}."
)
self.log_issue(
ds,
"electricity use for hydrogen production",
Expand Down

0 comments on commit 6d10aaf

Please sign in to comment.