Skip to content

Commit

Permalink
Always include the default biosphere in MLCA.all_databases
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdekoning committed Oct 29, 2019
1 parent f57f786 commit 6c1fc95
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions activity_browser/app/bwutils/multilca.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,17 @@ def func_units_dict(self):
return {key: 1 for func_unit in self.func_units for key in func_unit}

@property
def all_databases(self):
"""Get all databases linked to the functional units."""
databases = list()
for f in self.fu_activity_keys:
databases.append(f[0])
databases.extend(bw.databases[f[0]].get('depends', []))
return set(databases)
def all_databases(self) -> set:
""" Get all databases linked to the functional units.
"""
databases = set(f[0] for f in self.fu_activity_keys)
for dep in (bw.databases[db].get('depends', []) for db in databases):
databases = databases.union(dep)
# In rare cases, the default biosphere is not found as a dependency, see:
# https://github.com/LCA-ActivityBrowser/activity-browser/issues/298
# Always include it.
databases.add(bw.config.biosphere)
return databases

@property
def lca_scores_normalized(self):
Expand Down

0 comments on commit 6c1fc95

Please sign in to comment.