Deltares / xugrid

Xarray and unstructured grids
https://deltares.github.io/xugrid/
MIT License
53 stars 8 forks source link

ugrid2d's "equals()" function ignores differences in face_node connectivity #213

Closed luitjansl closed 5 months ago

luitjansl commented 5 months ago

consider a test like the following:

def test_equals_connectivity_mismatch():
    grid = grid2d()
    grid_copy = grid2d()
    # perturbate 
    copy_dataset = grid_copy.to_dataset()
    copy_dataset["mesh2d_face_nodes"].values[2,1] += 1
    copy_dataset["mesh2d_face_nodes"].values[3,1] -= 1
    grid_copy = type(grid).from_dataset(copy_dataset)
    assert not grid.equals(grid_copy)

in this test we create 2 equal grids, and then we change the face_node connectivity of the second grid. Now they should not be equal anymore, but grid.equals() still returns true.

Huite commented 5 months ago

Hi @luitjansl

See also: https://github.com/Deltares/xugrid/issues/205

This should be fixed by Joeri's commits. There's no neat PR due some accidental pushing to main. a140d3144c483e3e4d8292f12fd03dea435b3814

Can you check with current main?

luitjansl commented 5 months ago

closed, the issue cannot be reproduced after updating eveything.