import modelskill as ms
cmp = ms.match("../data/obs.dfs0", "../data/model.dfs0",
="obs_WL", mod_item="WL",
obs_item='point') gtype
Overview
ModelSkill compares model results with observations. The workflow can be split in two phases:
- Matching - making sure that observations and model results are in the same space and time
- Analysis - plots and statistics of the matched data
If the observations and model results are already matched (i.e. are stored in the same data source), the from_matched()
function can be used to go directly to the analysis phase. If not, the match()
function can be used to match the observations and model results in space and time.
Matching
If the observations and model results are not in the same data source (e.g. dfs0 file), they will need to be defined and then matched in space and time with the match()
function. In simple cases, observations and model results can be defined directly in the match()
function:
But in most cases, the observations and model results will need to be defined separately first.
Define observations
The observations can be defined as either a PointObservation
or a TrackObservation
(a moving point).
= ms.PointObservation("../data/obs.dfs0", item="obs_WL",x=366844.15, y=6154291.6) o1
The item
needs to be specified as either the item number or the item name if the input file contains multiple items. Several other parameters can be specified, such as the name of the observation, the x- and y-position, and the quantity type and unit of the observation.
Define model results
A model result will either be a simple point/track like the observations, or spatial field (e.g. 2d dfsu file) from which the model results will be extracted at the observation positions. The following types are available:
PointModelResult
- a point result from a dfs0/nc file or a DataFrameTrackModelResult
- a track result from a dfs0/nc file or a DataFrameGridModelResult
- a spatial field from a dfs2/nc file or a Xarray DatasetDfsuModelResult
- a spatial field from a dfsu file
= ms.PointModelResult("../data/model.dfs0", item="WL") mr1
Match observations and model results
The match()
function will interpolate the model results to the time (and space) of the observations and return a collection of Comparer
objects that can be used for analysis.
= ms.match(o1, mr1)
cc cc
<Comparer>
Quantity: Water Level [m]
Observation: obs, n_points=167
Model(s):
0: model
Analysis
Once the observations and model results are matched, the Comparer
object can be used for analysis and plotting.