LCA-ActivityBrowser / activity-browser

GUI for brightway2
GNU Lesser General Public License v3.0
134 stars 50 forks source link

Regionalized CFs in Activity browser #864

Open Wara-Fatima opened 1 year ago

Wara-Fatima commented 1 year ago

Is there any way to edit the CFs in activity browser?

MaximeAgez commented 1 year ago

As far as I know the CFs cannot be edited directly in AB. You need to create a new LCIA methods and import it through brightway2. If you don't find out to do it (though I believe it is documented somewhere within brightway2) I have some code myself to create a new method that I can point you to.

Wara-Fatima commented 1 year ago

Thanks Maxime, I found an excel file (attached) in the activity browser folder where all the impact methods are listed...But I donot know how is activity browser making use of this data. because I tried to edit the factors there but it is not displayed in activity browser interface.

It would be great if you guide me with the code :) LCIA_Implementation_3.8.xlsx

Zoophobus commented 1 year ago

Dear Fatima,

I would still recommend the approach of Maxime. However, if you have changed the values in the LCIA_Implementation_3.8.xlsx file then you could invoke brightway2.create_default_lcia_methods(overwrite=True), this will read the previous file (given that you haven't changed it's location) and import it into the environment. I would be a bit cautious with this approach though as it does seem like a good way to create new errors.

Hopefully soon, with a newer version of the AB, you will be able to create a copy of the CF and then you should be able to manipulate the copies, so you never have to touch the defaults. This would be another safe approach for this!

MaximeAgez commented 1 year ago

Here you can find a code that creates the Impact World+ impact assessment method in brightway2: https://github.com/CIRAIG/IWP_Reborn/blob/master/parse_iw.py

Look at the .export_to_bw2() method, it should give you an idea of how it works in brightway2.