You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the time being we've implemented this in Ribasim-NL models:
def validate_link_source_destination(self):
"""Check if links exist with reversed source-destination
"""
df = self.link.df
# on tuples we can easily check duplicates irrespective of order
duplicated_links = pd.Series(
list(zip(np.minimum(df["from_node_id"], df["to_node_id"]),
np.maximum(df["from_node_id"], df["to_node_id"]))), index=df.index).duplicated(keep=False)
# if links are duplicated in reversed source-destination we raise an Exception
if duplicated_links.any():
raise ValueError(f"Links found with reversed source-destination: {list(df[duplicated_links].reset_index()[["link_id", "from_node_id", "to_node_id"]].to_dict(orient="index").values())}")
I run this before writing models which gives me a clear Exception before writing to disk. Would be great if this was the default when model.use_validation = True:
Now Julia gives an error, but ideally we know that beforehand.
As mentioned by @DanielTollenaar.
The text was updated successfully, but these errors were encountered: