Skip to content

global grid from mesh2d_make_global does not always extend to the poles #236

@veenstrajelmer

Description

@veenstrajelmer

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:
image

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):

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions