Skip to content

Commit

Permalink
Fix LCIs
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Jul 31, 2024
1 parent f613063 commit 490c7c3
Show file tree
Hide file tree
Showing 11 changed files with 250 additions and 8 deletions.
Binary file modified premise/data/additional_inventories/lci-PGM.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-PV-GaAs.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-PV-perovskite.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-PV.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-graphite.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-rail-freight.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-vanadium.xlsx
Binary file not shown.
229 changes: 228 additions & 1 deletion premise/data/utils/export/simapro_categories.csv

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion premise/electricity.py
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,8 @@ def update_efficiency_of_solar_pv(self) -> None:
"CIGS",
"CIS",
"CdTe",
"perovskite",
"GaAs",
]

# TODO: check if IAM data provides efficiencies for PV panels and use them instead
Expand All @@ -1423,7 +1425,12 @@ def update_efficiency_of_solar_pv(self) -> None:
)

for dataset in datasets:
power = float(re.findall(r"[-+]?\d*\.\d+|\d+", dataset["name"])[0])
numbers = re.findall(r"[-+]?\d*\.\d+|\d+", dataset["name"])
if not numbers:
print(f"No numerical value found in dataset name: {dataset['name']}")
continue

power = float(numbers[0])

if "mwp" in dataset["name"].lower():
power *= 1000
Expand Down
16 changes: 10 additions & 6 deletions premise/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ def create_index_of_A_matrix(database):
"""
return {
(
database[i]["name"],
database[i]["reference product"],
database[i]["unit"],
database[i]["location"],
database[i]["name"].strip(),
database[i]["reference product"].strip(),
database[i]["unit"].strip(),
database[i]["location"].strip(),
): i
for i in range(0, len(database))
}
Expand Down Expand Up @@ -1523,7 +1523,7 @@ def export_db_to_simapro(self, olca_compartments=False):
if item == "System description":
writer.writerow(["Ecoinvent v3"])
if item == "Infrastructure":
writer.writerow(["Yes"])
writer.writerow(["No"])
if item == "External documents":
writer.writerow(
[
Expand Down Expand Up @@ -1798,7 +1798,11 @@ def export_db_to_simapro(self, olca_compartments=False):
print(x)

if len(self.unmatched_category_flows) > 0:
print(f"{len(self.unmatched_category_flows)} unmatched flow categories.")
print(f"{len(self.unmatched_category_flows)} unmatched flow categories. Check unlinked.log.")
# save the list of unmatched flow to unlinked.log
with open("unlinked.log", "a") as f:
for item in self.unmatched_category_flows:
f.write(f"{item}\n")

print(f"Simapro CSV file saved in {self.filepath}.")

Expand Down
4 changes: 4 additions & 0 deletions premise/new_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
FILEPATH_BUSES = INVENTORY_DIR / "lci-buses.xlsx"
FILEPATH_PASS_CARS = INVENTORY_DIR / "lci-pass_cars.xlsx"
FILEPATH_RAIL_FREIGHT = INVENTORY_DIR / "lci-rail-freight.xlsx"
FILEPATH_PV_GAAS = INVENTORY_DIR / "lci-PV-GaAs.xlsx"
FILEPATH_PV_PEROVSKITE = INVENTORY_DIR / "lci-PV-perovskite.xlsx"

config = load_constants()

Expand Down Expand Up @@ -780,6 +782,8 @@ def __import_inventories(self) -> List[dict]:
(FILEPATH_BUSES, "3.7"),
(FILEPATH_PASS_CARS, "3.7"),
(FILEPATH_RAIL_FREIGHT, "3.9"),
(FILEPATH_PV_GAAS, "3.10"),
(FILEPATH_PV_PEROVSKITE, "3.10"),
]
for filepath in filepaths:
# make an exception for FILEPATH_OIL_GAS_INVENTORIES
Expand Down

0 comments on commit 490c7c3

Please sign in to comment.