Deltares / xugrid

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

Allow edge_face_connectivity as an initialization argument for Ugrid2d? #251

Open Huite opened 1 week ago

Huite commented 1 week ago

250 adds the edge_node_connectivity to the from_meshkernel constructor. Meshkernel also provides an edge_face_connectivity now: https://github.com/Deltares/MeshKernelPy/issues/82

There's no way to use it right now, since Ugrid2d.__init__ takes no edge_face / face_edge argument. However, a relevant question is also whether it's necessary, since xugrid will derive these optional connectivities itself. As an overview (something like this should probably go in some form of developer docs...):

E.g. the following edge_face_connectivities are equivalent:

0 1
1 2
2 3

versus

1 0
1 2
3 2

The UGRID conventions do not specify the row order (you could let the normal point to the first face, and the antinormal to the second face or something, but this isn't part of the spec and doesn't seem very useful either).

So, it should be easy to check:

If my reasoning is correct, they should be identical (after sorting within a row). In that case, we don't have to complicate the constructor and internal logic any further, and rely on xugrid to provide the edge_face_connectivity as needed.