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.097677 | 0.297203 | 0.280693 | 0.234103 | 0.965766 | 0.096848 | 0.924528 |
HKZA_2 | 397 | -0.084598 | 0.294471 | 0.282057 | 0.224945 | 0.967457 | 0.097318 | 0.925909 |
HKZA_3 | 397 | -0.055265 | 0.267680 | 0.261913 | 0.206410 | 0.971840 | 0.090368 | 0.938777 |
HKNA | 386 | -0.315380 | 0.447311 | 0.317210 | 0.341344 | 0.968323 | 0.102122 | 0.847042 |
HKNA_2 | 386 | -0.263059 | 0.399579 | 0.300771 | 0.299503 | 0.970854 | 0.096830 | 0.877944 |
HKNA_3 | 386 | -0.251149 | 0.393604 | 0.303065 | 0.290698 | 0.970244 | 0.097568 | 0.881567 |
EPL | 66 | -0.077263 | 0.229352 | 0.215947 | 0.194178 | 0.969118 | 0.083134 | 0.929378 |
EPL_2 | 66 | -0.127012 | 0.251000 | 0.216493 | 0.217022 | 0.968078 | 0.083344 | 0.915417 |
EPL_3 | 66 | -0.067380 | 0.227172 | 0.216950 | 0.190187 | 0.968860 | 0.083520 | 0.930714 |
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()