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.
With the add API the full Node table is never created in memory, but the rows are available per node type. Users that need just the network need a way to compute the table when needed.
Marking this as a draft because I'm stuck. The new function works fine, but I tried re-enabling the round trip test, and found that the read from #1243 creates empty node tables for each node type due to the way it filters. I wanted to fix that by setting
node.df = None
if the filtered Node table was empty (if the node type doesn't occur).But that triggers behavior I do not understand.
The
setattr
in theadd
method triggers this, so if you pass no tables likebasin.State
,model.basin.node
contains both rows. I rewrote the if/else inadd
a bit but no real changes, the logic there seems ok. We just seem to trigger something pydantic that I find hard to debug, so any help welcome.This is all triggered by my change to
filter
, so perhaps if there are better ways to fix that, by e.g. pruning empty node types at the end of model reading or something like that, I'm also happy.