Skip to content
Draft
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
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ test = [
"geopandas",
]

app = ["streamlit>=1.41.1"]

notebooks = ["nbformat", "nbconvert", "jupyter", "plotly", "shapely", "seaborn"]

[project.urls]
Expand Down
Binary file added tests/testdata/SW/eur_Hm0_F3_wind.dfs0
Binary file not shown.
15 changes: 15 additions & 0 deletions web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FMSkill web application

## Installation

```
$pip install streamlit
```

Usage:
```
$streamlit run web/app.py
```

![](screenshot.png)

55 changes: 55 additions & 0 deletions web/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import tempfile
from pathlib import Path
import streamlit as st
import mikeio
import modelskill
import matplotlib.pyplot as plt

"""
# ModelSkill Drag and Drop
"""

tmp = Path(tempfile.mkdtemp())

with st.sidebar:
obs = st.file_uploader("Observation", type="dfs0")

if obs:
fn_obs = tmp / "obs.dfs0"
fn_obs.write_bytes(obs.getvalue())

dfs = mikeio.open(fn_obs)
obs_item = st.selectbox("Item", options=[i.name for i in dfs.items])

mod = st.file_uploader("Model", type="dfs0")

if mod:
fn_mod = tmp / "mod.dfs0"
fn_mod.write_bytes(mod.getvalue())
mdfs = mikeio.open(fn_mod)
mod_item = st.selectbox("Item", options=[i.name for i in mdfs.items])

metrics = st.multiselect(
"Metrics",
["bias", "rmse", "mae", "cc", "r2", "si", "kge", "mape", "urmse"],
default=["bias", "rmse", "r2"],
)

if mod and obs:
c = modelskill.match(
fn_obs, fn_mod, obs_item=obs_item, mod_item=mod_item, gtype="point"
)

tskill, tts, tsc = st.tabs(["Skill", "Time series", "Scatter"])

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

with tts:
c.plot.timeseries()
st.pyplot(plt.gcf())

with tsc:
c.plot.scatter()
st.pyplot(plt.gcf())
Binary file added web/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.