fix(765 이음매): LAS 나중 올리기 옛 필터 지우기가 새로 지은 다듬기 모델까지 지우던 것 — 지은 필터가 옛 이름을 앞머리로 품으면 남김
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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":
|
||||
|
||||
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user