Skip to content

Commit

Permalink
Merge pull request #171 from JonasKlimt/romain
Browse files Browse the repository at this point in the history
Romain
  • Loading branch information
romainsacchi committed Jul 11, 2024
2 parents d130cc4 + 4b24072 commit 0da2621
Show file tree
Hide file tree
Showing 36 changed files with 2,826 additions and 9,073 deletions.
1,295 changes: 1,252 additions & 43 deletions dev/Untitled.ipynb

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions premise/activity_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
DATA_DIR / "GAINS_emission_factors" / "gains_ecoinvent_sectoral_mapping.yaml"
)
HEAT_TECHS = VARIABLES_DIR / "heat_variables.yaml"
PASSENGER_CARS = VARIABLES_DIR / "transport_passenger_cars_variables.yaml"
TWO_WHEELERS = VARIABLES_DIR / "transport_two_wheelers_variables.yaml"
BUSES = VARIABLES_DIR / "transport_bus_variables.yaml"
TRUCKS = VARIABLES_DIR / "transport_roadfreight_variables.yaml"
TRAINS = VARIABLES_DIR / "transport_railfreight_variables.yaml"


def get_mapping(filepath: Path, var: str, model: str = None) -> dict:
Expand Down Expand Up @@ -264,6 +269,60 @@ 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.
"""
if transport_type == "car":
return self.generate_sets_from_filters(
get_mapping(filepath=PASSENGER_CARS, var="ecoinvent_aliases")
)
elif transport_type == "two-wheeler":
return self.generate_sets_from_filters(
get_mapping(filepath=TWO_WHEELERS, var="ecoinvent_aliases")
)
elif transport_type == "bus":
return self.generate_sets_from_filters(
get_mapping(filepath=BUSES, var="ecoinvent_aliases")
)
elif transport_type == "truck":
return self.generate_sets_from_filters(
get_mapping(filepath=TRUCKS, var="ecoinvent_aliases")
)
elif transport_type == "train":
return self.generate_sets_from_filters(
get_mapping(filepath=TRAINS, var="ecoinvent_aliases")
)

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.
"""
if transport_type == "car":
return self.generate_sets_from_filters(
get_mapping(filepath=PASSENGER_CARS, var="ecoinvent_fuel_aliases")
)
elif transport_type == "two-wheeler":
return self.generate_sets_from_filters(
get_mapping(filepath=TWO_WHEELERS, var="ecoinvent_fuel_aliases")
)
elif transport_type == "bus":
return self.generate_sets_from_filters(
get_mapping(filepath=BUSES, var="ecoinvent_fuel_aliases")
)
elif transport_type == "truck":
return self.generate_sets_from_filters(
get_mapping(filepath=TRUCKS, var="ecoinvent_fuel_aliases")
)
elif transport_type == "train":
return self.generate_sets_from_filters(
get_mapping(filepath=TRAINS, var="ecoinvent_fuel_aliases")
)

def generate_sets_from_filters(self, filtr: dict, database=None) -> dict:
"""
Generate a dictionary with sets of activity names for
Expand Down
Binary file modified premise/data/additional_inventories/lci-buses.xlsx
Binary file not shown.
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-pass_cars.xlsx
Binary file not shown.
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-two_wheelers.xlsx
Binary file not shown.
Loading

0 comments on commit 0da2621

Please sign in to comment.