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 Feb 10, 2024
2 parents 435fcc5 + ffb95d6 commit ba6c832
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
20 changes: 12 additions & 8 deletions unfold/fold.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ def write_formatted_data(name, data, filepath):
exc["amount"],
exc["unit"],
exc.get("location"),
"::".join(list(exc.get("categories", [])))
if exc["type"] == "biosphere"
else None,
(
"::".join(list(exc.get("categories", [])))
if exc["type"] == "biosphere"
else None
),
exc["type"],
exc.get("product"),
]
Expand Down Expand Up @@ -441,11 +443,13 @@ def get_exchange(
"categories": cat,
"type": flow_type,
"amount": amount if flow_type != "production" else _(amount),
"input": self.dependency_mapping[(name, ref, loc, unit, cat)]
if flow_type == "biosphere"
else (
self.datapackage_name,
self.fetch_exchange_code(name, ref, loc, unit),
"input": (
self.dependency_mapping[(name, ref, loc, unit, cat)]
if flow_type == "biosphere"
else (
self.datapackage_name,
self.fetch_exchange_code(name, ref, loc, unit),
)
),
}

Expand Down
13 changes: 8 additions & 5 deletions unfold/unfold.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Contains the Unfold class, to extract datapackage files.
"""

import copy
import os
import pickle
Expand Down Expand Up @@ -526,11 +527,13 @@ def get_exchange(
"categories": cat,
"type": flow_type,
"amount": amount if flow_type != "production" else _(amount),
"input": self.fix_key((name, ref, loc, cat))
if flow_type == "biosphere"
else (
scenario_name,
self.fetch_exchange_code(name, ref, loc),
"input": (
self.fix_key((name, ref, loc, cat))
if flow_type == "biosphere"
else (
scenario_name,
self.fetch_exchange_code(name, ref, loc),
)
),
}

Expand Down

0 comments on commit ba6c832

Please sign in to comment.