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

don't calculate all results when in optimization tab #436

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions app/tab_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,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
Loading