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 authored and romainsacchi committed Nov 27, 2024
2 parents df3e1c6 + 2c33229 commit 217c830
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions unfold/data_cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ def change_db_name(data, name):
exc["input"] = (name, exc["input"][1])
return data


def clean_fields(database):

for dataset in database:
Expand Down
20 changes: 16 additions & 4 deletions unfold/unfold.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
get_outdated_units,
remove_categories_for_technosphere_flows,
remove_missing_fields,
clean_fields
clean_fields,
)

try:
Expand Down Expand Up @@ -84,9 +84,17 @@ def get_list_unique_exchanges(databases: list) -> list:
[
(
exchange["name"].strip(),
exchange.get("product").strip() if exchange.get("product") else None,
(
exchange.get("product").strip()
if exchange.get("product")
else None
),
exchange.get("categories"),
exchange.get("location").strip() if exchange.get("location") else None,
(
exchange.get("location").strip()
if exchange.get("location")
else None
),
exchange.get("unit").strip(),
exchange.get("type").strip(),
)
Expand Down Expand Up @@ -586,7 +594,11 @@ def populate_sparse_matrix(self) -> nsp.lil_matrix:
# Destination activity
c = (
ds["name"].strip(),
ds.get("reference product").strip() if ds.get("reference product") else None,
(
ds.get("reference product").strip()
if ds.get("reference product")
else None
),
ds.get("categories"),
ds.get("location").strip() if ds.get("location") else None,
ds["unit"].strip(),
Expand Down

0 comments on commit 217c830

Please sign in to comment.