Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 274 #275

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

* Add `create_products_as_new_nodes` strategy

### 0.9.DEV38 (2024-09-12)

* Fix #274: correctly set units for namespaced methods when importing ecoinvent with ecoinvent_interface

### 0.9.DEV37 (2024-09-04)

* Fix out of order but with `create_randonneur_excel_template_for_unlinked`
Expand Down
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