Skip to content

Commit

Permalink
Correct from_meshkernel_mesh2d_to_ugrid_mesh2d function
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacarniato committed Aug 23, 2023
1 parent 9af3f82 commit 3725873
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions docs/examples/06_working_with_meshkernel_triangular_mesh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Writing meshkernel meshes to ugrid file\n",
"# Writing an unstructured meshkernel meshes to ugrid file\n",
"\n",
"This is a basic introduction for writing meshkernel meshes to file.\n",
"\n",
Expand Down Expand Up @@ -215,7 +215,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -245,6 +245,13 @@
" \"Conventions\": \"CF-1.6 UGRID-1.0/Deltares-0.8\"}\n",
" ug.attribute_global_define(conventions)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
5 changes: 3 additions & 2 deletions ugrid/ugrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,11 @@ def fill_int_face_array(face_array):
result[current_index : current_index + num_face_nodes] = face_array[
index : index + num_face_nodes
]
index = index + num_face_nodes
return result

face_nodes_flat_array = fill_int_face_array(mesh2d.face_nodes)
face_edges_flat_array = fill_int_face_array(mesh2d.face_edges)
edge_faces_flat_array = fill_int_face_array(mesh2d.edge_faces)

return UGridMesh2D(
name=name,
Expand All @@ -543,7 +544,7 @@ def fill_int_face_array(face_array):
edge_node=mesh2d.edge_nodes,
face_nodes=face_nodes_flat_array,
face_edges=face_edges_flat_array,
edge_faces=edge_faces_flat_array,
edge_faces=mesh2d.edge_faces,
edge_x=mesh2d.edge_x,
edge_y=mesh2d.edge_y,
face_x=mesh2d.face_x,
Expand Down

0 comments on commit 3725873

Please sign in to comment.