Open pymusa-09 opened 1 month ago
Can you please add:
bw2data
and bw2io
you have?.zolca
file instead of the official source?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
Any idea how to solve this issue?
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