Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node ID numbering changes mean imod-qgis timeseries plot doesn't fetch the right data #1306

Closed
Huite opened this issue Mar 22, 2024 · 6 comments

Comments

@Huite
Copy link
Contributor

Huite commented Mar 22, 2024

Previously, the node feature ID was equal to the node_id. This meant that we could directly use the feature id to locate timeseries in the result dataframes.

Because node_id is no identical to the feature ID, the timeseries plot will either not find the results (because the FID doesn't exists as a node_id), or it will show the wrong timeseries.

It only goes well if your model node_id matches the feature ID as before.

@visr
Copy link
Member

visr commented Mar 25, 2024

Do you see this going wrong?

I thought the code was already adopted for this:

def __set_node_results(self) -> None:
node_layer = self.ribasim_widget.node_layer
assert node_layer is not None
self.__set_results(node_layer, "node_id", "basin.arrow")
def __set_edge_results(self) -> None:
edge_layer = self.ribasim_widget.edge_layer
assert edge_layer is not None
self.__set_results(edge_layer, "edge_id", "flow.arrow")

@Huite
Copy link
Contributor Author

Huite commented Mar 25, 2024

I think you're referring to something else.

I mean these lines, essentially:

https://github.com/Deltares/imod-qgis/blob/e5f128c55ccf911289b8189d8bbf3411efa71569/imodqgis/timeseries/timeseries_widget.py#L569

https://github.com/Deltares/imod-qgis/blob/e5f128c55ccf911289b8189d8bbf3411efa71569/imodqgis/timeseries/timeseries_widget.py#L557

I don't think the keys match the feature IDs. I.e. we're creating a mapping of node_id => dataframe. Then we're searching for feature id's, which aren't node ID's.

The reason I mention this is because I was getting weird selections.

@visr
Copy link
Member

visr commented Mar 25, 2024

Ok right, so in imod-qgis there are the implicit assumptions that node_id == fid for basin.arrow and edge_id == fid for flow.arrow. The latter is currently correct, though see #1310. The former is incorrect.

@visr visr added the bug label Mar 25, 2024
@Huite
Copy link
Contributor Author

Huite commented Mar 25, 2024

Indeed.

I think the unfortunate thing is it required imod-qgis changes, and a new release of the plugin for people to use it.

@visr visr moved this from To do to Sprint backlog in Ribasim Mar 25, 2024
@visr
Copy link
Member

visr commented Mar 25, 2024

Yeah it's quite bad. How about #1316 as a temporary fix?

Hofer-Julian pushed a commit that referenced this issue Mar 26, 2024
The idea was that the Node table `fid` would not be used anymore, but
#1306 showed that is unfortunately not yet the case. So this changes the
`fid` after it is initially written to be equal to the `node_id`. Any
users should still not rely on the `fid`, because this is only
temporary.

This is like #1311 but now also catching non unique node IDs on
`model.write`.
It also provides a temporary fix to #1306. It's not great, but I feel
that especially #1306 is bad enough to warrant a quick fix. This
would've been a bit cleaner to implement using #1312 to avoid having to
read and re-write the Node table, but that PR still has issues we don't
understand, so best not to wait on that.


![image](https://github.com/Deltares/Ribasim/assets/4471859/3efc2f8c-6be5-459d-929a-7ce8568fca3d)
@Huite
Copy link
Contributor Author

Huite commented Mar 26, 2024

Fixed by this: Deltares/imod-qgis#79

Jingru923 pushed a commit that referenced this issue Mar 26, 2024
I think #1306 is important
enough to warrant a quick release.
@visr visr closed this as completed Mar 26, 2024
@github-project-automation github-project-automation bot moved this from Sprint backlog to ✅ Done in Ribasim Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants