diff --git a/B05_Profile/B05_Profile_Api_TerrainGrid.ts b/B05_Profile/B05_Profile_Api_TerrainGrid.ts index 647f5dcad..14d5387c6 100644 --- a/B05_Profile/B05_Profile_Api_TerrainGrid.ts +++ b/B05_Profile/B05_Profile_Api_TerrainGrid.ts @@ -73,7 +73,7 @@ export function designTerrainGridNow(projectId: string): DesignTerrainGrid | nul /** 한 번에 물을 수 있는 점 수 — 서버 `MAX_POINTS` 와 같은 값. */ const ELEVATION_CHUNK = 4000; -/** 계산 묶음 ground 단계에 넣을 격자 · 서버 길(PLAN 346-1). 서버 길 값은 mm 자리(응답 그대로). */ +/** 계산 묶음 ground 단계에 넣을 격자 · 서버 길(PLAN 346-1). 서버 길도 소수 6자리 — 격자 길과 같은 값. */ export function groundStageDeps(projectId: string): Pick { return { grid: () => designTerrainGridNow(projectId), @@ -88,7 +88,7 @@ export function groundStageDeps(projectId: string): Pick return { "status": "success", "project_id": str(project_id), - "z": [None if not ok else round(float(value), 3) for value, ok in zip(z, valid)], + "z": [ + None if not ok else round(float(value), request.decimals) for value, ok in zip(z, valid) + ], "valid": [bool(ok) for ok in valid], } diff --git a/resources/tester/test_344_1_terrain_grid_route.py b/resources/tester/test_344_1_terrain_grid_route.py index 69476e550..05c363bc3 100644 --- a/resources/tester/test_344_1_terrain_grid_route.py +++ b/resources/tester/test_344_1_terrain_grid_route.py @@ -114,3 +114,30 @@ def test_받을_자리_서명은_manifest_구성과_평활(tmp_path): ) assert terrain_router._design_grid({**PARAMS, "method": "tin"}, models, confirmed) is None assert terrain_router._design_grid(PARAMS, models, None) is None + + +def test_지반고_자릿수_기본_3_묶음은_6(tmp_path, monkeypatch): + root = tmp_path + models = root / "B04_PreProcess" / "models" + models.mkdir(parents=True) + x = np.arange(0.0, 11.0) + np.savez( + models / "dtm_csf_smooth.npz", + x=x, + y=x, + z=np.add.outer(x * 0.0, x * 0.1234567), + valid_mask=np.ones((11, 11), dtype=bool), + ) + _patch(monkeypatch, root, None) + + async def params(_connection, _project_id): + return dict(PARAMS) + + monkeypatch.setattr(terrain_router, "get_surface_confirmation_params", params) + ask = terrain_router.ElevationRequest + plain = asyncio.run(terrain_router.read_route_elevations(PID, ask(points=[(5.5, 5.0)]))) + fine = asyncio.run( + terrain_router.read_route_elevations(PID, ask(points=[(5.5, 5.0)], decimals=6)) + ) + assert plain["z"] == [round(5.5 * 0.1234567, 3)] + assert fine["z"] == [round(5.5 * 0.1234567, 6)]