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

Issue with running Monte Carlo after importing new parameters and triangular uncertainty ranges from BW #1294

Open
Ronja-Oerbeck opened this issue May 30, 2024 · 1 comment

Comments

@Ronja-Oerbeck
Copy link

Issue

Hi,
I have an issue with some parameters I have created in BW through Jupyter Notebook and then imported to AB. I have 4 scenarios and with my current project I can get AB to calculate the results, so I think the default parameter values are working fine after import. However, I get an error when trying to run Monte Carlo simulation, so my guidance counsellor Heather Logan suggested I posted the issue here.
I have defined my parameters as shown below in Jupyter Notebook:

1

This gets imported to AB. I then manually changed the uncertainty type of the parameters which are 0 as default, min and max from Triangular uncertainty to No uncertainty to avoid an Improper bound error I was getting.

2

The error when running Monte Carlo is shown below. I hope you can help me debug it😊

Reset project settings directory to:C:\Users\ronja\AppData\Local\pylca\Brightway3\BSc-Jupyter-2.774ac4c710d246aec82ed363481e637a
-hiding tab:LCA results
Reset metadata.
Loaded project:BSc Jupyter 2
Loading Scenario file. This may take a while for large files
Superstructure: Attempting to read as parameter scenario file.
<function ScenarioImportWidget.scenario_db_check at 0x00000227A4BA8EA0> -- 0.0010039806365966797
<function SuperstructureManager.fill_empty_process_keys_in_exchanges at 0x00000227A4578180> -- 0.0025649070739746094
<function SuperstructureManager.verify_scenario_process_keys at 0x00000227A45782C0> -- 0.02978038787841797
<function SuperstructureManager.check_duplicates at 0x00000227A4578540> -- 0.005026817321777344
<function SuperstructureManager.check_scenario_exchange_values at 0x00000227A4578400> -- 0.003981351852416992
<function SuperstructureManager.merge_flows_to_self at 0x00000227A455FE20> -- 0.012993574142456055
<function ScenarioImportWidget.sync_superstructure at 0x00000227A4BA8D60> -- 0.06897521018981934
<function ScenarioImportWidget.load_action at 0x00000227A4BA8C20> -- 6.8225109577178955
Current shape and databases in the MetaDataStore:(0, 0)set()
Adding:Detergent
Adding:ecoinvent 3.9.1_cutoff_ecoSpold02
Adding:biosphere3
Adding:Main activities
C:\Users\ronja\anaconda3\envs\ab\Lib\site-packages\seaborn\matrix.py:202: RuntimeWarning: All-NaN slice encountered
vmin = np.nanmin(calc_data)
C:\Users\ronja\anaconda3\envs\ab\Lib\site-packages\seaborn\matrix.py:207: RuntimeWarning: All-NaN slice encountered
vmax = np.nanmax(calc_data)
+showing tab:LCA results
Monte Carlo LCA: finished 30 iterations for 7 reference flows and 28 methods in 100.92 seconds.
Traceback (most recent call last):
File "C:\Users\ronja\anaconda3\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 1249, in calculate_mc_lca
self.update_mc()
File "C:\Users\ronja\anaconda3\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 1333, in update_mc
self.df = self.parent.mc.get_results_dataframe(method=method)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ronja\anaconda3\envs\ab\Lib\site-packages\activity_browser\bwutils\montecarlo.py", line 273, in get_results_dataframe
raise ValueError('You need to perform a Monte Carlo Simulation first.')
ValueError: You need to perform a Monte Carlo Simulation first.

@mrvisscher
Copy link
Collaborator

Hi @Ronja-Oerbeck,

Thanks for reaching out! Your post made me think about the parameter-scenario and montecarlo interaction in the activity browser. And I'm not sure it's even possible to run a montecarlo on a scenario LCA given the way we've implemented them.

I realize that the option is there anyways, but I can't get it to work myself (No error message like you have though). Do you get any results if you don't run it as a scenario LCA?

Kind regards,

Marin

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

2 participants