Skip to content

Commit

Permalink
🐛 fix: namespaced methods get right units
Browse files Browse the repository at this point in the history
Previously the namespaced methods didn't get the units correctly because the units_mapping was
missing the namespace.

d[-_-]b
  • Loading branch information
tngTUDOR committed Sep 12, 2024
1 parent 79c3fbe commit 76c95e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bw2io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"useeio20",
]

__version__ = "0.9.DEV37"
__version__ = "0.9.DEV38"

from .backup import (
backup_data_directory,
Expand Down
19 changes: 15 additions & 4 deletions bw2io/ecoinvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,21 @@ def import_ecoinvent_release(
}
cf_col_label = CF_COLUMN_LABELS.get(version, "cf")
units_col_label = pick_a_unit_label_already(units[0])
units_mapping = {
(row["method"], row["category"], row["indicator"]): row[units_col_label]
for row in units
}
if namespace_lcia_methods:
units_mapping = {
(
f"ecoinvent-{version}",
row["method"],
row["category"],
row["indicator"],
): row[units_col_label]
for row in units
}
else:
units_mapping = {
(row["method"], row["category"], row["indicator"]): row[units_col_label]
for row in units
}

biosphere_mapping = {}
for flow in bd.Database(biosphere_name):
Expand Down

0 comments on commit 76c95e4

Please sign in to comment.