"""격자 칸 크기(m) — 적힌 칸(`resolution`)보다 좌표 간격을 믿음(633). B04 평활 격자는 꼭짓점이 많으면 칸을 넓히고 적힌 칸은 요청값 그대로라 둘이 어긋남. 둘이 맞으면(1 % 안) 적힌 값을 그대로 돌려줘 옛 결과와 같음. """ from __future__ import annotations import logging import math from typing import Any import numpy as np logger = logging.getLogger(__name__) def grid_cell_m(dem: Any, x: Any) -> float: """npz 격자(`dem`)의 칸 — `x` = 열 좌표.""" spacing = abs(float(x[1] - x[0])) if "resolution" not in dem.files: return spacing written = float(np.asarray(dem["resolution"]).reshape(-1)[0]) if math.isclose(written, spacing, rel_tol=0.01): return written logger.warning("격자 칸 %.3f m 로 적힘 · 좌표 간격 %.3f m — 좌표 간격을 씀", written, spacing) return spacing