fix netlink contours for spherical grids
還沒有人認領這個 Issue。
評估
研究方向
Start with the spherical grid and netlink contour property path exercised by the reproduction, especially curvilinear_compute_rectangular_grid_on_extension, curvilinear_convert_to_mesh2d, and mesh2d_get_property. Compare contour widths in longitude and latitude against cell circumcenters for the supplied 0.3-degree grid. Done when spherical-grid contours reach the circumcenters in both directions.
由索引模型根據 Issue 內容生成。
描述
Describe the bug
When deriving the netlink contours for spherical grids, they seem too wide in the longitude direction, but they are as expected in the latitude direction.
To Reproduce
import xugrid as xu
from meshkernel.py_structures import Mesh2dProperty, Mesh2dLocation
import matplotlib.pyplot as plt
plt.close('all')
import numpy as np
from meshkernel import (
MeshKernel,
ProjectionType,
GeometryList,
MakeGridParameters,
Mesh2dProperty,
Mesh2dLocation,
)
# create basegrid
lon_min, lon_max, lat_min, lat_max = 1, 2, 48.5, 49.2
dxy = 0.3
make_grid_parameters = MakeGridParameters(
origin_x=lon_min,
origin_y=lat_min,
upper_right_x=lon_max,
upper_right_y=lat_max,
block_size_x=dxy,
block_size_y=dxy,
)
mk = MeshKernel(projection=ProjectionType.SPHERICAL)
mk.curvilinear_compute_rectangular_grid_on_extension(make_grid_parameters)
mk.curvilinear_convert_to_mesh2d() # convert to ugrid/mesh2d
mesh2d = mk.mesh2d_get()
net_contour = mk.mesh2d_get_property(
mesh2d_location=Mesh2dLocation.EDGES,
property=Mesh2dProperty.NETLINK_CONTOUR_POLYGON,
)
fig, ax = plt.subplots(1, 1, sharex=True, sharey=True)
mesh2d.plot_edges(ax=ax)
# reshape netcontours
_LINK_CONTOUR_MAX_VERTICES = 4
n_edges = mesh2d.edge_nodes.size // 2
contour_x = np.asarray(net_contour.x_coordinates, dtype=np.float64).reshape(
n_edges, _LINK_CONTOUR_MAX_VERTICES
)
contour_y = np.asarray(net_contour.y_coordinates, dtype=np.float64).reshape(
n_edges, _LINK_CONTOUR_MAX_VERTICES
)
ncontours = range(len(contour_x))
for n, x, y in zip(ncontours, contour_x, contour_y):
x = np.concatenate([x, [x[0]]])
y = np.concatenate([y, [y[0]]])
# only plot some of the netlink contours to not flood the figures
if np.remainder(n, 8) != 0:
continue
# plt.text(np.mean(x), np.mean(y), str(n))
ax.plot(x, y, "r")
ax.set_aspect("equal")
fig.tight_layout()
plt.show()
Gives the following figure:
Expected behavior
Netlink contours should reach until the circumcenter of the cells, which is the center in case of square cells.
Version info (please complete the following information):
- OS: Windows
- Version 8.4.1
- 主要語言
- Python
- 星號
- 30
- 分支
- 5
- 平均合併
- 1 天 17 小時
- 30 天內合併 PR
- 4
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Deltares/MeshKernelPy 的其他 Issue
-
bug
難度 4/5 3-5 天 新手友好度 48/100
Deltares/MeshKernelPy#290 · 1 則留言 ·
-
enhancement
難度 3/5 1-2 天 新手友好度 45/100
Deltares/MeshKernelPy#287 ·
-
chore
難度 4/5 3-5 天 新手友好度 35/100
Deltares/MeshKernelPy#284 ·
-
Add support for Python 3.14可能已有人在做 @veenstrajelmer 於 201 天前認領。 未關閉chore
難度 3/5 1-2 天 新手友好度 25/100
Deltares/MeshKernelPy#251 · 2 則留言 ·
-
chore
難度 4/5 3-5 天 新手友好度 45/100
Deltares/MeshKernelPy#190 ·
查看 Deltares/MeshKernelPy 的全部 Issue
相似的 Issue
-
docs(contributing): the two things that silently block a PR可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉available documentation good first issue
難度 1/5 1-3 小時 新手友好度 95/100
Nixitov/Riptide-Native#944 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 88/100
JTHCode/secretguard#24 ·
維護者通常 1 天內回覆
-
area: middleware documentation good first issue
難度 2/5 1-3 小時 新手友好度 88/100
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
good first issue
難度 1/5 1 小時以內 新手友好度 95/100
omarelshamy25x/shamy-hijri#63 ·
維護者通常 1 天內回覆