feat(643-1): B04 implicit 등고선 = 굳힌 격자 그대로 — 등고선 · 종단 · 횡단 같은 면

- 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 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 22:44:40 +09:00
co-authored by Claude Opus 5.5
parent 5bd2df81a4
commit 6db98d6b14
2 changed files with 28 additions and 0 deletions
@@ -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(
@@ -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 자리)