Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Sep 17, 2023
2 parents 0c4b0a3 + 7eacc0b commit 5a8db23
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions unfold/unfold.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def find_correct_id(self, key: tuple) -> [tuple, None]:

else:
raise f"Could not find key: {key}"
#return key
# return key

def fix_key(self, key: tuple) -> tuple:
if key in self.dependency_mapping:
Expand Down Expand Up @@ -761,7 +761,9 @@ def filter_out_datasets(
"""

# Get the list of datasets not used in the current scenario.
df_gr = self.scenario_df.groupby(["to activity name", "to reference product", "to location"]).sum(numeric_only=True)
df_gr = self.scenario_df.groupby(
["to activity name", "to reference product", "to location"]
).sum(numeric_only=True)

datasets_not_in_scenario = df_gr.loc[
(df_gr[scenario_name] == 0) & (df_gr.sum(1) != 0), :
Expand All @@ -778,19 +780,21 @@ def filter_out_datasets(

# Remove datasets that are not in the current scenario.
database = [
act for act in database
if (act["name"], act["reference product"], act["location"]) not in datasets_not_in_scenario
act
for act in database
if (act["name"], act["reference product"], act["location"])
not in datasets_not_in_scenario
]

return database

def check_usage(self, name: str, product: str, location: str, database: list) -> bool:
def check_usage(
self, name: str, product: str, location: str, database: list
) -> bool:
# check that name, product, location are not used in any exchange of database

pass



def generate_superstructure_database(self) -> List[dict]:
"""
Generates the superstructure database.
Expand Down

0 comments on commit 5a8db23

Please sign in to comment.