diff --git a/data/common/import_.py b/data/common/import_.py index c5dc0f63e..3c314eab0 100644 --- a/data/common/import_.py +++ b/data/common/import_.py @@ -1,5 +1,4 @@ from bw2io.strategies.generic import link_technosphere_by_activity_hash -from bw2io.strategies.generic import link_iterable_by_fields from common.export import search, create_activity, delete_exchange, new_exchange from subprocess import call from tqdm import tqdm @@ -236,14 +235,6 @@ def import_simapro_csv( link_technosphere_by_activity_hash, fields=("name", "location") ) ) - # # if Ginko is in a separate db: - # database.apply_strategy( - # functools.partial( - # link_technosphere_by_activity_hash, - # external_db_name="Agribalyse 3.1.1", - # fields=("name", "unit"), - # ) - # ) database.statistics() print("### Adding unlinked flows and activities...") diff --git a/data/import_agribalyse.py b/data/import_agribalyse.py index f541605b6..c32c73426 100755 --- a/data/import_agribalyse.py +++ b/data/import_agribalyse.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from bw2data.project import projects -from bw2io.strategies.generic import link_iterable_by_fields +from bw2io.strategies.generic import link_technosphere_by_activity_hash from common.import_ import ( add_created_activities, add_missing_substances, @@ -121,9 +121,9 @@ ] GINKO_STRATEGIES = [ functools.partial( - link_iterable_by_fields, - other=bw2data.Database("Agribalyse 3.1.1"), - kind="technosphere", + link_technosphere_by_activity_hash, + external_db_name="Agribalyse 3.1.1", + fields=("name", "unit"), ) ] @@ -160,6 +160,14 @@ def sync_datapackages(): else: print(f"{db} already imported") + # GINKO + if (db := "Ginko") not in bw2data.databases: + import_simapro_csv( + GINKO, db, excluded_strategies=EXCLUDED, other_strategies=GINKO_STRATEGIES + ) + else: + print(f"{db} already imported") + # CTCPA if (db := "CTCPA") not in bw2data.databases: import_simapro_csv(CTCPA, db, excluded_strategies=EXCLUDED)