goodness_of_fit
goodness_of_fit
How well the simulated values of a model run fit the measurements of its Observation nodes.
observed_and_simulated pairs the measured values of each Observation node with the simulated values of the node it observes, and compare summarizes how well they fit. ribasim_nl.result_validation checks the fit of a run of the coupled LHM model, and ribasim_nl.webmap exports it for the model viewer.
Classes
| Name | Description |
|---|---|
| ObservedSeries | The measured values of a variable of an Observation node, and the simulated values of the node it observes. |
ObservedSeries
goodness_of_fit.ObservedSeries(
node_id,
name,
variable,
observed_node_id,
observed,
simulated,
)The measured values of a variable of an Observation node, and the simulated values of the node it observes.
Functions
| Name | Description |
|---|---|
| compare | Goodness of fit of a simulated to an observed time series, on the times at which both have a value. |
| compare_observations | Compare each Observation node with the simulated values of the node it observes, see compare. |
| observed_and_simulated | The measured and simulated values of each observed variable of each Observation node, by node ID and variable. |
| read_table | Read columns of a table of a Ribasim database, which is empty if the table does not exist. |
compare
goodness_of_fit.compare(observed, simulated)Goodness of fit of a simulated to an observed time series, on the times at which both have a value.
The Nash-Sutcliffe (NSE) and Kling-Gupta efficiencies (KGE) are NaN if there are fewer than MIN_COMPARED_DAYS values, or if the observations are constant. The bias is relative to the mean absolute observation.
compare_observations
goodness_of_fit.compare_observations(database, results_dir)Compare each Observation node with the simulated values of the node it observes, see compare.
Returns
| Name | Type | Description |
|---|---|---|
| pd.DataFrame | a table by the node ID of the Observation, with its name, the observed node and the result of compare |
observed_and_simulated
goodness_of_fit.observed_and_simulated(database, results_dir)The measured and simulated values of each observed variable of each Observation node, by node ID and variable.
Like in the model viewer, the simulated flow rate of a node is its total outflow, which for a Junction is the flow through it, and other variables are those of an observed Basin. Observation nodes without a link to the node they observe are left out.
read_table
goodness_of_fit.read_table(con, table, columns)Read columns of a table of a Ribasim database, which is empty if the table does not exist.