Skip to content

Commit

Permalink
Merge pull request #436 from agoenergy/joAschauer/434-dont-calculate-…
Browse files Browse the repository at this point in the history
…all-results-when-in-optimization-tab

don't calculate all results when in optimization tab
  • Loading branch information
markushal authored Jun 10, 2024
2 parents cde0fbf + 0493854 commit d2f3457
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
35 changes: 18 additions & 17 deletions app/tab_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ def content_optimization(api: PtxboaAPI) -> None:
with st.popover("*Help*", use_container_width=True):
st.markdown(read_markdown_file("md/whatisthis_optimization.md"))

# load netcdf file:
try:
n, metadata = api.get_flh_opt_network(
scenario=st.session_state["scenario"],
secproc_co2=st.session_state["secproc_co2"],
secproc_water=st.session_state["secproc_water"],
chain=st.session_state["chain"],
res_gen=st.session_state["res_gen"],
region=st.session_state["region"],
country=st.session_state["country"],
transport=st.session_state["transport"],
ship_own_fuel=st.session_state["ship_own_fuel"],
user_data=st.session_state["user_changes_df"],
)
except FileNotFoundError:
st.error("No optimization model could be loaded")
return
with st.spinner("Please wait. Running optimization model..."):
# load netcdf file:
try:
n, metadata = api.get_flh_opt_network(
scenario=st.session_state["scenario"],
secproc_co2=st.session_state["secproc_co2"],
secproc_water=st.session_state["secproc_water"],
chain=st.session_state["chain"],
res_gen=st.session_state["res_gen"],
region=st.session_state["region"],
country=st.session_state["country"],
transport=st.session_state["transport"],
ship_own_fuel=st.session_state["ship_own_fuel"],
user_data=st.session_state["user_changes_df"],
)
except FileNotFoundError:
st.error("No optimization model could be loaded")
return

if metadata["model_status"] == ["ok", "optimal"]:

Expand Down
1 change: 0 additions & 1 deletion ptxboa_streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
"Market scanning",
"Input data",
"Deep-dive countries",
"Optimization",
]:
with st.spinner("Please wait. Running optimization model..."):
# calculate results over different data dimensions:
Expand Down

0 comments on commit d2f3457

Please sign in to comment.