Files
Aislo/scratch/test_sheetstore_ingest.py
T

48 lines
1.5 KiB
Python

"""도엽 영구저장소(SheetStore) 인제스트 실테스트.
Downloads의 보유 도엽 zip 전량을 resources/map_sheets/에 등록하고,
CRS 오라벨 zip(36902002.zip) 자동 교정과 ensure_sheets 3x3 흐름을 확인한다.
"""
import sys
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(PROJECT_ROOT))
from B04_wf1_Surface.B04_wf1_Surface_Engine_MapSheet import neighbors_3x3
from B04_wf1_Surface.B04_wf1_Surface_Engine_SheetStore import (
ensure_sheets,
get_sheet_path,
ingest_zip,
)
DOWNLOADS = Path.home() / "Downloads"
def main():
zips = sorted(DOWNLOADS.glob("*수치지도_*.zip")) + [
p for p in (DOWNLOADS / "36906042.zip", DOWNLOADS / "36902002.zip") if p.exists()
]
for zp in zips:
try:
entry = ingest_zip(zp)
print(f"OK {zp.name} -> {entry['file']} crs={entry['crs']}")
except Exception as e:
print(f"FAIL {zp.name}: {e}")
print("\n--- ensure_sheets: 36906042 중심 3x3 ---")
result = ensure_sheets(neighbors_3x3("36906042"))
print("보유:", sorted(result["available"].keys()))
print("미보유:", result["missing"])
if "guidance" in result:
print("안내 URL:", result["guidance"]["vworld_dataset_url"])
print("\n--- get_sheet_path ---")
print("36906042:", get_sheet_path("36906042"))
print("99999999:", get_sheet_path("99999999"))
if __name__ == "__main__":
main()