Validate MIKE 21 Spectral wave model for the Dutch coast.
import modelskill as ms
Traceback (most recent call last): File ~/.local/lib/python3.11/site-packages/IPython/core/interactiveshell.py:3433 in run_code exec(code_obj, self.user_global_ns, self.user_ns) Cell In[2], line 1 import modelskill as ms File ~/src/modelskill/modelskill/__init__.py:56 return ComparerCollection.load(fn) ^ IndentationError: unindent does not match any outer indentation level
from matplotlib_inline.backend_inline import set_matplotlib_formats
set_matplotlib_formats('png')
fn = '../tests/testdata/SW/HKZN_local_2017_DutchCoast.dfsu'
mr = ms.ModelResult(fn, name='HKZN_local', item=0)
mr.data
o1 = ms.PointObservation('../tests/testdata/SW/HKNA_Hm0.dfs0', item=0, x=4.2420, y=52.6887, name="HKNA")
o2 = ms.PointObservation("../tests/testdata/SW/eur_Hm0.dfs0", item=0, x=3.2760, y=51.9990, name="EPL")
o1.plot.hist();
o1.plot();
o3 = ms.TrackObservation("../tests/testdata/SW/Alti_c2_Dutch.dfs0", item=3, name="c2")
o3.data.head()
ms.plotting.spatial_overview([o1, o2, o3], mr);
ms.plotting.temporal_coverage([o1, o2, o3], mr);
ms.plotting.temporal_coverage([o1, o2, o3], mr, limit_to_model_period=False);
cc = ms.compare([o1, o2, o3], mr)
Extracting model results¶ can be a time-consuming process. Therefore, it is recommended to save the results to a file. This can be done using the save method of the comparison object.
Each comparer can be saved as a NetCDF file, and a ComparerCollection
can be saved as a zip file, preferably with the extension .msk
.
cc.save("SW_DutchCoast.msk")
cc2 = ms.load("SW_DutchCoast.msk")
cc2
cc.skill().style()
cc.save
cc["c2"].skill(metrics="mean_absolute_error")
cc["HKNA"].plot.timeseries(figsize=(10,5));
cc["HKNA"].plot.timeseries(width=1000, backend="plotly")
cc["EPL"].plot.scatter(figsize=(8,8), show_hist=True);
cc["EPL"].plot.scatter(show_hist=True, backend='plotly', width=600, height=600); #,xlim=[-1,11])
cc["c2"].hist(bins=20);
cc["HKNA"].plot.scatter(bins=0.25, cmap="viridis");