diff --git a/CHANGES.md b/CHANGES.md index 740ad80..ea55b5c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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` diff --git a/bw2io/__init__.py b/bw2io/__init__.py index e28e4a7..a557dbc 100644 --- a/bw2io/__init__.py +++ b/bw2io/__init__.py @@ -48,7 +48,7 @@ "useeio20", ] -__version__ = "0.9.DEV37" +__version__ = "0.9.DEV38" from .backup import ( backup_data_directory, diff --git a/bw2io/ecoinvent.py b/bw2io/ecoinvent.py index e8ad978..8ca472a 100644 --- a/bw2io/ecoinvent.py +++ b/bw2io/ecoinvent.py @@ -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):