Closed simb-sdu closed 1 year ago
MultiLCA('sarahs-resultater')
gives the following results. Sorry about the unfriendly format, I am no brightway expert (yet).
there are 20 lists (reference flows) each containing the results of the 19 chosen LCIA methods. Seems correct - but why does AB fail at the calculation then?
[[ 9.11624789e-02 -4.47819459e+01 -5.84630993e+01 1.35831534e+01
9.79999660e-02 7.85718003e+01 2.08928353e+02 6.96731181e-03
2.64980783e-02 2.84876449e-01 2.11076907e-08 2.47287527e-07
2.49363226e+00 7.23950017e+03 1.26048039e-04 2.86515371e-07
1.97878173e-06 1.04034179e-01 6.18118482e+00]
[ 5.88139252e-02 -6.13176440e+01 -6.41105010e+01 2.70665460e+00
8.62024604e-02 4.00738963e+01 3.43714710e+01 2.13122047e-03
1.94029315e-02 2.03449442e-01 1.72730155e-08 1.71010826e-07
1.43018687e-02 7.42895473e+03 1.05807455e-04 1.52616474e-07
2.04749213e-06 7.59685095e-02 2.80165807e+00]
[ 6.99498865e-02 -5.32290669e+01 -5.92046485e+01 5.88871076e+00
8.68708467e-02 7.11866372e+01 8.25443018e+01 2.11845328e-03
2.61236417e-02 2.52054025e-01 1.79543950e-08 1.74323552e-07
2.81895912e-01 7.25617262e+03 9.86601378e-05 2.35241811e-07
2.20178478e-06 8.70469490e-02 5.66380289e+00]
[ 6.89141323e-02 -4.96351337e+01 -5.88890398e+01 9.16986009e+00
8.40460990e-02 6.30072079e+01 1.31159505e+02 3.00193465e-03
2.36347722e-02 2.43415629e-01 1.83281799e-08 1.63273117e-07
1.78792382e-01 7.18789256e+03 9.04397128e-05 3.45724163e-07
2.17580994e-06 9.02071257e-02 3.70485968e+00]
[ 7.46230357e-02 -4.82936728e+01 -5.86797636e+01 1.02983088e+01
8.77820349e-02 6.41658079e+01 1.54170696e+02 4.14633419e-03
2.32158036e-02 2.47382431e-01 1.81824505e-08 1.45567872e-07
1.30204642e+00 7.16577995e+03 5.21709301e-05 2.11633090e-07
1.86915184e-06 9.49273704e-02 3.78090592e+00]
[ 6.93209518e-02 -5.25370849e+01 -5.89220921e+01 6.29792484e+00
8.70824174e-02 6.44700753e+01 8.60155793e+01 2.26174200e-03
2.44204248e-02 2.44701716e-01 1.80777403e-08 1.67254432e-07
2.80030774e-01 7.25278702e+03 9.69128466e-05 2.32626521e-07
2.19428804e-06 8.73580786e-02 4.67897445e+00]
[ 7.39132006e-02 -4.95220046e+01 -5.88972273e+01 9.28890745e+00
8.63152140e-02 7.77261705e+01 1.46235297e+02 2.93701165e-03
2.51192635e-02 2.40144893e-01 1.81684289e-08 1.71734965e-07
1.45367292e+00 7.20768251e+03 7.42964578e-05 2.34802943e-07
2.01389328e-06 8.72813990e-02 5.88414642e+00]
[ 6.66745801e-02 -5.15325047e+01 -5.89477812e+01 7.33036163e+00
8.49149188e-02 7.87923894e+01 1.16707358e+02 1.96106114e-03
2.54134960e-02 2.35095856e-01 1.87114189e-08 1.54348938e-07
1.13173731e+00 7.23423754e+03 7.49951119e-05 2.18818214e-07
1.95285696e-06 8.24004939e-02 6.55493483e+00]
[ 7.03100784e-02 -5.24709445e+01 -5.88962250e+01 6.33946852e+00
8.58120117e-02 7.12811834e+01 8.84647041e+01 2.21764845e-03
2.60123716e-02 2.50651846e-01 1.94780290e-08 1.76922720e-07
2.46954881e-01 7.25133833e+03 9.58249287e-05 2.47546722e-07
2.20097858e-06 8.74622878e-02 5.47938119e+00]
[ 7.09036196e-02 -4.85995528e+01 -5.88964032e+01 1.02116250e+01
8.52253344e-02 6.82457304e+01 1.59132588e+02 3.11616366e-03
2.21134934e-02 2.26638022e-01 1.84477641e-08 1.64617371e-07
1.26556078e+00 7.16154423e+03 7.07461116e-05 2.64060345e-07
1.98443659e-06 8.79581860e-02 3.96010676e+00]
[ 6.67903049e-02 -5.06078721e+01 -5.88579623e+01 8.16392778e+00
8.61624200e-02 7.38536528e+01 1.32191840e+02 2.21545943e-03
2.34829039e-02 2.28341247e-01 1.83009696e-08 1.58480454e-07
1.36091424e+00 7.19811377e+03 7.44172251e-05 2.29446519e-07
2.00008178e-06 8.47766013e-02 5.36024616e+00]
[ 6.64631390e-02 -5.46839333e+01 -5.90584710e+01 4.28835190e+00
8.61857679e-02 6.84692211e+01 5.50886818e+01 2.13745088e-03
2.57168555e-02 2.34663293e-01 1.93659960e-08 1.90108370e-07
1.32371439e-02 7.38139649e+03 1.02727421e-04 2.07265961e-07
2.08394841e-06 7.86837534e-02 6.45495968e+00]
[ 6.46624141e-02 -5.10385022e+01 -5.88705948e+01 7.74626906e+00
8.58235810e-02 7.15863106e+01 1.26572409e+02 2.08166876e-03
2.24996405e-02 2.21712772e-01 1.87136394e-08 1.57919465e-07
1.32094193e+00 7.19022791e+03 7.42417899e-05 2.16796505e-07
1.98462373e-06 8.38821726e-02 4.89128443e+00]
[ 5.96572538e-02 -5.43727974e+01 -5.90383857e+01 4.57784149e+00
8.77467627e-02 4.84540041e+01 5.90830996e+01 2.10918888e-03
1.93086219e-02 2.04931234e-01 1.69479157e-08 1.59941453e-07
9.25677158e-03 7.30856487e+03 9.75183897e-05 1.88221285e-07
2.03385760e-06 7.88495920e-02 3.03497335e+00]
[ 6.07175701e-02 -5.41867194e+01 -5.98883081e+01 5.61843017e+00
8.31584499e-02 5.98240464e+01 7.75407253e+01 1.87591841e-03
2.03858281e-02 2.08908143e-01 1.88285550e-08 1.51756214e-07
1.50278278e-01 7.21699757e+03 9.47592097e-05 2.15425351e-07
1.97931620e-06 7.90445342e-02 3.57771032e+00]
[ 6.93774966e-02 -4.93323106e+01 -5.88592048e+01 9.44104554e+00
8.58486741e-02 6.54024517e+01 1.48614733e+02 2.89133127e-03
2.09581983e-02 2.20174477e-01 1.86190121e-08 1.62806666e-07
1.35597141e+00 7.15340799e+03 7.15564950e-05 2.26135630e-07
1.97563304e-06 8.72170415e-02 3.44713822e+00]
[ 5.76753309e-02 -6.20006770e+01 -6.47098614e+01 2.62544845e+00
8.37360011e-02 3.72622424e+01 3.35204756e+01 1.95053548e-03
1.88613607e-02 2.01772648e-01 1.95964847e-08 1.55702318e-07
3.20474640e-02 7.41652284e+03 1.03813486e-04 1.47519441e-07
2.01230768e-06 7.50707044e-02 2.42736619e+00]
[ 6.88543280e-02 -6.04832893e+01 -6.37942914e+01 3.22620538e+00
8.47966575e-02 7.15384703e+01 3.83544017e+01 2.15112749e-03
2.82811296e-02 2.46353340e-01 1.97707242e-08 2.06932975e-07
1.19682606e-02 7.50571687e+03 1.08798115e-04 1.91767158e-07
2.11451267e-06 7.69828878e-02 7.71304867e+00]
[ 6.99067146e-02 -5.38002298e+01 -5.96797105e+01 5.79506926e+00
8.44114113e-02 7.41434395e+01 8.08852718e+01 2.07350622e-03
2.65351575e-02 2.51868398e-01 1.86336770e-08 1.84291923e-07
1.98106488e-01 7.25289789e+03 9.83895904e-05 2.35716471e-07
2.19656987e-06 8.63556710e-02 5.72603855e+00]
[ 5.99226918e-02 -5.36963820e+01 -5.89622019e+01 5.18196842e+00
8.38515275e-02 5.11963964e+01 6.78482752e+01 2.12313876e-03
1.92682197e-02 2.05100021e-01 1.81989746e-08 1.60506571e-07
1.17425402e-02 7.26207176e+03 9.60764366e-05 1.97936736e-07
2.03351400e-06 7.98950995e-02 2.63173745e+00]]
when I manually create the calculation setup in AB, it works. When i print the calculation_setups
in brightway commandline, I see that the manually-created in AB calculation setup has these codes, whereas the the scriptgeenrated one does not
manually created calcualtion setup in AB:
from brightway2 import *
>>>
>>> projects.set_current("sarah-ei391")
>>> calculation_setups['manual']
{'inv': [{('Cut-off_DK_BAU', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_cutoff391', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP1-Base_2030', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP1-Base_2050', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP1-Base_2100', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP1-PkBudg1150_2030', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP1-PkBudg1150_2050', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP1-PkBudg1150_2100', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP2-Base_2030', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP2-Base_2050', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP2-Base_2100', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP2-PkBudg1150_2030', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP2-PkBudg1150_2050', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP2-PkBudg1150_2100', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP5-Base_2030', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP5-Base_2050', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP5-Base_2100', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP5-PkBudg1150_2030', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP5-PkBudg1150_2050', 'd136f236199d923254deafd8526a78d5'): 1.0}, {('Cut-off_DK_BAU_ecoinvent_cutoff_3.9_remind_SSP5-PkBudg1150_2100', 'd136f236199d923254deafd8526a78d5'): 1.0}], 'ia': [('EF v3.1 EN15804', 'acidification', 'accumulated exceedance (AE)'), ('EF v3.1 EN15804', 'climate change', 'global warming potential (GWP100)'), ('EF v3.1 EN15804', 'climate change: biogenic', 'global warming potential (GWP100)'), ('EF v3.1 EN15804', 'climate change: fossil', 'global warming potential (GWP100)'), ('EF v3.1 EN15804', 'climate change: land use and land use change', 'global warming potential (GWP100)'), ('EF v3.1 EN15804', 'ecotoxicity: freshwater', 'comparative toxic unit for ecosystems (CTUe)'), ('EF v3.1 EN15804', 'energy resources: non-renewable', 'abiotic depletion potential (ADP): fossil fuels'), ('EF v3.1 EN15804', 'eutrophication: freshwater', 'fraction of nutrients reaching freshwater end compartment (P)'), ('EF v3.1 EN15804', 'eutrophication: marine', 'fraction of nutrients reaching marine end compartment (N)'), ('EF v3.1 EN15804', 'eutrophication: terrestrial', 'accumulated exceedance (AE)'), ('EF v3.1 EN15804', 'human toxicity: carcinogenic', 'comparative toxic unit for human (CTUh)'), ('EF v3.1 EN15804', 'human toxicity: non-carcinogenic', 'comparative toxic unit for human (CTUh)'), ('EF v3.1 EN15804', 'ionising radiation: human health', 'human exposure efficiency relative to u235'), ('EF v3.1 EN15804', 'land use', 'soil quality index'), ('EF v3.1 EN15804', 'material resources: metals/minerals', 'abiotic depletion potential (ADP): elements (ultimate reserves)'), ('EF v3.1 EN15804', 'ozone depletion', 'ozone depletion potential (ODP)'), ('EF v3.1 EN15804', 'particulate matter formation', 'impact on human health'), ('EF v3.1 EN15804', 'photochemical oxidant formation: human health', 'tropospheric ozone concentration increase'), ('EF v3.1 EN15804', 'water use', 'user deprivation potential (deprivation-weighted water consumption)')]}
>>>
script-generated caluclation setup
>>> from brightway2 import *
>>>
>>> projects.set_current("sarah-ei391")
>>> calculation_setups['sarahs resultater']
{'inv': [{'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}, {'Beam assembly' (unit, DK, None): 1}], 'ia': [('EF v3.1 EN15804', 'acidification', 'accumulated exceedance (AE)'), ('EF v3.1 EN15804', 'climate change', 'global warming potential (GWP100)'), ('EF v3.1 EN15804', 'climate change: biogenic', 'global warming potential (GWP100)'), ('EF v3.1 EN15804', 'climate change: fossil', 'global warming potential (GWP100)'), ('EF v3.1 EN15804', 'climate change: land use and land use change', 'global warming potential (GWP100)'), ('EF v3.1 EN15804', 'ecotoxicity: freshwater', 'comparative toxic unit for ecosystems (CTUe)'), ('EF v3.1 EN15804', 'energy resources: non-renewable', 'abiotic depletion potential (ADP): fossil fuels'), ('EF v3.1 EN15804', 'eutrophication: freshwater', 'fraction of nutrients reaching freshwater end compartment (P)'), ('EF v3.1 EN15804', 'eutrophication: marine', 'fraction of nutrients reaching marine end compartment (N)'), ('EF v3.1 EN15804', 'eutrophication: terrestrial', 'accumulated exceedance (AE)'), ('EF v3.1 EN15804', 'human toxicity: carcinogenic', 'comparative toxic unit for human (CTUh)'), ('EF v3.1 EN15804', 'human toxicity: non-carcinogenic', 'comparative toxic unit for human (CTUh)'), ('EF v3.1 EN15804', 'ionising radiation: human health', 'human exposure efficiency relative to u235'), ('EF v3.1 EN15804', 'land use', 'soil quality index'), ('EF v3.1 EN15804', 'material resources: metals/minerals', 'abiotic depletion potential (ADP): elements (ultimate reserves)'), ('EF v3.1 EN15804', 'ozone depletion', 'ozone depletion potential (ODP)'), ('EF v3.1 EN15804', 'particulate matter formation', 'impact on human health'), ('EF v3.1 EN15804', 'photochemical oxidant formation: human health', 'tropospheric ozone concentration increase'), ('EF v3.1 EN15804', 'water use', 'user deprivation potential (deprivation-weighted water consumption)')]}
>>>
script that gives errors in AB but works in BW functional_units.append({Database("mydatabase").search("beam")[0]:1})
OK guys, I found the root of the problem. I was appending to the functional_units
list with the Database.search()
function and taking [0] as the first element in the search results. This works perfectly fine in brightway. there are some differences in the data of the calculation setup, see my comment above.
functional_units
list with Database.search()[0].key
. TLDR add a .key
and it works. see below
script that works with both AB and BW functional_units.append({Database("mydatabase").search("beam")[0].key:1})
I made a script go generate a calculation setup with ref flows from various databases
I can get results for the calculation setup via command-line brightway with
MultiLCA()
The calculation setup shows up in activity browser, and looks correct. However It cannot calculate, and gives the following error: