activity-browser icon indicating copy to clipboard operation
activity-browser copied to clipboard

[bug] Scenario-based LCA crashes for parameters for biosphere flows

Open VanessaR0 opened this issue 5 years ago • 3 comments

Hi Everyone,

at the moment I am working with the activity browser and as a database I am using a self-created one. I would like to create a scenario-based LCA, which changes quantities of biosphere flows. For this purpose, I added database parameters and exported them to excel. The scenario import to the activity browser did work as well. I already performed scenarios without changing the biosphere flows, until then the scenario calculation did work. But when I start the scenario analysis for the biosphere flows , miniconda displays the following error:

Superstructure: Could not find required headers in given document sheet.
Attempting to read as parameter scenario file.
TypeError: int() argument must be a string, a bytes-like object or a number, not 'Key'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "C:\Users\admin\miniconda3\envs\ab_dev\lib\site-packages\activity_browser\app\ui\tabs\LCA_results_tab.py", line 60, in generate_setup
    new_tab = LCAResultsSubTab(cs_name, presamples, self)
  File "C:\Users\admin\miniconda3\envs\ab_dev\lib\site-packages\activity_browser\app\ui\tabs\LCA_results_tabs.py", line 101, in __init__
    self.do_calculations()
  File "C:\Users\admin\miniconda3\envs\ab_dev\lib\site-packages\activity_browser\app\ui\tabs\LCA_results_tabs.py", line 141, in do_calculations
    self.mlca = SuperstructureMLCA(self.cs_name, self.presamples)
  File "C:\Users\admin\miniconda3\envs\ab_dev\lib\site-packages\activity_browser\app\bwutils\superstructure\mlca.py", line 40, in __init__    self.indices_to_matrix()
  File "C:\Users\admin\miniconda3\envs\ab_dev\lib\site-packages\activity_browser\app\bwutils\superstructure\mlca.py", line 88, in indices_to_matrix
    self.matrix_indices[i] = convert(index)
ValueError: setting an array element with a sequence

Is the adaption of biosphere flows with parameters possible in the activity browser?

Many thanks in advance. Kind regards,

Vanessa

VanessaR0 avatar Dec 02 '20 07:12 VanessaR0

I also tried, what Vanessa described and got the same error. In my case, additionally the pop-up "LCA failed" was displayed after pressing the "Calculate" button.

CHarpprecht avatar Dec 02 '20 10:12 CHarpprecht

It should definitely be possible, I remember this exception occurring when the exchange could not be found in the matrix. I'll go over the code again to check if I missed something when converting data.

dgdekoning avatar Dec 02 '20 22:12 dgdekoning

I came across this issue again, which still persists, if the biosphere flow is an emission which I created myself (so not from the default biosphere3 database). I now get this error message grafik

If the biosphere flow is from biosphere3 database it works perfectly fine.

CHarpprecht avatar Aug 06 '21 14:08 CHarpprecht

Closing this as resolved in #1025

marc-vdm avatar Sep 14 '23 14:09 marc-vdm