Sometimes all your need is a simple comparison of two time series. The modelskill.match()
method does just that.
import mikeio
import modelskill as ms
Can be either a dfs0 or a DataFrame.
fn_mod = '../tests/testdata/SW/ts_storm_4.dfs0'
df_mod = mikeio.read(fn_mod, items=0).to_dataframe() # select 1 item
Can be either a dfs0, a DataFrame or a PointObservation object.
fn_obs = '../tests/testdata/SW/eur_Hm0.dfs0'
The match() method will return an object that can be used for scatter plots, skill assessment, time series plots etc.
If the observation or model has more than 1 item, the obs_item
or mod_item
can be given to specify the relevant item.
cmp = ms.match(fn_obs, df_mod) # both with 1 item only
cmp.plot.timeseries();
cmp.skill()
n | bias | rmse | urmse | mae | cc | si | r2 | |
---|---|---|---|---|---|---|---|---|
observation | ||||||||
eur_Hm0 | 67 | 0.052239 | 0.22824 | 0.222181 | 0.174851 | 0.968321 | 0.085898 | 0.929767 |
cmp.plot.scatter();
By default the regression line is fitted based on all the data.
In order to fit do a weighted regression based on the quantiles, use the fit_to_quantiles
option.
cmp.plot.scatter(fit_to_quantiles=True);
An example including the background data and skill table using the show_points
use the skill_table
options:
ms.settings.load_style(name='MOOD')
cmp.plot.scatter(fit_to_quantiles=True, show_points=True, skill_table=True);
cmp.plot.taylor(normalize_std=True)