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

WrongDatabase: Activity database must be ecoinvent_3_8, but set() was also found #261

Open
pymusa-09 opened this issue May 27, 2024 · 4 comments

Comments

@pymusa-09
Copy link

I have ecoinvent_38_cutoff_3011_with_methods.zolca, which I can open in OpenLCA without any issues. My code integrates Brightway2 and therefore I exported all the processes and impact methods to EcoSpold and successfully exported all the data. The data files are XML format.

Now when I am trying to create a database..for example;

import brightway2 as bw
import bw2io
from bw2io import strategies

Set the current project

bw.projects.set_current('ecoinvent_38_import')

Ensure biosphere database is set up

if 'biosphere3' not in bw.databases:
bw.bw2setup()

Path to the extracted ecoinvent files

ecoinvent_path = r'D:/LCAmodel/EcoSpold01'

Verify if the path exists and is a directory

import os
if not os.path.isdir(ecoinvent_path):
raise ValueError(f"dirpath value was not a directory: {ecoinvent_path}")

Initialize the importer

importer = bw2io.SingleOutputEcospold2Importer(ecoinvent_path, 'ecoinvent_3_8')

Apply strategies

importer.apply_strategies()

Check statistics

print("Initial import statistics:", importer.statistics())

Apply additional linking strategies

strategies.link_biosphere_by_flow_uuid(importer)
strategies.link_internal_technosphere_by_composite_code(importer)

Check statistics again

print("Post-linking import statistics:", importer.statistics())

expected_db_name = 'ecoinvent_3_8'
if importer.db_name != expected_db_name:
raise ValueError(f"Database name mismatch: expected {expected_db_name}, found {importer.db_name}")

Write the database

importer.write_database()

Debug unlinked exchanges if they exist

unlinked = importer.unlinked
if unlinked:
print("Unlinked exchanges found:", unlinked)

The database is not created and it says;
0 datasets
0 exchanges
0 unlinked exchanges

Initial import statistics: (0, 0, 0)
0 datasets
0 exchanges
0 unlinked exchanges

Post-linking import statistics: (0, 0, 0)
Traceback (most recent call last):WrongDatabase: Activity database must be ecoinvent_3_8, but set() was also found

Please guide me on where is the issue coming from. Thank you in advance

@cmutel
Copy link
Member

cmutel commented May 27, 2024

Can you please add:

  • Which version of bw2data and bw2io you have?
  • Why are you trying to import ecoinvent from the .zolca file instead of the official source?

@pymusa-09
Copy link
Author

bw2data 3.6.6
bw2io 0.8.12
I have ecoinvent databases from my university in .zolca format. That is why I am converted to ecospold from openLCA...Can you please guide me accordingly. Thank you
1
2ecospold

@pymusa-09
Copy link
Author

Any idea how to solve this issue?

@pymusa-09
Copy link
Author

dataset
dataset2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants