I feel like the test test_create_decode_mask should be more specific. Currently, it verifies that the total number of edges decreases when applying a decode mask. However, checking the m2g (decoding) edges alone should be sufficient.
I don't think the test can fail in the current version. However, I encountered issues on the research branch where the decode_mask also affects the g2m behavior, which can increase the total number of edges in the graph. This made me realize that it would be more future-proof to make the test more specific.
|
unfiltered_graph = fn(coords=xy, mesh_node_distance=mesh_node_distance) |
|
|
|
# Filter to only 20 / 100 grid nodes |
|
decode_mask = np.concatenate((np.ones(20), np.zeros(80))).astype(bool) |
|
filtered_graph = fn( |
|
coords=xy, mesh_node_distance=mesh_node_distance, decode_mask=decode_mask |
|
) |
|
|
|
# Check that some filtering has been performed |
|
assert len(filtered_graph.edges) < len(unfiltered_graph.edges) |
I feel like the test
test_create_decode_maskshould be more specific. Currently, it verifies that the total number of edges decreases when applying a decode mask. However, checking them2g(decoding) edges alone should be sufficient.I don't think the test can fail in the current version. However, I encountered issues on the research branch where the
decode_maskalso affects theg2mbehavior, which can increase the total number of edges in the graph. This made me realize that it would be more future-proof to make the test more specific.weather-model-graphs/tests/test_graph_creation.py
Lines 209 to 218 in ea2415f