260710_1
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
동기 계산 파이프라인. 라우터에서 asyncio.to_thread로 호출한다.
|
||||
"""
|
||||
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -14,6 +15,9 @@ from B04_wf1_Surface.B04_wf1_Surface_Engine_Pipeline import build_all_terrain_mo
|
||||
from B04_wf1_Surface.B04_wf1_Surface_Engine_Structurize import structurize_las
|
||||
from config.config_system import build_surface_model_config
|
||||
|
||||
# 진행 콜백 시그니처: (진행률 0~100, 현재 단계 키, 메시지)
|
||||
ProgressCallback = Callable[[int, str, str], None]
|
||||
|
||||
|
||||
def _relative_to_project(project_root: Path, path: Path) -> str:
|
||||
"""프로젝트 루트 기준 posix 상대 경로 문자열."""
|
||||
@@ -27,6 +31,7 @@ def run_surface_analysis(
|
||||
source_filters: list[str],
|
||||
methods: list[str],
|
||||
force: bool = False,
|
||||
on_progress: ProgressCallback | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""구조화→필터→모델 빌드를 수행하고 산출 메타데이터를 반환한다.
|
||||
|
||||
@@ -36,6 +41,11 @@ def run_surface_analysis(
|
||||
- manifest: 지표면 모델 파이프라인 manifest
|
||||
- models: [{model_type, model_file_path, resolution_m, generation_params, layers}]
|
||||
"""
|
||||
|
||||
def _report(percent: int, stage: str, message: str) -> None:
|
||||
if on_progress is not None:
|
||||
on_progress(percent, stage, message)
|
||||
|
||||
stage_root = project_root / "B04_wf1_Surface"
|
||||
processed_dir = stage_root / "processed"
|
||||
models_dir = stage_root / "models"
|
||||
@@ -43,6 +53,7 @@ def run_surface_analysis(
|
||||
models_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# 1. LAS 구조화 (structured.npz)
|
||||
_report(10, "structurize", "LAS 구조화 중")
|
||||
structured_path = structurize_las(las_path, processed_dir)
|
||||
with np.load(structured_path) as structured:
|
||||
xyz = structured["xyz"]
|
||||
@@ -62,15 +73,19 @@ def run_surface_analysis(
|
||||
data = {"xyz": xyz, "bounds": bounds}
|
||||
|
||||
# 2. 지면 필터 실행
|
||||
_report(40, "ground_filter", "지면 필터 적용 중")
|
||||
masks = build_ground_masks(data, source_filters)
|
||||
ground_summary = summarize_masks(data, masks)
|
||||
|
||||
# 3. 지표면 5종 모델 빌드
|
||||
_report(70, "surface_model", "지표면 모델 생성 중")
|
||||
config = build_surface_model_config()
|
||||
config["source_filters"] = list(source_filters)
|
||||
config["precompute"] = list(methods)
|
||||
manifest = build_all_terrain_models(data, masks, models_dir, config, force=force)
|
||||
|
||||
_report(95, "saving", "결과 저장 중")
|
||||
|
||||
processed = {
|
||||
"processed_file_path": _relative_to_project(project_root, structured_path),
|
||||
"converted_file_path": None,
|
||||
|
||||
Reference in New Issue
Block a user