Skip to content

Commit

Permalink
Include transport work from Jonas
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Jul 30, 2024
1 parent 5fb8cab commit 1996e4f
Show file tree
Hide file tree
Showing 16 changed files with 280 additions and 201 deletions.
254 changes: 125 additions & 129 deletions dev/Untitled1.ipynb

Large diffs are not rendered by default.

76 changes: 73 additions & 3 deletions premise/activity_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,76 @@ def generate_material_map(self) -> dict:
"""
return self.generate_sets_from_filters(self.materials_filters)

def generate_transport_map(self, transport_type: str) -> dict:
"""
Filter ecoinvent processes related to transport.
Rerurns a dictionary with transport type as keys (see below) and
a set of related ecoinvent activities' names as values.
"""
mapping = {}
if transport_type == "car":
mapping = self.generate_sets_from_filters(
get_mapping(
filepath=PASSENGER_CARS, var="ecoinvent_aliases", model=self.model
)
)
elif transport_type == "two-wheeler":
mapping = self.generate_sets_from_filters(
get_mapping(
filepath=TWO_WHEELERS, var="ecoinvent_aliases", model=self.model
)
)
elif transport_type == "bus":
mapping = self.generate_sets_from_filters(
get_mapping(filepath=BUSES, var="ecoinvent_aliases", model=self.model)
)
elif transport_type == "truck":
mapping = self.generate_sets_from_filters(
get_mapping(filepath=TRUCKS, var="ecoinvent_aliases", model=self.model)
)
elif transport_type == "train":
mapping = self.generate_sets_from_filters(
get_mapping(filepath=TRAINS, var="ecoinvent_aliases", model=self.model)
)

# remove empty values
mapping = {key: val for key, val in mapping.items() if len(val) > 0}

return mapping

def generate_vehicle_fuel_map(self, transport_type: str) -> dict:
"""
Filter ecoinvent processes related to transport fuels.
Rerurns a dictionary with transport type as keys (see below) and
a set of related ecoinvent activities' names as values.
"""
mapping = {}
if transport_type == "car":
mapping = self.generate_sets_from_filters(
get_mapping(filepath=PASSENGER_CARS, var="ecoinvent_fuel_aliases")
)
elif transport_type == "two-wheeler":
mapping = self.generate_sets_from_filters(
get_mapping(filepath=TWO_WHEELERS, var="ecoinvent_fuel_aliases")
)
elif transport_type == "bus":
mapping = self.generate_sets_from_filters(
get_mapping(filepath=BUSES, var="ecoinvent_fuel_aliases")
)
elif transport_type == "truck":
mapping = self.generate_sets_from_filters(
get_mapping(filepath=TRUCKS, var="ecoinvent_fuel_aliases")
)
elif transport_type == "train":
mapping = self.generate_sets_from_filters(
get_mapping(filepath=TRAINS, var="ecoinvent_fuel_aliases")
)

# remove empty values
mapping = {key: val for key, val in mapping.items() if len(val) > 0}

return mapping

def generate_sets_from_filters(self, filtr: dict, database=None) -> dict:
"""
Generate a dictionary with sets of activity names for
Expand Down Expand Up @@ -313,8 +383,8 @@ def generate_sets_from_filters(self, filtr: dict, database=None) -> dict:

# check if all keys have values
# if not, print warning
# for key, val in mapping.items():
# if not val:
# print(f"Warning: No activities found for {key} -- revise mapping.")
for key, val in mapping.items():
if not val:
print(f"Warning: No activities found for {key} -- revise mapping.")

return mapping
Binary file modified premise/data/additional_inventories/lci-buses.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-pass_cars.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-two_wheelers.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion premise/data/iam_output_files/image_SSP1-Base.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion premise/data/iam_output_files/image_SSP2-Base.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion premise/data/iam_output_files/image_SSP2-RCP19.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion premise/data/iam_output_files/image_SSP2-RCP26.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion premise/iam_variables_mapping/transport_bus_variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
remind: FE|Transport|Pass|Road|Bus|Electric
ecoinvent_aliases:
fltr:
- 'transport, passenger bus, battery electric - overnight charging, NMC-622 battery, 13m single deck urban bus'
- 'transport, passenger bus, battery electric - overnight charging, 13m single deck urban bus'
ecoinvent_fuel_aliases:
fltr:
- electricity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Large|BEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, battery electric, NMC-622 battery, large'
- 'transport, passenger car, battery electric, Large'
mask:
- SUV
ecoinvent_fuel_aliases:
Expand All @@ -21,7 +21,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Large|FCEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, fuel cell electric, large'
- 'transport, passenger car, fuel cell electric, Large'
mask:
- SUV
ecoinvent_fuel_aliases:
Expand All @@ -34,7 +34,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Large|Gases
ecoinvent_aliases:
fltr:
- 'transport, passenger car, compressed gas, large, EURO-6'
- 'transport, passenger car, compressed gas, Large, EURO-6'
mask:
- ab
- SUV
Expand All @@ -48,7 +48,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Large|Hybrid Electric
ecoinvent_aliases:
fltr:
- 'transport, passenger car, plugin gasoline hybrid, large'
- 'transport, passenger car, plugin gasoline hybrid, Large'
mask:
- ab
- SUV
Expand All @@ -62,7 +62,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Large|Liquids
ecoinvent_aliases:
fltr:
- 'transport, passenger car, gasoline, large, EURO-6'
- 'transport, passenger car, gasoline, Large, EURO-6'
mask:
- ab
- SUV
Expand All @@ -76,7 +76,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Medium|BEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, battery electric, NMC-622 battery, medium'
- 'transport, passenger car, battery electric, Medium'
mask:
- SUV
ecoinvent_fuel_aliases:
Expand All @@ -89,7 +89,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Medium|FCEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, fuel cell electric, medium'
- 'transport, passenger car, fuel cell electric, Medium'
mask:
- SUV
ecoinvent_fuel_aliases:
Expand All @@ -102,7 +102,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Medium|Gases
ecoinvent_aliases:
fltr:
- 'transport, passenger car, compressed gas, medium, EURO-6'
- 'transport, passenger car, compressed gas, Medium, EURO-6'
mask:
- ab
- SUV
Expand All @@ -116,7 +116,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Medium|Hybrid Electric
ecoinvent_aliases:
fltr:
- 'transport, passenger car, plugin gasoline hybrid, medium'
- 'transport, passenger car, plugin gasoline hybrid, Medium'
mask:
- ab
- SUV
Expand All @@ -130,7 +130,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Medium|Liquids
ecoinvent_aliases:
fltr:
- 'transport, passenger car, gasoline, medium, EURO-6'
- 'transport, passenger car, gasoline, Medium, EURO-6'
mask:
- ab
- SUV
Expand All @@ -144,7 +144,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Mini|BEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, battery electric, NMC-622 battery, mini'
- 'transport, passenger car, battery electric, Mini'
ecoinvent_fuel_aliases:
fltr:
- electricity
Expand All @@ -155,7 +155,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Mini|FCEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, fuel cell electric, mini'
- 'transport, passenger car, fuel cell electric, Mini'
ecoinvent_fuel_aliases:
fltr:
- hydrogen
Expand All @@ -166,7 +166,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Mini|Gases
ecoinvent_aliases:
fltr:
- 'transport, passenger car, compressed gas, mini, EURO-6'
- 'transport, passenger car, compressed gas, Mini, EURO-6'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -179,7 +179,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Mini|Hybrid Electric
ecoinvent_aliases:
fltr:
- 'transport, passenger car, plugin gasoline hybrid, mini'
- 'transport, passenger car, plugin gasoline hybrid, Mini'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -192,7 +192,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Mini|Liquids
ecoinvent_aliases:
fltr:
- 'transport, passenger car, gasoline, mini, EURO-6'
- 'transport, passenger car, gasoline, Mini, EURO-6'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -205,7 +205,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|SUV|BEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, battery electric, NMC-622 battery, medium SUV'
- 'transport, passenger car, battery electric, Medium SUV'
ecoinvent_fuel_aliases:
fltr:
- electricity
Expand All @@ -216,7 +216,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|SUV|FCEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, fuel cell electric, medium SUV'
- 'transport, passenger car, fuel cell electric, Medium SUV'
ecoinvent_fuel_aliases:
fltr:
- hydrogen
Expand All @@ -227,7 +227,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|SUV|Gases
ecoinvent_aliases:
fltr:
- 'transport, passenger car, compressed gas, medium SUV, EURO-6'
- 'transport, passenger car, compressed gas, Medium SUV, EURO-6'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -240,7 +240,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|SUV|Hybrid Electric
ecoinvent_aliases:
fltr:
- 'transport, passenger car, plugin gasoline hybrid, medium SUV'
- 'transport, passenger car, plugin gasoline hybrid, Medium SUV'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -253,7 +253,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|SUV|Liquids
ecoinvent_aliases:
fltr:
- 'transport, passenger car, gasoline, medium SUV, EURO-6'
- 'transport, passenger car, gasoline, Medium SUV, EURO-6'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -266,7 +266,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Small|BEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, battery electric, NMC-622 battery, small'
- 'transport, passenger car, battery electric, Small'
ecoinvent_fuel_aliases:
fltr:
- electricity
Expand All @@ -277,7 +277,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Small|FCEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, fuel cell electric, small'
- 'transport, passenger car, fuel cell electric, Small'
ecoinvent_fuel_aliases:
fltr:
- hydrogen
Expand All @@ -288,7 +288,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Small|Gases
ecoinvent_aliases:
fltr:
- 'transport, passenger car, compressed gas, small, EURO-6'
- 'transport, passenger car, compressed gas, Small, EURO-6'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -301,7 +301,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Small|Hybrid Electric
ecoinvent_aliases:
fltr:
- 'transport, passenger car, plugin gasoline hybrid, small'
- 'transport, passenger car, plugin gasoline hybrid, Small'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -314,7 +314,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Small|Liquids
ecoinvent_aliases:
fltr:
- 'transport, passenger car, gasoline, small, EURO-6'
- 'transport, passenger car, gasoline, Small, EURO-6'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -327,7 +327,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Van|BEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, battery electric, NMC-622 battery, van'
- 'transport, passenger car, battery electric, Van'
ecoinvent_fuel_aliases:
fltr:
- electricity
Expand All @@ -338,7 +338,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Van|FCEV
ecoinvent_aliases:
fltr:
- 'transport, passenger car, fuel cell electric, van'
- 'transport, passenger car, fuel cell electric, Van'
ecoinvent_fuel_aliases:
fltr:
- hydrogen
Expand All @@ -349,7 +349,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Van|Gases
ecoinvent_aliases:
fltr:
- 'transport, passenger car, compressed gas, van, EURO-6'
- 'transport, passenger car, compressed gas, Van, EURO-6'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -362,7 +362,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Van|Hybrid Electric
ecoinvent_aliases:
fltr:
- 'transport, passenger car, plugin gasoline hybrid, van'
- 'transport, passenger car, plugin gasoline hybrid, Van'
mask:
- ab
ecoinvent_fuel_aliases:
Expand All @@ -375,7 +375,7 @@
remind: FE|Transport|VKM|Pass|Road|LDV|Van|Liquids
ecoinvent_aliases:
fltr:
- 'transport, passenger car, gasoline, van, EURO-6'
- 'transport, passenger car, gasoline, Van, EURO-6'
mask:
- ab
ecoinvent_fuel_aliases:
Expand Down
Loading

0 comments on commit 1996e4f

Please sign in to comment.