import modelskill as ms
Model skill visualisation#
fn = 'data/SW/HKZN_local_2017_DutchCoast.dfsu'
mr = ms.model_result(fn, name='HKZN_local', item=0)
obs = [ms.PointObservation('data/SW/HKZA_Hm0.dfs0', item=0, x=3.9, y=52.7, name="HKZA"),
ms.PointObservation('data/SW/HKZA_Hm0.dfs0', item=0, x=3.8, y=52.5, name="HKZA_2"),
ms.PointObservation('data/SW/HKZA_Hm0.dfs0', item=0, x=3.5, y=52.6, name="HKZA_3"),
ms.PointObservation('data/SW/HKNA_Hm0.dfs0', item=0, x=4.2420, y=52.6887, name="HKNA"),
ms.PointObservation('data/SW/HKNA_Hm0.dfs0', item=0, x=4.2, y=52.6, name="HKNA_2"),
ms.PointObservation('data/SW/HKNA_Hm0.dfs0', item=0, x=4.3, y=52.7, name="HKNA_3"),
ms.PointObservation("data/SW/eur_Hm0.dfs0", item=0, x=3.2760, y=51.9990, name="EPL"),
ms.PointObservation("data/SW/eur_Hm0.dfs0", item=0, x=3.2, y=51.9, name="EPL_2"),
ms.PointObservation("data/SW/eur_Hm0.dfs0", item=0, x=3.3, y=51.95, name="EPL_3")
]
cc = ms.match(obs=obs, mod=mr)
cc
<ComparerCollection>
Comparers:
0: HKZA - Significant wave height [m]
1: HKZA_2 - Significant wave height [m]
2: HKZA_3 - Significant wave height [m]
3: HKNA - Significant wave height [m]
4: HKNA_2 - Significant wave height [m]
5: HKNA_3 - Significant wave height [m]
6: EPL - Significant wave height [m]
7: EPL_2 - Significant wave height [m]
8: EPL_3 - Significant wave height [m]
Data analysis#
cc.skill()
| n | bias | rmse | urmse | mae | cc | si | r2 | |
|---|---|---|---|---|---|---|---|---|
| observation | ||||||||
| HKZA | 397 | 0.052742 | 0.287870 | 0.282997 | 0.224974 | 0.965311 | 0.097643 | 0.929193 |
| HKZA_2 | 397 | -0.056992 | 0.281897 | 0.276075 | 0.216178 | 0.968424 | 0.095254 | 0.932101 |
| HKZA_3 | 397 | -0.046658 | 0.267980 | 0.263886 | 0.207180 | 0.971200 | 0.091049 | 0.938640 |
| HKNA | 386 | -0.202413 | 0.355195 | 0.291877 | 0.255866 | 0.971708 | 0.093967 | 0.903554 |
| HKNA_2 | 386 | -0.263090 | 0.403130 | 0.305446 | 0.300016 | 0.970160 | 0.098335 | 0.875765 |
| HKNA_3 | 386 | -0.221611 | 0.367311 | 0.292926 | 0.267783 | 0.971869 | 0.094304 | 0.896862 |
| EPL | 66 | -0.070746 | 0.226261 | 0.214916 | 0.190754 | 0.969425 | 0.082737 | 0.931269 |
| EPL_2 | 66 | -0.155260 | 0.266044 | 0.216041 | 0.229844 | 0.968181 | 0.083170 | 0.904974 |
| EPL_3 | 66 | -0.071587 | 0.226266 | 0.214643 | 0.191164 | 0.969477 | 0.082632 | 0.931266 |
s = cc.skill()
type(s)
modelskill.skill.SkillTable
s.rmse.plot.bar();
s['urmse'].plot.line();
Custom plot#
All skill statistics are available in a dataframe, and in case you need a tailor-made plot, you can get data and use matplotlib to get exactly what you need.
import matplotlib.pyplot as plt
df = s.to_dataframe().sort_values('bias')
x = df.bias
y = df.index
plt.subplots(figsize=(6,6))
plt.scatter(x,y,marker='D',c='red',s=100)
plt.xlim(-0.35,0.35)
plt.axvline(0,linestyle='--')
plt.xlabel("Bias (m)")
plt.title(mr.name)
plt.grid()