Skip to content

Commit

Permalink
Add newer PEM fuel cell inventories
Browse files Browse the repository at this point in the history
Fix migration from 310 to 38 and 39
  • Loading branch information
romainsacchi committed Aug 28, 2024
1 parent 5b085c4 commit a9dc8c1
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 26 deletions.
Binary file modified premise/data/additional_inventories/lci-PV-perovskite.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-fuel_cell.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-trucks.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-waste-CHP.xlsx
Binary file not shown.
13 changes: 8 additions & 5 deletions premise/data/additional_inventories/migration_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,6 @@ from,to,name_from,ref_prod_from,location_from,name_to,ref_prod_to,location_to
39,36,"market for concrete, normal strength","concrete, normal strength",ZA,"market for concrete, normal","concrete, normal",ZA
38,39,"market for energy use and operation emissions, electric bicycle","energy use and operation emissions, electric bicycle",GLO,"market for energy use, electric bicycle","energy use, electric bicycle",GLO
38,39,"market for energy use and operation emissions, electric bicycle, electricity from renewable energy products","energy use and operation emissions, electric bicycle, electricity from renewable energy products",GLO,"market for energy use, electric bicycle, electricity from renewable energy products","energy use, electric bicycle, electricity from renewable energy products",GLO
38,39,"market for iron (III) chloride, without water, in 40% solution state","iron (III) chloride, without water, in 40% solution state",GLO,"market for iron(III) chloride, without water, in 40% solution state","iron (III) chloride, without water, in 40% solution state",GLO
38,39,market for meta-phenylene diamine,meta-phenylene diamine,GLO,market for resorcinol,resorcinol,GLO
38,39,"market for natural gas, burned in gas motor, for storage","natural gas, burned in gas motor, for storage",GLO,"market for natural gas, burned in gas turbine","natural gas, burned in gas turbine",GLO
38,39,"market for polar fleece production, energy use only","polar fleece production, energy use only",GLO,"market for polar fleece, energy use only","polar fleece, energy use only",GLO
Expand Down Expand Up @@ -841,7 +840,6 @@ from,to,name_from,ref_prod_from,location_from,name_to,ref_prod_to,location_to
38,310,"market for concrete, normal","concrete, normal",ZA,"market for concrete, normal strength","concrete, normal strength",ZA
38,310,"market for energy use and operation emissions, electric bicycle","energy use and operation emissions, electric bicycle",GLO,"market for energy use, electric bicycle","energy use, electric bicycle",GLO
38,310,"market for energy use and operation emissions, electric bicycle, electricity from renewable energy products","energy use and operation emissions, electric bicycle, electricity from renewable energy products",GLO,"market for energy use, electric bicycle, electricity from renewable energy products","energy use, electric bicycle, electricity from renewable energy products",GLO
38,310,"market for iron (III) chloride, without water, in 40% solution state","iron (III) chloride, without water, in 40% solution state",GLO,"market for iron(III) chloride, without water, in 40% solution state","iron (III) chloride, without water, in 40% solution state",GLO
38,310,market for meta-phenylene diamine,meta-phenylene diamine,GLO,market for resorcinol,resorcinol,GLO
38,310,"market for natural gas, burned in gas motor, for storage","natural gas, burned in gas motor, for storage",GLO,"market for natural gas, burned in gas turbine","natural gas, burned in gas turbine",GLO
38,310,"market for polar fleece production, energy use only","polar fleece production, energy use only",GLO,"market for polar fleece, energy use only","polar fleece, energy use only",GLO
Expand Down Expand Up @@ -987,6 +985,8 @@ from,to,name_from,ref_prod_from,location_from,name_to,ref_prod_to,location_to
35,310,"market for ammonia, liquid","ammonia, liquid",RER,"market for ammonia, anhydrous, liquid","ammonia, anhydrous, liquid",RER
35,310,"treatment of waste emulsion paint, municipal incineration",waste emulsion paint,CH,"treatment of waste emulsion paint, municipal incineration FAE",waste emulsion paint,CH
39,310,sodium chloride electrolysis,sodium,RER,"sodium production, sodium chloride electrolysis, molten salt cell",sodium,RER
310,39,"sodium production, sodium chloride electrolysis, molten salt cell",sodium,RER,sodium chloride electrolysis,sodium,RER
310,38,"sodium production, sodium chloride electrolysis, molten salt cell",sodium,RER,sodium chloride electrolysis,sodium,RER
39,310,market for inert waste,inert waste,CH,"market for inert waste, for final disposal","inert waste, for final disposal",CH
35,310,"market for sodium hydroxide, without water, in 50% solution state","sodium hydroxide, without water, in 50% solution state",GLO,,,RoW
36,310,"market for sodium hydroxide, without water, in 50% solution state","sodium hydroxide, without water, in 50% solution state",GLO,,,RoW
Expand Down Expand Up @@ -1191,6 +1191,7 @@ from,to,name_from,ref_prod_from,location_from,name_to,ref_prod_to,location_to
37,310,"treatment of waste, from silicon wafer production, inorganic, residual material landfill","waste, from silicon wafer production, inorganic",CH,"treatment of waste, from silicon wafer production, inorganic, residual material landfill","waste, from silicon wafer production, inorganic",RoE
38,310,"treatment of waste, from silicon wafer production, inorganic, residual material landfill","waste, from silicon wafer production, inorganic",CH,"treatment of waste, from silicon wafer production, inorganic, residual material landfill","waste, from silicon wafer production, inorganic",RoE
39,310,"treatment of waste, from silicon wafer production, inorganic, residual material landfill","waste, from silicon wafer production, inorganic",CH,"treatment of waste, from silicon wafer production, inorganic, residual material landfill","waste, from silicon wafer production, inorganic",RoE
310,38,"treatment of wastewater from wafer fabrication, wastewater treatment",wastewater from wafer fabrication,RoW,"treatment of wastewater from wafer fabrication, capacity 1.1E10l/year",wastewater from wafer fabrication,RoW
35,310,"treatment of waste paperboard, municipal incineration",waste paperboard,CH,"treatment of waste paperboard, municipal incineration FAE",waste paperboard,CH
36,310,"treatment of waste paperboard, municipal incineration",waste paperboard,CH,"treatment of waste paperboard, municipal incineration FAE",waste paperboard,CH
37,310,"treatment of waste paperboard, municipal incineration",waste paperboard,CH,"treatment of waste paperboard, municipal incineration FAE",waste paperboard,CH
Expand Down Expand Up @@ -1276,10 +1277,9 @@ from,to,name_from,ref_prod_from,location_from,name_to,ref_prod_to,location_to
38,310,"treatment of waste polyvinylfluoride, municipal incineration","waste polyvinylfluoride","CH","treatment of waste polyvinylfluoride, municipal incineration FAE","waste polyvinylfluoride",CH
39,310,"treatment of waste polyvinylfluoride, municipal incineration","waste polyvinylfluoride","CH","treatment of waste polyvinylfluoride, municipal incineration FAE","waste polyvinylfluoride",CH
39,310,market for blast furnace slag,blast furnace slag,GLO,,,RoW
310,37,"market for iron(III) chloride, without water, in 40% solution state","iron(III) chloride, without water, in 40% solution state",GLO,"market for iron (III) chloride, without water, in 40% solution state","iron (III) chloride, without water, in 40% solution state",
310,38,"market for iron(III) chloride, without water, in 40% solution state","iron(III) chloride, without water, in 40% solution state",GLO,"market for iron (III) chloride, without water, in 40% solution state","iron (III) chloride, without water, in 40% solution state",
310,37,"market for sodium hydroxide, without water, in 50% solution state","sodium hydroxide, without water, in 50% solution state",RER,,,GLO
310,38,"market for sodium hydroxide, without water, in 50% solution state","sodium hydroxide, without water, in 50% solution state",RER,,,GLO
310,39,"market for sodium hydroxide, without water, in 50% solution state","sodium hydroxide, without water, in 50% solution state",RER,,,GLO
37,310,"market for neutralising agent, sodium hydroxide-equivalent","neutralising agent, sodium hydroxide-equivalent",GLO,,,RoW
38,310,"market for neutralising agent, sodium hydroxide-equivalent","neutralising agent, sodium hydroxide-equivalent",GLO,,,RoW
39,310,"market for neutralising agent, sodium hydroxide-equivalent","neutralising agent, sodium hydroxide-equivalent",GLO,,,RoW
Expand All @@ -1305,4 +1305,7 @@ from,to,name_from,ref_prod_from,location_from,name_to,ref_prod_to,location_to
310,39,"market for chloroform","chloroform",RER,"market for trichloromethane","trichloromethane",RER
310,37,"market for benzene","benzene","RER","market for benzene","benzene","GLO"
310,38,"market for benzene","benzene","RER","market for benzene","benzene","GLO"
310,39,"market for benzene","benzene","RER","market for benzene","benzene","GLO"
310,39,"market for benzene","benzene","RER","market for benzene","benzene","GLO"
310,38,"market for natural gas, low pressure","natural gas, low pressure",DE,"market for natural gas, low pressure","natural gas, low pressure",RoW
310,38,"treatment of wastewater from PV cell production, wastewater treatment",wastewater from PV cell production,CH,"treatment of wastewater from PV cell production, capacity 5E9l/year",wastewater from PV cell production,CH
310,39,"market for iron (III) chloride, without water, in 40% solution state","iron (III) chloride, without water, in 40% solution state",GLO,"market for iron(III) chloride, without water, in 40% solution state","iron (III) chloride, without water, in 40% solution state",GLO
2 changes: 2 additions & 0 deletions premise/data/utils/export/correspondence_biosphere_flows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ soil:
Dimethenamid: Dimethenamide
Prohexadione-calcium: Prohexadione calcium
Sodium: Sodium I
Iron ion: Iron, ion
Iron, ion: Iron ion


water:
Expand Down
39 changes: 19 additions & 20 deletions premise/inventory_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,13 +857,12 @@ def load_inventory(self) -> bw2io.ExcelImporter:

def prepare_inventory(self) -> None:
if self.version_in != self.version_out:
# if version_out is 3.9, migrate towards 3.8 first, then 3.9
if self.version_out in ["3.9", "3.9.1", "3.10"]:
if self.version_in != "3.8":
print("Migrating to 3.8 first")
self.import_db.migrate(
f"migration_{self.version_in.replace('.', '')}_38"
)
# if version_out is 3.9 or 3.10, migrate towards 3.8 first, then 3.9 or 3.10
if self.version_out in ["3.9", "3.9.1", "3.10"] and self.version_in in ["3.5", "3.6", "3.7"]:
print("Migrating to 3.8 first")
self.import_db.migrate(
f"migration_{self.version_in.replace('.', '')}_38"
)
self.import_db.migrate(
f"migration_38_{self.version_out.replace('.', '')}"
)
Expand Down Expand Up @@ -948,16 +947,17 @@ def load_inventory(self):
def prepare_inventory(self):
# if version_out is 3.9, migrate towards 3.8 first, then 3.9
if self.version_out in ["3.9", "3.9.1", "3.10"]:
if self.version_in != "3.8":
if self.version_out in ["3.9", "3.9.1", "3.10"] and self.version_in in ["3.5", "3.6", "3.7"]:
print("Migrating to 3.8 first")
self.import_db.migrate(
f"migration_{self.version_in.replace('.', '')}_38"
)
self.import_db.migrate(f"migration_38_{self.version_out.replace('.', '')}")

self.import_db.migrate(
f"migration_{self.version_in.replace('.', '')}_{self.version_out.replace('.', '')}"
)
self.import_db.migrate(
f"migration_38_{self.version_out.replace('.', '')}"
)
self.import_db.migrate(
f"migration_{self.version_in.replace('.', '')}_{self.version_out.replace('.', '')}"
)

self.lower_case_technosphere_exchanges()
self.add_biosphere_links()
Expand Down Expand Up @@ -1022,13 +1022,12 @@ def load_inventory(self):

def prepare_inventory(self):
if str(self.version_in) != self.version_out:
# if version_out is 3.9, migrate towards 3.8 first, then 3.9
if self.version_out in ["3.9", "3.9.1", "3.10"]:
if str(self.version_in) != "3.8":
print("Migrating to 3.8 first")
self.import_db.migrate(
f"migration_{self.version_in.replace('.', '')}_38"
)
# if version_out is 3.9 or 3.10, migrate towards 3.8 first, then 3.9/3.10
if self.version_out in ["3.9", "3.9.1", "3.10"] and self.version_in in ["3.5", "3.6", "3.7"]:
print("Migrating to 3.8 first")
self.import_db.migrate(
f"migration_{self.version_in.replace('.', '')}_38"
)
self.import_db.migrate(
f"migration_38_{self.version_out.replace('.', '')}"
)
Expand Down
2 changes: 1 addition & 1 deletion premise/new_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def __import_inventories(self) -> List[dict]:
(FILEPATH_NUCLEAR_EPR, "3.8"),
(FILEPATH_NUCLEAR_SMR, "3.8"),
(FILEPATH_WAVE, "3.8"),
(FILEPATH_FUEL_CELL, "3.9"),
(FILEPATH_FUEL_CELL, "3.10"),
(FILEPATH_CSP, "3.9"),
(FILEPATH_HYDROGEN_HEATING, "3.9"),
(FILEPATH_METHANOL_HEATING, "3.9"),
Expand Down
1 change: 1 addition & 0 deletions premise/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def check_matrix_squareness(self):
f"WARNING: matrix is not square: {len(list(set(activities)))} activities, {len(list(set(products)))} products."
)


def check_uncertainty(self):
MANDATORY_UNCERTAINTY_FIELDS = {
2: {"loc", "scale"},
Expand Down

0 comments on commit a9dc8c1

Please sign in to comment.