Skip to content

Commit

Permalink
Allow reference product exchange to be a functional input
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Dec 3, 2024
1 parent 3716001 commit 2125367
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bw2data/backends/proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,22 @@ def rp_exchange(self):
* The ``production`` exchange with the same name as the activity ``reference product``.
Raises ``ValueError`` if no suitable exchange is found."""
candidates = list(self.production())
candidates = list(self.exchanges())
functional = [exc for exc in candidates if exc.get("functional")]
if len(functional) > 1:
# Multifunctional process, but can try with "reference product"
candidates = functional
elif len(functional) == 1:
return functional[0]

candidates = [
exc
for exc in candidates
if exc.get("type")
in set(labels.technosphere_positive_edge_types).difference(
labels.substitution_edge_types
)
]
if len(candidates) == 1:
return candidates[0]
candidates2 = [
Expand Down

0 comments on commit 2125367

Please sign in to comment.