brightway-lca / brightway2-io

Importing and exporting for the Brightway LCA framework
BSD 3-Clause "New" or "Revised" License
26 stars 40 forks source link

Importing in BW processes written in SP #250

Closed GiuliaCavenago93 closed 6 months ago

GiuliaCavenago93 commented 7 months ago

Dear Brightway community, I am currently investigating the feasibility of importing processes created in SimaPro directly into Brightway. While I have successfully managed to achieve this by manually creating Excel files containing the necessary information required by Brightway (e.g., name, reference product, location), I am curious to explore if there exists an automated method for this task.

Specifically, I am wondering if there is a function or tool within Brightway that facilitates the direct import of processes written in SP and exported in Ecospold v1 format. Despite attempting to follow the same procedure employed for importing the ecoinvent database, I have encountered difficulties in replicating the process.

I would appreciate any guidance or assistance someone could provide in this, I guess you might have encounter the same problems.

Thank you very much!

tngTUDOR commented 6 months ago

Hi, If you can export a csv file from SP, you could use the SimaProCSVImporter (example not guaranteed to work exactly as written, only for illustration purposes). Of course, you might need to do some manual adjustements to the sp.data if there are some items you cannot "match" from the SP export to your project's / other background dbs.

import bw2io as bi
sp_importer = bi.SimaProCSVImporter(
    "exported_file.csv", "project70", delimiter=";"
)
sp.apply_strategies()
sp.statistics()
# If there are no unlinked datasets, then you can proceed with:
sp.write_database()
tngTUDOR commented 6 months ago

@GiuliaCavenago93 , since this was more a question than a "bug"/issue to fix in the code, I'm going to close the issue. I think you can also ask this kind of questions in the groups.io mailing list of bw:

https://brightway.groups.io/g/development/messages

and of course, take a look at the documentation :

https://docs.brightway.dev/en/latest/