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

Creation of the unit process database to be aggregated #1

Open
moritzos opened this issue Jun 17, 2024 · 6 comments
Open

Creation of the unit process database to be aggregated #1

moritzos opened this issue Jun 17, 2024 · 6 comments

Comments

@moritzos
Copy link

I would like to use Brightway2-aggregated (bw2-agg) to generate aggregated (cradle-to-gate) LCIA scores for production activities according to the CML method. These aggregated LCIA scores shall be used for further LCA calculations, among others using ecoinvent 3.9.1, premise and the Activity Browser.
My issue concerns the creation of the unit process database as basis for the DatabaseAggregator. As I understand the bw2agg documentation, I need to set up a database with the unit processes (in my case the production activities) and its aggregated LCIA scores. For this purpose I created a excel sheet (see atteched screenshot), which I want to import in Brightway2 using the ExcelImporter. The excel sheet contains the output of the production activity (exchange type: production) as well as its LCIA impact scores (exchange type: biosphere) as exchanges.
To create a bw2 database including this activity, I need to link the biosphere exchanges to a database. Otherwise I cannot use the .write_database() function to create the bw2 database, as I have unlinked biosphere flows.
So my question is, how to link the impact scores (so the biosphere flows) to database, and to which database so that

  • I have no unlinked biosphere flows,
  • can use the .write_database() to set up the unit process database in bw2,
  • and can use the DatabaseAggregator

In general, I use the biosphere database of ecoinvent 3.9.1. in this project, but of course it does not contain the LCIA impact score biosphere exchanges.

excelsheet_screenshot
@moritzos
Copy link
Author

@PascalLesage or @cmutel do have an advice for me?

@cmutel
Copy link

cmutel commented Jun 18, 2024

I guess Pascal is not paying attention to Github mentions much anymore 😄

I think the point of bw2agg is to generate these new biosphere flows (representing LCIA scores) for you directly, so you don't need to worry about them yourself. In the end, it isn't that tough to loop over the processes in a database, store their scores, and then assign those scores to a new biosphere flow. So you should just import your unit process data as normal, the new elementary flows come later.

When rewriting bw2agg for 2.5 (see https://github.com/brightway-lca/bw_aggregation), I made it possible to have one database which can use both aggregated or normal unit process inventories depending on flags passed at runtime. I plan to extend this to use LCIA scores instead of "system" processes soon. BTW, this is for 2.5, but we also have the Activity-Browser running on 2.5 (https://github.com/cauldron/activity-browser/tree/brightway25), and expect to have an official release soon.

@moritzos
Copy link
Author

Many thanks for the quick reply and the note on bw2.5, @cmutel.
The problem is that I only have information about the LCIA scores for the unit processes. Unfortunately, I do not have any data on technosphere and/or biosphere flows that I could link to the ecoinvent database. As I understand it (but please correct me), I therefore cannot import the unit process data "as normal" and have to generate the LCIA scores myself as biosphere flows in the excel sheet. However, I don't know how I can link the biosphere flows (which represent the LCIA scores) to a database via the "databases" column in the excel sheet so that all flows are linked and I can generate the bw2 database (with .write_database() function). Is it an option to extend the existing biosphere database from ecoinvent in the project with the biosphere flows from the excel sheet? If so, how can I do this?

@romainsacchi
Copy link

Hi, @moritzos, I am not familiar with this library, but I think it was designed to go from a disaggregated database/datasets to a bunch of aggregated ones. You're trying to import an aggregate dataset (only containing LCIA flows as "inputs") and this might be problematic since these flows do not exist in the biosphere database.

Maybe, what you can do is aggregate a random dataset in the database to LCIA scores and add the resulting LCIA "flows" to the biosphere database as described here: https://brightway2-aggregated.readthedocs.io/en/latest/tech_ref.html#adding-unit-impacts-exchanges-to-biosphere-and-unit-impact-characterization-factors-to-methods

This way, the LCIA "flows" will exist in the biosphere database, and you should then be able to import your aggregated datasets containing LCIA flows. Does that make sense?

@moritzos
Copy link
Author

Hi @romainsacchi,
Thanks a lot for your feedback and the good idea, which I think is logical and should work. I have tested it and the Excel import as well as the aggregation of a random non-aggregated dataset to LCIA scores works. The LCIA "flows" are added to the biosphere database as "unit impacts" and the characterization factors are added to the LCIA methods as described in the link you provided (see screenshot).
grafik

However, when I try to import an aggregated dataset containing LCIA results (as biosphere exchanges with unit impact scores) in the next step, I get the message that the biosphere exchanges are not linked. So I cannot create a database with the aggregated LCIA results. The Excel spreadsheet and code for the Excel import is shown here:
grafik

grafik

Do you (or anyone else) have an idea why the biosphere exchanges are not linked and how this can be solved?

@moritzos
Copy link
Author

moritzos commented Sep 2, 2024

I could solve it by additionally linking it to the biosphere database.
grafik

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

3 participants