-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Describe the bug
Follow-up of #181. When generating a global grid with "inconvenient" user input
(a low number of latitude values), the resulting grid does not extent to +/- 90 latitude (poles). The code below generates a grid from -/+60 approximately:

To Reproduce
from meshkernel import MeshKernel, ProjectionType
import matplotlib.pyplot as plt
plt.close('all')
mk = MeshKernel(projection=ProjectionType.SPHERICAL)
mk.mesh2d_make_global(num_longitude_nodes=100, num_latitude_nodes=20)
mesh2d = mk.mesh2d_get()
fig, ax = plt.subplots()
mesh2d.plot_edges(ax)Expected behavior
A global grid should always extend from -180 to +180 longitude and -90 to +90 latitude.
Version info (please complete the following information):
- OS: Windows
- Version 8.1.2 (build from main on 31 July 2025, including the fix for make
mesh2d_make_globalin line with interacter behaviour #181)
Additional context
This is caused by the fact that the requested nx and ny are too far apart. This causes the computed dx/dy in combination with ny to not make it possible to extend to -+90 degrees. In fact, this is because the cells are made square (in meters). I think this is the only valid usecase, so it might then be better to remove the ny from the user input arguments. I believe in interacter it is also being ignored, but it should still be a sensible value. It might be good to improve upon this in meshkernelpy.