observations
observations
Add Observation nodes with measured discharges to a model.
The measurement series and the model links they are compared with are taken from the koppeltabel that is also used by ribasim_nl.analyse_results. Each series gets an Observation node at the measurement location, with the measured values. If the series is measured on a single link, the Observation node observes the flow_rate of the connector node of that link. If it adds and subtracts the flows of multiple links, it observes a Junction with that flow, the net flow of the nodes beyond its link towards its Basin, see ribasim_nl.flow_paths.Routes.flow_rate_links. These nodes are found by their water authority and key, see read_coupling, and Junctions by their type and location. Other Observation nodes are not linked, as a reminder; meta_koppeling says why.
Series are linked before the Basin trees of a model are merged, see ribasim_nl.flow_paths.merge_basin_trees, which keeps the observed Junctions, and the others again after, see link_observations, as a merged tree can combine the inflows and outflows of a Basin. If no Junction combines exactly the nodes of a series, nodes that are close together then get one, see ribasim_nl.flow_paths.combine_nodes.
Classes
| Name | Description |
|---|---|
| LinkEnd | The node to observe of a koppeltabel link, and the type of the node on the other end. |
LinkEnd
observations.LinkEnd()The node to observe of a koppeltabel link, and the type of the node on the other end.
Functions
| Name | Description |
|---|---|
| add_observation_nodes | Add Observation nodes for the series in coupling, see read_coupling and read_measurements. |
| add_observations | Add an Observation node with the measured discharge for each series of an authority. |
| link_observations | Link the Observation nodes that are not linked yet, for instance in a model coupled from other models. |
| read_coupling | The series of an authority, with the nodes to observe of their links. |
| read_measurements | Daily measured discharges [m3/s] per measurement file, with a time index and a column per series. |
add_observation_nodes
observations.add_observation_nodes(
model,
coupling,
measurements,
tolerance=1.0,
own=None,
)Add Observation nodes for the series in coupling, see read_coupling and read_measurements.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model | Model | Ribasim model | required |
| coupling | gpd.GeoDataFrame | series with the node to observe | required |
| measurements | dict[str, pd.DataFrame] | measured discharges | required |
| tolerance | float | maximum distance between a Junction to observe in coupling and in the model |
1.0 |
| own | str | None | the water authority of a model of one water authority, see _match_key |
None |
Returns
| Name | Type | Description |
|---|---|---|
| Model | updated Ribasim model |
add_observations
observations.add_observations(model, authority)Add an Observation node with the measured discharge for each series of an authority.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model | Model | Ribasim model | required |
| authority | str | water authority as named in the koppeltabel | required |
Returns
| Name | Type | Description |
|---|---|---|
| Model | updated Ribasim model |
link_observations
observations.link_observations(
model,
authority=None,
tolerance=1.0,
moved_tolerance=50.0,
combine=False,
)Link the Observation nodes that are not linked yet, for instance in a model coupled from other models.
Series can be measured on links between models, of which only the coupled model has all nodes, or combine inflows and outflows of a Basin, which only a merged Basin tree can, see ribasim_nl.flow_paths.merge_basin_trees. If the observed flow rate has the opposite sign, so do the measured values.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model | Model | Ribasim model | required |
| authority | str | None | water authority of the Observation nodes as named in the koppeltabel, and of the model, or else the meta_waterbeheerder of each node, in a model of several water authorities | None |
| tolerance | float | maximum distance between a Junction to observe in the koppeltabel and in the model | 1.0 |
| moved_tolerance | float | maximum distance to a node that was moved to separate it from other nodes, see _match |
50.0 |
| combine | bool | give the nodes of a series that no Junction combines such a Junction, see _combine, once the Basin trees of the model are merged, as merging them removes Junctions that are not observed yet |
False |
Returns
| Name | Type | Description |
|---|---|---|
| Model | updated Ribasim model |
read_coupling
observations.read_coupling(authority)The series of an authority, with the nodes to observe of their links.
The koppeltabel names the node at each end of a link by its type and location, and the node to observe by its water authority and key in the column new_node_keys, except for Junctions, whose keys follow from the routes.
Returns
| Name | Type | Description |
|---|---|---|
| gpd.GeoDataFrame | a table with columns MeetreeksC, Aan/Af, negate (whether the measurement has the opposite sign of the flow_rate), ends (the LinkEnd per link, or None if the series does not add the flows of the links or a link has no node to observe), signs (per link the sign of its flow in the series), koppeling (why ends is None) and geometry of the measurement location |
read_measurements
observations.read_measurements()Daily measured discharges [m3/s] per measurement file, with a time index and a column per series.