Conversation
evetion
reviewed
Jun 3, 2024
Member
evetion
left a comment
There was a problem hiding this comment.
LGTM, some nitpicks. This will break the current assumptions in the Delwaq coupling scripts, so maybe not merge just yet?
Member
|
I'll make the changes so the coupling can handle the non-uniqueness. Would be good to also create a new coupling test that takes a horribly non-unique model to convert. edit: Done, back to you @visr (feel free to review my changes) |
visr
commented
Jun 4, 2024
visr
commented
Jun 4, 2024
Jingru923
pushed a commit
that referenced
this pull request
Aug 13, 2024
Fixes #1690 as a 🎁 for @deltamarnix when he is back from holiday. Triggered by #1648, which seems very hard to do in QGIS as it doesn't support compound indexes and we dislike a separate global unique id. In a discussion with @visr he mentioned most people don't use the non-global unique id feature (yet). Reverts #1513. Partially reverts #1690 as the `NodeID` changes are not reverted, as it is quite useful to know the node_type in several parts of the code (instead of only a node_id). Therefore, I've added a new `NodeID` constructor and joined the Edge table with the Node table. I had to change the node_ids of several new test models created by @SouthEndMusic, bit of a pain, but the tests seem to pass still. Furthermore, I changed the `node.add` functionality to *return* the `NodeData`, which should make the `edge.add` more straightforward (and pave the way for automatic id numbering in the future). So this: ```julia model.terminal.add(Node(terminal_id, Point(500, 200))) model.tabulated_rating_curve.add( Node(6, Point(450, 200)), [tabulated_rating_curve.Static(level=[0.0, 1.0], flow_rate=[0.0, 10 / 86400])], ) model.edge.add( model.basin[6], model.tabulated_rating_curve[6], ) model.edge.add( model.tabulated_rating_curve[6], model.terminal[terminal_id], ) ``` becomes this: ```julia term = model.terminal.add(Node(terminal_id, Point(500, 200))) trc0 = model.tabulated_rating_curve.add( Node(0, Point(450, 200)), [tabulated_rating_curve.Static(level=[0.0, 1.0], flow_rate=[0.0, 10 / 86400])], ) model.edge.add( basin6, trc0, ) model.edge.add(trc0, term) ``` I've made this change in a single Python test model, and in the first model of the examples notebook. We could gradually change this further over time. --------- Co-authored-by: Martijn Visser <mgvisser@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1318
Fixes #1256
@evetion I didn't touch the Delwaq
node_lookup. If only Basins are in the graph, then you can still use an ID as a unique index.The #1256 fix in 72dcf24 is not tested, since Ribasim-Python stops us from creating such an invalid model. I manually confirmed it works by duplicating rows in QGIS.
The
mainmethods were needed to fixpixi run ribasim-core.