Correct `NETLINK_CONTOUR_POLYGON`

オープン
#290 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

Start by reproducing the reported behavior with the three mesh examples and inspect the mesh2d_get_property path for Mesh2dProperty.NETLINK_CONTOUR_POLYGON. Compare the returned contour coordinates before and after mesh2d_delete_hanging_edges(), especially the -999 values on the grid with a hanging edge. Done means the property returns a sensible contour for the reported grids.

索引モデルが issue の本文から書いたものです。

説明

bug

Describe the bug
The property NETLINK_CONTOUR_POLYGON seems to me incorrect. This was discovered in https://github.com/Deltares/BaselineTools/issues/96, but it happens for more grids.

To Reproduce
Code snippet with several examples:

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.7
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,
    )
mk1 = MeshKernel(projection=ProjectionType.SPHERICAL)
mk1.curvilinear_compute_rectangular_grid_on_extension(make_grid_parameters)
mk1.curvilinear_convert_to_mesh2d() #convert to ugrid/mesh2d

uds2 = xu.open_dataset(r"c:\DATA\checkouts\dfm_tools\docs\notebooks\Vietnam_2D_model\Vietnam_net.nc")
uds3 = xu.open_dataset(r"c:\Users\veenstra\Downloads\zee_middengebied_small_net.nc")
# uds.grid.plot()
# plt.show()
mk2 = uds2.grid.meshkernel
mk3 = uds3.grid.meshkernel

for mk in [mk1, mk2, mk3]:
    mesh_orig = mk.mesh2d_get()

    # repair the grid with mesh2d_delete_hanging_edges()
    hanging_edges = mk.mesh2d_get_hanging_edges()
    print(hanging_edges)
    mk.mesh2d_delete_hanging_edges()
    mesh_fixed = mk.mesh2d_get()

    net_contour = mk.mesh2d_get_property(
        mesh2d_location=Mesh2dLocation.EDGES,
        property=Mesh2dProperty.NETLINK_CONTOUR_POLYGON,
    )

    fig,(ax1,ax2,ax3) = plt.subplots(1, 3, figsize=(12,5), sharex=True, sharey=True)
    mesh_orig.plot_edges(ax=ax1)
    mesh_fixed.plot_edges(ax=ax2)
    ax3.plot(net_contour.x_coordinates, net_contour.y_coordinates, "r")
    fig.tight_layout()
    plt.show()

For simple base grid:

Image

For Vietnam model:

Image

For zee_middengebied_small_net:

Image

Expected behavior
This should return NETLINK_CONTOUR_POLYGON that makes sense (and no -999 values for zee rooster that had a hanging edge).

Version info (please complete the following information):

  • OS: Windows
  • Version 8.4.0
主要言語
Python
スター
30
フォーク
5
平均マージ
1日 17時間
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Deltares/MeshKernelPy のほかの issue

Deltares/MeshKernelPy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。