-
Notifications
You must be signed in to change notification settings - Fork 5
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
A QGIS Ribasim plotting window #790
Comments
Something that came up today: there's many cases where you probably want to look at more than one state, but which should not be plotted in the same plotting window, such as basin levels / storages and edge flows. An easy solution is to allow the spawning of separate plotting windows. This allows us to spawn two plotting widgets, one for the levels and one for the flows. |
As @deltamarnix mentioned in #342 (comment), we looked a bit at https://github.com/ghtmtt/DataPlotly. It looks like it can already do many of the things listed above. Some are still a bit cumbersome, but perhaps we can work around that or contribute upstream. This is plotting a The workaround is to do a manual Feature subset on the first node_id, create plot, change the feature subset, create plot. This will show them both with separate labels. For showing results, the iMOD plugin picks up metadata on the Node and Edge layers on where to find the Arrow files. These are then loaded with pandas by the plugin. To show results with DataPlotly you have to load the Arrow into an attribute table as far as I know. This could lead to performance issues, so perhaps we can find a way to avoid that. Also the related tables feature won't help us, so we cannot select features on the map. Perhaps it is possible to write some code for this and use the DataPlotly API (beta): https://dataplotly-docs.readthedocs.io/en/latest/from_console.html. Here is an example of results from flow.arrow where I had to set the feature subset myself: The interactive features of Plotly make it quite useful to inspect the data. |
This looks quite promising indeed! Using from the console suggests that you might be able to use the plugin as a library, which makes sense but I haven't seen it with any other QGIS plugin. The interactivity is a nice advantage over (default) pyqtgraph. Performance should be good maybe even better too, since I'm guessing it's serving the plotting pane in a Qt HTML window, and Claude tells me Qt uses Chromium V8. |
#788 got my noggin' joggin'.
All the Ribasim input is essentially in long table form. This should make it relatively easy to support a general plotting window to help with inspecting model input.
Essentially:
Performance might be a bit of an issue. Pandas is available, and arrow data can be read efficiently (although it will load all data into memory). Data from the geopackage can be ingested via the PyQGIS API, which would result a list of dicts.
Although if we can get QGIS installed via pixi, we would be able to use pyarrow and pyogrio instead.
The text was updated successfully, but these errors were encountered: