From 892c33c74e52ba1cfe9a3850914cfed4927f1a2d Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 31 Aug 2026 20:14:06 +0900 Subject: [PATCH] =?UTF-8?q?fix(B04):=20=EB=B0=B0=EC=88=98=EC=9C=A0?= =?UTF-8?q?=EC=97=AD=C2=B7=EC=9C=A0=EC=9E=85=C2=B7=EB=B0=B0=EC=88=98=20?= =?UTF-8?q?=EC=BB=A8=ED=85=8D=EC=8A=A4=ED=8A=B8=EB=8F=84=20shapefile=20?= =?UTF-8?q?=EB=85=B8=EC=84=A0=EC=9D=84=20=EC=9D=BD=EA=B2=8C=20=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 실측(2026-08-31): 업로드 후 화면에서 "계획 노선 CSV를 읽지 못했습니다: ...shp" 경고가 반복됐다. find_planned_route_file 은 shapefile을 우선 돌려주는데 받는 쪽이 아직 read_planned_route_csv 였다 - 확장자 분기가 없는 판독기라 .shp 를 CSV로 열다 실패하고 노선 없이 진행했다. 앞선 커밋에서 Service_Chain, SheetSurface, Router_GIS 는 바꿨으나 아래 세 곳을 놓쳤다(조사 당시 grep 출력이 잘려 목록에서 빠졌다): - B04_PreProcess_Router_Watershed.py (2곳) - B04_PreProcess_Router_Inflow.py - common_util_drainage_context.py 셋 다 read_planned_route 로 바꿨다 - CSV/shapefile을 확장자로 갈라 읽는다. 검증: ruff check 통과, tmp/tests 302 passed (잔여 실패 11건은 기존 실패로 HEAD 사본에서 동일 재현). Co-Authored-By: Claude Opus 5 (1M context) --- B04_PreProcess/B04_PreProcess_Router_Inflow.py | 4 ++-- B04_PreProcess/B04_PreProcess_Router_Watershed.py | 6 +++--- common_util/common_util_drainage_context.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/B04_PreProcess/B04_PreProcess_Router_Inflow.py b/B04_PreProcess/B04_PreProcess_Router_Inflow.py index 594e143a..ab520978 100644 --- a/B04_PreProcess/B04_PreProcess_Router_Inflow.py +++ b/B04_PreProcess/B04_PreProcess_Router_Inflow.py @@ -27,7 +27,7 @@ from B04_PreProcess.B04_PreProcess_Engine_Watershed_Grid import GridSpec from B05_Profile.B05_Profile_Repository import get_surface_crs_epsg from common_util.common_util_route_geometry import ( find_planned_route_file, - read_planned_route_csv, + read_planned_route, ) from common_util.common_util_storage import resolve_stored_project_path from config.config_db import get_db_pool @@ -80,7 +80,7 @@ async def _resolve_epsg(project_id: UUID, stored_path: str) -> str: epsg = await get_surface_crs_epsg(connection, project_id, 0) project_root = Path(resolve_stored_project_path(stored_path)) route_file = find_planned_route_file(project_root / "B03_FileInput" / "input") - planned = read_planned_route_csv(route_file) if route_file else None + planned = read_planned_route(route_file) if route_file else None source = (planned.epsg if planned else None) or epsg or 5186 return f"EPSG:{source}" diff --git a/B04_PreProcess/B04_PreProcess_Router_Watershed.py b/B04_PreProcess/B04_PreProcess_Router_Watershed.py index 54949168..d77acbc9 100644 --- a/B04_PreProcess/B04_PreProcess_Router_Watershed.py +++ b/B04_PreProcess/B04_PreProcess_Router_Watershed.py @@ -39,7 +39,7 @@ from B05_Profile.B05_Profile_Repository import get_surface_crs_epsg from common_util.common_util_route_geometry import ( StructureCandidate, find_planned_route_file, - read_planned_route_csv, + read_planned_route, ) from common_util.common_util_storage import resolve_stored_project_path from common_util.common_util_wamis_rainfall import ( @@ -172,7 +172,7 @@ async def _prepare(project_id: UUID) -> dict[str, Any] | JSONResponse: status_code=404, content={"status": "error", "message": "계획 노선 파일이 업로드되지 않았습니다."}, ) - planned = read_planned_route_csv(route_file) + planned = read_planned_route(route_file) if planned is None or len(planned.vertices) < 2: return JSONResponse( status_code=400, @@ -246,7 +246,7 @@ def _route_center_lonlat(stored_path: str, fallback_epsg: int | None) -> tuple[f route_file = find_planned_route_file(_route_input_dir(stored_path)) if route_file is None: return None - planned = read_planned_route_csv(route_file) + planned = read_planned_route(route_file) if planned is None or not planned.vertices: return None middle = planned.vertices[len(planned.vertices) // 2] diff --git a/common_util/common_util_drainage_context.py b/common_util/common_util_drainage_context.py index 9bc3b0f3..bce2711f 100644 --- a/common_util/common_util_drainage_context.py +++ b/common_util/common_util_drainage_context.py @@ -31,7 +31,7 @@ from common_util.common_util_route_geometry import ( RouteVertex, build_route_vertices, find_planned_route_file, - read_planned_route_csv, + read_planned_route, ) from common_util.common_util_route_profile import Z_SOURCE_CSV, resolve_route_profile from common_util.common_util_storage import resolve_stored_project_path @@ -114,7 +114,7 @@ async def load_drainage_context(project_id: UUID) -> tuple[DrainageContext | Non def _read_planned_route(project_root: Path): """원청 계획노선 CSV를 찾아 읽는다(파일 접근이라 스레드에서 돈다).""" path = find_planned_route_file(project_root / _INPUT_SUBDIR) - return read_planned_route_csv(path) if path else None + return read_planned_route(path) if path else None def _open_sampler(project_root: Path, surface_params: dict[str, Any]):