#!/usr/bin/env python # coding: utf-8 # # Combine comparers # ModelSkill comparers can be combined by using the "+" operator. You may want to add a new ModelResult to your existing comparison or a new observation or a new time period: # # cc = cc1 + cc2 # In[1]: import modelskill as ms # ## Observations # In[2]: 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") o3 = ms.TrackObservation("../tests/testdata/SW/Alti_c2_Dutch.dfs0", item=3, name="c2") # ## Model Results # In[3]: fn = "../tests/testdata/SW/CMEMS_DutchCoast_*.nc" mr1 = ms.model_result(fn, name='CMEMS', item='VHM0') mr1 # In[4]: mr2 = ms.model_result('../tests/testdata/SW/HKZN_local_2017_DutchCoast.dfsu', name='MIKE21SW', item=0) # ## Connect and extract # Notice that the two ModelResults doesn't cover the exact same period. # In[5]: ms.plotting.temporal_coverage(obs=[o1,o2,o3], mod=[mr1,mr2], limit_to_model_period=False) # In[6]: cc1 = ms.match(obs=[o1,o2,o3], mod=mr1)#, name='SW') cc2 = ms.match(obs=[o1,o2,o3], mod=mr2)# , name='SW') # In[7]: cc1.skill() # In[8]: cc2.skill() # ## Add the two Comparers # In[9]: cc = cc1 + cc2 # In[10]: cc.skill()