Skip to content

Commit

Permalink
restore ginko being in a separate db
Browse files Browse the repository at this point in the history
  • Loading branch information
ccomb committed Mar 6, 2024
1 parent 69c1880 commit 9621526
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
9 changes: 0 additions & 9 deletions data/common/import_.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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...")
Expand Down
16 changes: 12 additions & 4 deletions data/import_agribalyse.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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"),
)
]

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9621526

Please sign in to comment.