Motivation
When configuring Local Area Models (LAM) and tuning parameters like mesh_node_distance, it is easy to accidentally create spatial configurations where certain grid nodes become completely disconnected (0-degree nodes). It is highly beneficial to visualize these "graph holes" early in the data pipeline.
I built a standalone diagnostic tool to map these boundaries (original Gist here: https://gist.github.com/ArnabTechiee/7fc757f79379709943300d879af3baec), and following a discussion on Slack with @joeloskarsson and @leifdenby, I would like to integrate this directly into weather-model-graphs.
Current Standalone Output

Proposed Implementation in WMG
Currently, my standalone script uses a mock generator and raw matplotlib. To integrate this cleanly into the WMG architecture, I propose adapting the logic to utilize WMG's native networkx data structures and existing visualization modules.
Here is the proposed integration plan:
- New Utility Function: Add a new function (e.g.,
plot_isolated_nodes(graph, ax=None)) inside src/weather_model_graphs/visualise/plot_2d.py.
- Identify Isolates: Instead of my custom distance thresholds, leverage the backend by using
networkx.isolates(graph) to find all nodes with a degree of 0.
- Attribute Tagging: Iterate through the graph and tag the nodes with a new string attribute (e.g.,
graph.nodes[node]["Connection Status"] = "Isolated" vs "Connected").
- Native Rendering: Pass the tagged graph directly into WMG's existing
nx_draw_with_pos_and_attr function. This avoids redundant matplotlib code and ensures the diagnostic plot perfectly matches WMG's native aesthetic, colorbars, and discrete legends.
- Exposure: Expose this function in
visualise/__init__.py so downstream users (or CLI arguments in neural-lam) can easily call wmg.visualise.plot_isolated_nodes(graph).
Does this architectural approach look good to you both? If so, I’d be happy to open a draft PR for this!
Motivation
When configuring Local Area Models (LAM) and tuning parameters like
mesh_node_distance, it is easy to accidentally create spatial configurations where certain grid nodes become completely disconnected (0-degree nodes). It is highly beneficial to visualize these "graph holes" early in the data pipeline.I built a standalone diagnostic tool to map these boundaries (original Gist here: https://gist.github.com/ArnabTechiee/7fc757f79379709943300d879af3baec), and following a discussion on Slack with @joeloskarsson and @leifdenby, I would like to integrate this directly into
weather-model-graphs.Current Standalone Output
Proposed Implementation in WMG
Currently, my standalone script uses a mock generator and raw
matplotlib. To integrate this cleanly into the WMG architecture, I propose adapting the logic to utilize WMG's nativenetworkxdata structures and existing visualization modules.Here is the proposed integration plan:
plot_isolated_nodes(graph, ax=None)) insidesrc/weather_model_graphs/visualise/plot_2d.py.networkx.isolates(graph)to find all nodes with a degree of 0.graph.nodes[node]["Connection Status"] = "Isolated"vs"Connected").nx_draw_with_pos_and_attrfunction. This avoids redundantmatplotlibcode and ensures the diagnostic plot perfectly matches WMG's native aesthetic, colorbars, and discrete legends.visualise/__init__.pyso downstream users (or CLI arguments inneural-lam) can easily callwmg.visualise.plot_isolated_nodes(graph).Does this architectural approach look good to you both? If so, I’d be happy to open a draft PR for this!