Comparing directional data is easy from version 1.0 if the quantity is defined as directional. This happens automatically if data is loaded from a dfs file with EUM unit in "degrees" or if loaded from a xarray dataset with attribute "units" set to "degrees". The quantity can also be created as directional manually by ms.Quantity(..., is_directional=True)
.
In the below example, the EUM unit is "degrees".
import modelskill as ms
import mikeio
fn = "../tests/testdata/wave_dir.dfs0"
ds = mikeio.read(fn)
ds
<mikeio.Dataset> dims: (time:9026) time: 2006-12-20 22:00:00 - 2007-12-31 23:00:00 (9026 records) geometry: GeometryUndefined() items: 0: China_Model: Sign. Wave Height <Significant wave height> (meter) 1: China_Measured: Sign. Wave Height <Significant wave height> (meter) 2: China_Model: Mean Wave Direction <Mean Wave Direction> (degree) 3: China_Measured: Mean Wave Direction <Mean Wave Direction> (degree)
cmp = ms.from_matched(ds, obs_item=3, mod_items=[2])
cmp
<Comparer> Quantity: Mean Wave Direction [degree] Observation: China_Measured: Mean Wave Direction, n_points=9026 Model: China_Model: Mean Wave Direction, rmse=71.358
cmp.quantity
Quantity(name='Mean Wave Direction', unit='degree', is_directional=True)
Circular metrics are used to compare directional data if the quantity is defined as directional.
cmp.skill(metrics=["c_rmse","c_max_error"]).round(1)
n | c_rmse | c_max_error | |
---|---|---|---|
observation | |||
China_Measured: Mean Wave Direction | 9026 | 60.7 | 179.9 |
cmp.plot.timeseries();
cmp.plot.kde(); # note: the KDE estimate is not directional! (yet)
cmp.plot.scatter(); # note: regression line and Q-Q are not shown