Repository navigation
[DOCS] Delft3D-FM instructions #2992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
8710307
37ea319
8b59f3e
84e4636
fcea588
67515cf
1214db3
da7e3b1
7df584a
bf489f2
b11c280
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While reviewing I found that the raw Delft3D-FM tutorial file (delft3d-fm-raw.nc) has inconsistent UGRID metadata, which is why uxarray can't open it directly. Perhaps worth adding a note? (we need to triangular anyway, so opening directly with uxarray isn't an option) The following was drafted with LLM assistance. import pooch
import uxarray as ux
path = pooch.retrieve(
"https://github.com/Parcels-code/parcels-data/raw/main/data/Delft3D_data/delft3d-fm-raw.nc",
known_hash=None,
)
ux.open_dataset(path, path)
# ValueError: cannot rename 'mesh2d_edge_faces' because it is not a variable or dimension in this datasetThe attributes on the Mesh topology variable don't match the file's contents:
It looks like the variables and dimensions were renamed on export (the history attribute mentions FEWS), but the mesh metadata wasn't updated. If I patch the attributes, uxarray reads the grid without problems: import xarray as xr
ds = xr.open_dataset(path)
attrs = ds["Mesh"].attrs
attrs.pop("edge_face_connectivity")
attrs.update(
node_dimension="nMesh_node",
face_dimension="nMesh_face",
edge_dimension="nMesh_edge",
max_face_nodes_dimension="nMaxMesh_face_nodes",
)
grid = ux.Grid.from_dataset(ds) # 7271 faces, 7259 nodes, n_max_face_nodes=4
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the file to be xgrid-compliant in Parcels-code/parcels-data#15 |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite accurate. Delft 3D FM can also support higher order polygons (see chapter 2 intro at https://content.oss.deltares.nl/delft3d/D-Flow_FM_User_Manual.pdf , or 23.1 on topological conventions "Such a grid cell should contain at least three and at most six corner nodes, representing triangles, quadrangles, pentagons and hexagons, respectively").
The code would have holes in the mesh in the case of these higher order polygons.
I've made an update in 1214db3 accordingly, and to also use fan triangulation.
Add "or if your output data is all node-registered" (?)