feat(B04): 자동 전처리를 기본 조합만 만들고 나머지는 관리자 요청 시 만든다

지면 필터를 고쳐 지면점이 9~26배 늘자, 필터 전체 x 표현 전체를 미리 만드는
자동 전처리가 감당 못 할 만큼 길어졌다(용화 기준 15~20 모델). 산출물 대부분은
아무도 열어 보지 않는다.

- 자동 전처리는 기본 필터 1종 x SURFACE_AUTO_METHODS(dtm) 만 만든다. 스무딩
  유무 두 벌은 기존대로 같이 나온다.
- 기본 필터는 고정값이 아니라 입력 LAS를 보고 정한다 — 지면분류(class 2)가
  있으면 classification, 없으면 csf. csf는 분류 없는 LAS를 필터링하기 위한
  수단이므로 그때만 쓴다.
- 관리자가 B04 드롭다운을 바꾸면 그 조합이 이미 저장돼 있는지 보고, 없으면
  모달로 물은 뒤 그 조합만 계산해 영구 저장한다. 취소하면 드롭다운을 되돌린다.
  이미 있으면 묻지 않고 저장된 데이터를 그대로 쓴다.
- config_signature에서 source_filters·precompute를 뺀다. 이 둘은 "무엇을
  만들지"를 고르는 값이라 서명에 넣으면 조합을 바꿀 때마다 manifest가 통째로
  폐기돼 이전에 만들어 둔 조합이 사라진다.
- analyzeSurface가 API_ANALYSIS_TIMEOUT_MS를 쓴다 — 기본 30초로는 조합 하나를
  만드는 동안 abort 된다.

detect_extra_filters()는 resolve_auto_source_filters()로 대체했다. 필터를
말없이 덧붙이는 대신, 자동 경로의 기본값을 정하는 판정으로 쓴다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-01 12:26:43 +09:00
co-authored by Claude Opus 5
parent ea254a741f
commit 10a629973b
8 changed files with 171 additions and 40 deletions
+13 -8
View File
@@ -15,7 +15,7 @@ import numpy as np
from B04_PreProcess.B04_PreProcess_Engine_Ground import (
build_ground_masks,
detect_extra_filters,
resolve_auto_source_filters,
run_ground_filter,
summarize_masks,
)
@@ -106,15 +106,18 @@ def run_surface_analysis(
project_root: Path,
las_path: Path,
*,
source_filters: list[str],
source_filters: list[str] | None,
methods: list[str],
force: bool = False,
on_progress: ProgressCallback | None = None,
) -> dict[str, Any]:
"""구조화→필터→모델 빌드를 수행하고 산출 메타데이터를 반환한다.
`source_filters`가 비면 입력 LAS를 보고 기본 필터를 정한다(자동 전처리 경로).
반환 dict:
- processed: {processed_file_path, converted_file_path, point_count, bounds, statistics}
- source_filters: 실제로 계산한 필터 목록 (자동 판정 결과 포함)
- ground_summary: 필터별 지면 포인트 요약
- manifest: 지표면 모델 파이프라인 manifest
- models: [{model_type, model_file_path, resolution_m, generation_params, layers}]
@@ -174,11 +177,10 @@ def run_surface_analysis(
# 2. 지면 필터 실행 — mask_{filter}.npy 영구 캐시 우선 재사용 (PLAN A-1)
_report(40, "ground_filter", "지면 필터 적용 중")
# LAS가 지면분류를 싣고 왔으면 필터 하나로 더 쓴다 — 미분류 LAS면 조용히 빠진다.
extra_filters = detect_extra_filters(data, source_filters)
if extra_filters:
source_filters = list(source_filters) + extra_filters
logger.info("B04 LAS 자체 지면분류 감지 — 필터 추가: %s", ", ".join(extra_filters))
# 자동 전처리는 목록을 넘기지 않는다 — 기본 필터는 입력 LAS를 보고 여기서 정한다.
if not source_filters:
source_filters = resolve_auto_source_filters(data)
logger.info("B04 자동 전처리 기본 필터: %s", ", ".join(source_filters))
masks: dict[str, np.ndarray] = {}
for filter_key in source_filters:
mask_path = processed_dir / f"mask_{filter_key}.npy"
@@ -266,7 +268,7 @@ def run_surface_analysis(
_report(95, "saving", "결과 저장 중")
return _collect_analysis_result(
result = _collect_analysis_result(
project_root,
models_dir,
structured_path,
@@ -278,6 +280,9 @@ def run_surface_analysis(
sheet_models,
total_started,
)
# 자동 경로는 필터를 넘기지 않으므로, 무엇으로 계산했는지 호출부에 돌려준다.
result["source_filters"] = list(source_filters)
return result
def download_geodata(