Skip to content

Commit

Permalink
Tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
ecomodeller committed Jan 10, 2025
1 parent 6cbcfde commit ce2f8b5
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
with open(fn_obs, "wb") as f:
f.write(obs.getvalue())

dfs = mikeio.open(fn_obs)
dfs: mikeio.Dfs0 = mikeio.open(fn_obs) # type: ignore
items = [item.name for item in dfs.items]
obs_item = st.selectbox(label="Item", options=items)

Expand All @@ -29,9 +29,9 @@
fn_mod = os.path.join(tmp_folder, "mod.dfs0")
with open(fn_mod, "wb") as f:
f.write(mod.getvalue())
dfs = mikeio.open(fn_mod)
items = [item.name for item in dfs.items]
mod_item = st.selectbox(label="Item", options=items)
mdfs: mikeio.Dfs0 = mikeio.open(fn_mod) # type: ignore
mitems = [item.name for item in mdfs.items]
mod_item = st.selectbox(label="Item", options=mitems)

metrics = st.multiselect(
"Metrics",
Expand All @@ -40,15 +40,22 @@
)

if mod and obs:
c = modelskill.match(fn_obs, fn_mod, obs_item=obs_item, mod_item=mod_item)
c: modelskill.Comparer = modelskill.match(
fn_obs, fn_mod, obs_item=obs_item, mod_item=mod_item
) # type: ignore

tabskill, tabts, tabscatter = st.tabs(["Skill", "Time series", "Scatter"])

df = c.skill(metrics=metrics).to_dataframe()
st.dataframe(df)
with tabskill:
df = c.skill(metrics=metrics).to_dataframe()
st.dataframe(df)

c.plot.timeseries()
fig = matplotlib.pyplot.gcf()
st.pyplot(fig)
with tabts:
c.plot.timeseries()
fig = matplotlib.pyplot.gcf()
st.pyplot(fig)

c.plot.scatter()
fig_sc = matplotlib.pyplot.gcf()
st.pyplot(fig_sc)
with tabscatter:
c.plot.scatter()
fig_sc = matplotlib.pyplot.gcf()
st.pyplot(fig_sc)

0 comments on commit ce2f8b5

Please sign in to comment.