LCA-ActivityBrowser / activity-browser

GUI for brightway2
GNU Lesser General Public License v3.0
142 stars 54 forks source link

How to import an LCI database with both foreground and background activities? #154

Closed xiaoshir closed 6 years ago

xiaoshir commented 6 years ago

I have a database in Brightway, in which I have some foreground activities linked with background activities. Does anyone know how I can import such database? I don't see it as one of the three options under "Import an LCI database":

haasad commented 6 years ago

The Activity Browser uses the same databases as brightway, ie you should be able to access all the databases you created in brightway from the AB without any need to import them again. Aren't your brightway projects and databases accessible from the right panel?

xiaoshir commented 6 years ago

Ok, I just installed it but haven't been able to successfully run the application yet. Below is the error I got, do you know why?

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\zhang_x\AppData\Local\Continuum\Miniconda3\Scripts>activate Battery

(Battery) C:\Users\zhang_x\AppData\Local\Continuum\Miniconda3\Scripts>activity-b
rowser
Traceback (most recent call last):
  File "C:\Users\zhang_x\AppData\Local\Continuum\Miniconda3\envs\Battery\Scripts
\activity-browser-script.py", line 4, in <module>
    from activity_browser.app import run_activity_browser
  File "C:\Users\zhang_x\AppData\Local\Continuum\Miniconda3\envs\Battery\lib\sit
e-packages\activity_browser\__init__.py", line 6, in <module>
    from .app import Application, run_activity_browser
  File "C:\Users\zhang_x\AppData\Local\Continuum\Miniconda3\envs\Battery\lib\sit
e-packages\activity_browser\app\__init__.py", line 7, in <module>
    from .application import Application
  File "C:\Users\zhang_x\AppData\Local\Continuum\Miniconda3\envs\Battery\lib\sit
e-packages\activity_browser\app\application.py", line 2, in <module>
    from .controller import Controller
  File "C:\Users\zhang_x\AppData\Local\Continuum\Miniconda3\envs\Battery\lib\sit
e-packages\activity_browser\app\controller.py", line 8, in <module>
    from bw2data.project import ProjectDataset, SubstitutableDatabase
ImportError: cannot import name 'SubstitutableDatabase'
haasad commented 6 years ago

can you try and run this command in your environment and see if it fixes the problem:

conda update --all

In case this doesn't fix it, please copy-paste the output of conda list here and I'll try to figure out what the problem is.

xiaoshir commented 6 years ago

It worked:) Thanks, and you are right that I don't have to import the database existing in Brightway. Now I have another two new questions:

  1. How do I define the system boundary of Sankey diagram for the LCIA result of a foreground activity? It looks like it shows only the breakdown by "the first layer" of foreground activity, but I would like to go two more layers further up (i.e. flow from background to foreground, flow from background to background), how can I do that?
  2. After getting 1. work, how can I have access to the values behind the Sankey diagram in tabular form?
haasad commented 6 years ago
  1. You should be able to click on the activity in the sankey tool for which you want more details and it will expand
  2. This is currently not possible. You could however try to do the same calculations in brightway. The sankey tool uses the brightway GraphTraversal object:
    network = bw.GraphTraversal().calculate({activity: 1}, method)

    where activity and method are used like with the bw.LCA-object. This will return the nodes and edges of the network which you'd need to further process if you want it in tabular format.

xiaoshir commented 6 years ago

Hi, 1 worked by clicking the activity I want to expand. I absolutely love it! Would be even nicer to have some sort of short text on top of the window to prompt such function. Similarly for being able to drag processes /methods to calculation setup. It took me a while to figure them out. Thank you for answering my series of questions:)

haasad commented 6 years ago

I totally agree that not all of these functionalities are obvious from the start. Eventually there will have to be some kind of tutorial video and some documentation to explain these things. You're one of the "early adopters" and therefore have to figure out more of these things for yourself :smile:

haasad commented 6 years ago

I opened #158 to keep track of your inputs about the functionalities that are unclear for beginners. Please don't hesitate to open a new issue if you have further questions.