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 Dec 10, 2023
2 parents dbb43aa + 5e8b12f commit 211affc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
21 changes: 10 additions & 11 deletions carculator_utils/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ def load_mapping(
(
name_to,
location_to,
tuple(categories_to.split("::")) if categories_to != '' else '',
tuple(categories_to.split("::")) if categories_to != "" else "",
unit_to,
ref_prod_to
ref_prod_to,
)
] = (
name_from,
location_from,
tuple(categories_from.split("::")) if categories_from != '' else '',
tuple(categories_from.split("::")) if categories_from != "" else "",
unit_from,
ref_prod_from,
)
Expand Down Expand Up @@ -215,8 +215,6 @@ def __init__(
"3.9": load_mapping(filename="ei38_to_ei39.csv"),
}



def rename_vehicles(self) -> None:
"""
Rename powertrain acronyms to full length descriptive terms
Expand Down Expand Up @@ -281,7 +279,6 @@ def write_lci(
mult_factor = 1

if ecoinvent_version != "3.8":

tuple_output = self.flow_map[ecoinvent_version].get(
tuple_output, tuple_output
)
Expand All @@ -294,16 +291,16 @@ def write_lci(
if len(tuple_input) == 3:
key_input = (
tuple_input[0],
'',
"",
tuple_input[1],
tuple_input[2],
''
"",
)
else:
key_input = (
tuple_input[0],
tuple_input[1],
'',
"",
tuple_input[2],
tuple_input[3],
)
Expand All @@ -312,7 +309,7 @@ def write_lci(
)

# remove blanks from tuple
tuple_input = tuple([i for i in tuple_input if i != ''])
tuple_input = tuple([i for i in tuple_input if i != ""])

if tuple_output[0] in blacklist.get(ecoinvent_version, []):
continue
Expand Down Expand Up @@ -400,7 +397,9 @@ def write_lci(
pwt = possible_pwt[0]

pwt = self.rev_rename_pwt[pwt]
size = [w for w in available_sizes if w in tuple_output[0]][0]
size = [w for w in available_sizes if w + "," in tuple_output[0]][
0
] # ',' is required to distinguish "Medium" vehicle and "Medium SUV"
year = [w for w in available_years if str(w) in tuple_output[0]][0]

for param, formatting in self.rename_parameters.items():
Expand Down
5 changes: 2 additions & 3 deletions carculator_utils/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1698,14 +1698,13 @@ def add_refrigerant_emissions(self) -> None:
self.inputs[item]
for item in self.inputs
if f"transport, {self.vm.vehicle_type}, " in item[0]
and (match := re.search(r"(\d{4})", item[0]))
and int(match.group(1)) < 2022
and (match := re.search(r"(\d{4})", item[0]))
and int(match.group(1)) < 2022
]
index = self.get_index_vehicle_from_array(
[i for i in self.scope["year"] if i < 2022]
)


self.A[
:,
self.inputs[
Expand Down
1 change: 0 additions & 1 deletion carculator_utils/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,6 @@ def override_vehicle_mass(self):
dict(powertrain=pwt, size=size, year=year, parameter="curb mass")
] = target_mass


def set_vehicle_masses(self) -> None:
"""
Define ``curb mass``, ``driving mass``, and ``total cargo mass``.
Expand Down

0 comments on commit 211affc

Please sign in to comment.