mllam / weather-model-graphs

Tooling for creating, visualising and storing data-driven weather-model graphs
https://join.slack.com/t/ml-lam/shared_invite/zt-2t112zvm8-Vt6aBvhX7nYa6Kbj_LkCBQ
9 stars 9 forks source link

No mesh nodes returned for odd dimensions #12

Closed khintz closed 2 months ago

khintz commented 6 months ago
import numpy as np
import weather_model_graphs as wmg

# create some fake cartesian coordinates
def _create_fake_xy(N=10):
    x = np.linspace(0.0, 1.0, N)
    y = np.linspace(0.0, 1.0, N)
    xy = np.stack(np.meshgrid(x, y), axis=0)
    return xy

xy_grid = _create_fake_xy(N=11)

graph = wmg.create.archetype.create_keisler_graph(xy_grid=xy_grid)

# remove all edges from the graph
graph.remove_edges_from(list(graph.edges))

ax = wmg.visualise.nx_draw_with_pos_and_attr(graph, node_color_attr="type")

When changing N to an odd number no mesh nodes are returned. I am not sure why, or if there is a deeper meaning with it, but I wouldn't expect it.

leifdenby commented 6 months ago

Thank you!