From fe6f67d123c5b557dc87722a9880ef8bf07d4625 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Tue, 3 Nov 2026 16:04:17 +0900 Subject: [PATCH] =?UTF-8?q?fix(765=20=EC=9D=B4=EC=9D=8C=EB=A7=A4):=20LAS?= =?UTF-8?q?=20=EB=82=98=EC=A4=91=20=EC=98=AC=EB=A6=AC=EA=B8=B0=20=EC=98=9B?= =?UTF-8?q?=20=ED=95=84=ED=84=B0=20=EC=A7=80=EC=9A=B0=EA=B8=B0=EA=B0=80=20?= =?UTF-8?q?=EC=83=88=EB=A1=9C=20=EC=A7=80=EC=9D=80=20=EB=8B=A4=EB=93=AC?= =?UTF-8?q?=EA=B8=B0=20=EB=AA=A8=EB=8D=B8=EA=B9=8C=EC=A7=80=20=EC=A7=80?= =?UTF-8?q?=EC=9A=B0=EB=8D=98=20=EA=B2=83=20=E2=80=94=20=EC=A7=80=EC=9D=80?= =?UTF-8?q?=20=ED=95=84=ED=84=B0=EA=B0=80=20=EC=98=9B=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=EC=9D=84=20=EC=95=9E=EB=A8=B8=EB=A6=AC=EB=A1=9C=20=ED=92=88?= =?UTF-8?q?=EC=9C=BC=EB=A9=B4=20=EB=82=A8=EA=B9=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 766-1(기본 = 업체 분류 + 다듬기 · classification_refine) 과 637-3 drop_stale_filters 가 만나 classification 을 지우며 dtm_classification_refine.npz · implicit_classification_refine*.npz 까지 지움(라이다 짓기 직후 모델 없음) - test_637_lidar B 뿌리 짓기: 기대 필터를 다듬기 이름으로(옛 csf · ptd 기본 아님) · 모델 npz 만 봄 · 긴 이름 지은 필터 지킴 시험 하나 덧 Co-Authored-By: Claude Opus 5.5 --- common_util/common_util_lidar_upload.py | 5 +++++ resources/tester/test_637_lidar.py | 25 ++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/common_util/common_util_lidar_upload.py b/common_util/common_util_lidar_upload.py index dd9f37985..bbb471da7 100644 --- a/common_util/common_util_lidar_upload.py +++ b/common_util/common_util_lidar_upload.py @@ -185,7 +185,12 @@ def drop_stale_filters(base: Path, built: list[str]) -> list[str]: *(processed / name for name in (f"mask_{key}.npy", f"ground_points_{key}.npz")), processed / f"preview_points_{key}.bin", ] + # 지은 필터가 이 이름을 앞머리로 품으면(`classification` ⊂ `classification_refine` · 766) + # 그 파일은 지은 필터 것 — 남김 + longer = [b for b in built if b.startswith(f"{key}_")] for path in paths: + if any(f"_{b}." in path.name or f"_{b}_" in path.name for b in longer): + continue if path.is_file(): path.unlink() if path.parent == models and path.suffix == ".npz": diff --git a/resources/tester/test_637_lidar.py b/resources/tester/test_637_lidar.py index baa43d32e..ec27bcea6 100644 --- a/resources/tester/test_637_lidar.py +++ b/resources/tester/test_637_lidar.py @@ -262,9 +262,28 @@ def test_B_뿌리_짓기_수치지형도_그대로_덮임(tmp_path: Path, monkey kept = _route_build(tmp_path, monkeypatch, [[200010, 500010], [200020, 500020]], target) assert kept["meta"]["selection"] == target assert {m["source_filter"] for m in kept["models"]} == {"classification"} - # 갈음 = 안 지은 필터(앞서 자동으로 지은 csf)는 옛 LAS 것 → 지움 · 수치지형도 그대로(637-3) - assert "B04_PreProcess/models/dtm_ptd.npz" in kept["dropped"] - assert not list((tmp_path / b05.MODELS).glob("*_csf*")) and sheet.read_bytes() == b"sheet" + # 갈음 = 안 지은 필터(앞서 자동으로 지은 다듬기 필터 · 766 기본)는 옛 LAS 것 → 지움 · + # 수치지형도 그대로(637-3) + assert "B04_PreProcess/models/dtm_ptd_refine.npz" in kept["dropped"] + assert not list((tmp_path / b05.MODELS).glob("*_refine*.npz")) and sheet.read_bytes() == b"sheet" + + +def test_옛_필터_지우기는_긴_이름_지은_필터를_안_건드림(tmp_path: Path) -> None: + """`classification` 을 지울 때 지은 `classification_refine` 모델은 남김(766 · 이음매).""" + models = tmp_path / "B04_PreProcess" / "models" + models.mkdir(parents=True) + names = [ + "dtm_classification.npz", + "dtm_classification_refine.npz", + "implicit_classification_refine_grid.npz", + "contour_classification_refine_dtm_1.0m.json", + "contour_classification_dtm_1.0m.json", + ] + for name in names: + (models / name).write_bytes(b"x") + gone = lidar_upload.drop_stale_filters(tmp_path, ["classification_refine"]) + assert gone == ["B04_PreProcess/models/dtm_classification.npz"] + assert sorted(p.name for p in models.iterdir()) == sorted(n for n in names if "refine" in n) def _stamps(root: Path) -> dict[str, str]: