Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/10_mesh2d_global_grid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"outputs": [],
"source": [
"mk = meshkernel.MeshKernel(projection=meshkernel.ProjectionType.SPHERICAL)\n",
"mk.mesh2d_make_global(num_longitude_nodes=192, num_latitude_nodes=100)\n",
"mk.mesh2d_make_global(num_longitude_nodes=192)\n",
"mesh2d = mk.mesh2d_get()"
]
},
Expand Down
11 changes: 5 additions & 6 deletions meshkernel/meshkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,21 +643,20 @@ def mesh2d_delete_hanging_edges(self) -> None:
self.lib.mkernel_mesh2d_delete_hanging_edges, self._meshkernelid
)

def mesh2d_make_global(
self, num_longitude_nodes: int, num_latitude_nodes: int
) -> None:
"""Compute the global mesh with a given number of points along the longitude and latitude directions.
def mesh2d_make_global(self, num_longitude_nodes: int) -> None:
"""Compute the global mesh with a given number of points along the longitude direction.
The number of points in the latitude direction will be automatically calculated, such
that the resulting cells are as square as possible and the resulting mesh extends up
to the poles.

Args:
num_longitude_nodes (int): The number of points along the longitude.
num_latitude_nodes (int): The number of points along the latitude (half hemisphere)
"""
Comment thread
BillSenior marked this conversation as resolved.

self._execute_function(
self.lib.mkernel_mesh2d_make_global,
self._meshkernelid,
c_int(num_longitude_nodes),
c_int(num_latitude_nodes),
)

def mesh2d_make_triangular_mesh_from_polygon(
Expand Down
6 changes: 2 additions & 4 deletions tests/test_mesh2d_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,8 @@ def test_mesh2d_make_global():
mk = MeshKernel(ProjectionType.SPHERICAL)

num_longitude_nodes = 19
num_latitude_nodes = 25

mk.mesh2d_make_global(num_longitude_nodes, num_latitude_nodes)
mk.mesh2d_make_global(num_longitude_nodes)
mesh2d = mk.mesh2d_get()

assert mesh2d.edge_x.size == 1225
Expand All @@ -698,10 +697,9 @@ def test_mesh2d_make_global_with_cartesian_coordinates_should_throw():
mk = MeshKernel(ProjectionType.CARTESIAN)

num_longitude_nodes = 19
num_latitude_nodes = 25

with pytest.raises(MeshKernelError):
mk.mesh2d_make_global(num_longitude_nodes, num_latitude_nodes)
mk.mesh2d_make_global(num_longitude_nodes)


def test_mesh2d_make_triangular_mesh_from_polygon():
Expand Down
Loading