From 6db98d6b1450c126b5b9bf734a17f33d0b7bb8e1 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sun, 1 Nov 2026 22:44:40 +0900 Subject: [PATCH] =?UTF-8?q?feat(643-1):=20B04=20implicit=20=EB=93=B1?= =?UTF-8?q?=EA=B3=A0=EC=84=A0=20=3D=20=EA=B5=B3=ED=9E=8C=20=EA=B2=A9?= =?UTF-8?q?=EC=9E=90=20=EA=B7=B8=EB=8C=80=EB=A1=9C=20=E2=80=94=20=EB=93=B1?= =?UTF-8?q?=EA=B3=A0=EC=84=A0=20=C2=B7=20=EC=A2=85=EB=8B=A8=20=C2=B7=20?= =?UTF-8?q?=ED=9A=A1=EB=8B=A8=20=EA=B0=99=EC=9D=80=20=EB=A9=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - implicit 등고선이 RBF 를 다시 세던 길 대신 implicit_{필터}_grid.npz 를 바로 씀(같은 dtm 없을 때만 옛 길) - 용화(검증_sub4) WF1 다시 = classification + implicit 자동 확정 · 등고선 꼭짓점 − 표본 면 최대 3 mm(전 1.28 m) · 등고선 16.7 s - 지킴 시험 test_641_1 에 등고선 = 표본 면 더함 Co-Authored-By: Claude Opus 5.5 --- B04_PreProcess/B04_PreProcess_Engine_Contour.py | 14 ++++++++++++++ resources/tester/test_641_1_implicit_grid.py | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/B04_PreProcess/B04_PreProcess_Engine_Contour.py b/B04_PreProcess/B04_PreProcess_Engine_Contour.py index 7ede4004d..30a6946a1 100644 --- a/B04_PreProcess/B04_PreProcess_Engine_Contour.py +++ b/B04_PreProcess/B04_PreProcess_Engine_Contour.py @@ -428,6 +428,20 @@ def extract_contours( ) if representation == "local_rbf_height_field": + # 굳힌 격자(641-1)가 있으면 그 면 그대로 — 등고선 = 서버 표본 · 종횡단과 같은 면(643) + filter_key = model_npz_path.stem.removeprefix("implicit_") + if (model_npz_path.parent / f"dtm_{filter_key}.npz").is_file(): + from common_util.common_util_surface_sampler import implicit_grid_npz + + with np.load(implicit_grid_npz(model_npz_path.parent, filter_key)) as grid: + return extract_contours_from_grid( + grid["x"], + grid["y"], + grid["z"], + grid["valid_mask"], + interval, + scene_center=scene_center, + ) centers_xy, center_z = data["centers_xy"], data["center_z"] smoothing = float(data["smoothing"][0]) interpolator = RBFInterpolator( diff --git a/resources/tester/test_641_1_implicit_grid.py b/resources/tester/test_641_1_implicit_grid.py index 1609f5a59..66d93c38f 100644 --- a/resources/tester/test_641_1_implicit_grid.py +++ b/resources/tester/test_641_1_implicit_grid.py @@ -161,3 +161,17 @@ def test_B07_음영_implicit_확정이면_평활_DTM(tmp_path, monkeypatch): ): basin._hillshade_for_box(SimpleNamespace(surface_params=params, project_root=tmp_path), box) assert opened[-1] == name + + +def test_643_등고선_굳힌_격자_그대로(tmp_path): + from B04_PreProcess.B04_PreProcess_Engine_Contour import extract_contours + + models = _project(tmp_path) + contours = extract_contours( + models / "implicit_classification.npz", "local_rbf_height_field", 1.0 + ) + points = np.array([p for c in contours for p in c["coordinates"]]) + sampler = build_surface_sampler(models, "classification", "implicit", False) + z, valid = sampler.sample_xy(points[:, :2]) + assert valid.sum() > 0.9 * len(points) + assert np.abs(z[valid] - points[valid, 2]).max() < 0.005 # 등고선 = 표본 면(좌표 mm 자리)