You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When generating a global grid with mesh2d_make_global, the resulting grid is sort of flipped with respect to the reference in interacter. This is inconvenient, since it complicates conversions in other tools like the xugrid.to_nonperiodic() conversion.
To reproduce:
frommeshkernelimportDeleteMeshOption, MeshKernel, ProjectionType, GeometryListimportmatplotlib.pyplotaspltplt.close('all')
importxugridasxuimportnumpyasnpmk=MeshKernel(projection=ProjectionType.SPHERICAL)
mk.mesh2d_make_global(num_longitude_nodes=192, num_latitude_nodes=100)
line_array=np.array([[-68.37701613, 21.48864852],
[-71.26512097, 51.0113413 ],
[ 1.65952621, 57.30306271],
[ 15.37802419, 19.55273423],
[-32.99773185, -14.32576568],
[-62.60080645, 11.32509854],
[-68.37701613, 21.48864852]])
xx=line_array[:,0]
yy=line_array[:,1]
delete_pol_geom=GeometryList(x_coordinates=xx, y_coordinates=yy)
mk.mesh2d_delete(geometry_list=delete_pol_geom,
delete_option=DeleteMeshOption.INSIDE_NOT_INTERSECTED,
invert_deletion=False)
mesh2d=mk.mesh2d_get()
fig, ax=plt.subplots()
mesh2d.plot_edges(ax)
ax.plot(xx, yy, 'r-')
# xugrid conversionxu_grid=xu.Ugrid2d.from_meshkernel(mesh=mesh2d, projected=False, crs=4326)
# TODO: this to_nonperiodic conversion now only partly works, it does not result in grid in the upper/lower left corners if the figure.xu_grid_flat=xu_grid.to_nonperiodic(xmax=180)
#fig, ax = plt.subplots()#xu_grid.plot()fig, ax=plt.subplots()
xu_grid_flat.plot()
Gives:
Describe the solution you'd like
Get a flipped version of the figure above, in other words: get the continuous longitude line at lon=-180 instead of lon=180.
Additional context
Additionally, the algorithm seems not to be robust for different lat/lon values.
When supplying a low number of longitude values, we get orphan edges at the min/max latitudes
veenstrajelmer
changed the title
make mesh2d_make_global in line with interacter behaviour
make mesh2d_make_global in line with interacter behaviour and robust
Jul 1, 2024
veenstrajelmer
changed the title
make mesh2d_make_global in line with interacter behaviour and robust
make mesh2d_make_global in line with interacter behaviour
Jul 1, 2024
Is your feature request related to a problem? Please describe.
When generating a global grid with
mesh2d_make_global
, the resulting grid is sort of flipped with respect to the reference in interacter. This is inconvenient, since it complicates conversions in other tools like thexugrid.to_nonperiodic()
conversion.To reproduce:
Gives:
Describe the solution you'd like
Get a flipped version of the figure above, in other words: get the continuous longitude line at
lon=-180
instead oflon=180
.Additional context
Additionally, the algorithm seems not to be robust for different lat/lon values.
When supplying a low number of longitude values, we get orphan edges at the min/max latitudes
When supplying a low number of latitude values, the resulting grid does not extent to +/- 90 latitudes:
The text was updated successfully, but these errors were encountered: