Open sadamov opened 2 months ago
The html files can easily be >100MB in size, crashing most browsers. We might need to implement some performance/size tricks to prevent this.
Would this also be the case if using panel to create a python application within which the serialisation into the HTML to allow plotly to do the rendering is handle by panel? It might be that they have worked out some smart way of doing this :) I think they don't actually create a static rendering into html, but instead the webpage directly requests the data from the running python application which exposes a webserver. I.e. I am suggesting to not generate static html, but instead create a visualisation application which can be started with for example:
python -m weather_model_graphs.viz --interactive graph_file.pickle
obviously this require writing the graph to some serialised format which we can't currently do, but we could start by pickling the nx.Graph
object. That might be an easy starting point? :)
A note about this challenge: The standard behavior in plotly, and used in the neural-lam script linked, is to set up a web server that serves an interactive plotting application. I do however not know if this just creates a static html somewhere and serves that or it is doing something smarter. I just know that I have never had any issues with opening these interactive plots in a browser, but perhaps that could be the case if you have a very large amount of nodes/edges. You can also save the whole thing to an html file, and those can indeed become very large.
I wonder if this might be useful here: https://hvplot.holoviz.org/
It would be really nice to also actually add the earth (textured) to the 3d plot, rather than just a bunch of grid nodes. Going by this post https://community.plotly.com/t/applying-full-color-image-texture-to-create-an-interactive-earth-globe/60166 it looks fairly simple :smile:
Title: Add 3D Graph Plotting Functionality Using Plotly
Description: We should add functionality to visualize the graph structures in 3D using Plotly. This will help in better understanding the spatial relationships between nodes and edges in our graph-based neural weather prediction models.
Tasks:
Example: https://github.com/mllam/neural-lam/blob/5b71be3c68d815e0e376ee651c14f09d801f86de/plot_graph.py
Challenges: The html files can easily be >100MB in size, crashing most browsers. We might need to implement some performance/size tricks to prevent this.
Surplus: 3D objects could be rendered for Blender, which supports a Python-like DSL as a backend. This would allows us to benefit from all the 3D modeling techniques (e.g. shaders) for even nicer looking graphs.