feat: 워치 스킨 가운데를 날씨 따라 비구름·천둥 구름·눈구름으로 — 초단기예보 낙뢰(LGT)로 2시간 안 천둥을 워치에 알림
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a74e3b49d0
commit
c0e0363759
10 files changed
+236
-37
No files matched your search
Vendored
+2
-2
@@ -79,13 +79,13 @@ def day_start_base(day: date) -> datetime:
|
||||
|
||||
|
||||
def parse_ultra(items: list[dict]) -> list[dict]:
|
||||
"""초단기예보 6시간: 시각별 비 형태·1시간 강수량·기온."""
|
||||
"""초단기예보 6시간: 시각별 비 형태·1시간 강수량·기온·낙뢰(LGT, 0 이면 없음)."""
|
||||
by_time: dict[datetime, dict[str, str]] = {}
|
||||
for it in items:
|
||||
at = datetime.strptime(it["fcstDate"] + it["fcstTime"], "%Y%m%d%H%M").replace(tzinfo=KST)
|
||||
by_time.setdefault(at, {})[it["category"]] = it["fcstValue"]
|
||||
return [
|
||||
{"at": at, "rain_type": _PTY[v["PTY"]], "rain_mm": parse_amount(v.get("RN1", "")), "temp_c": float(v["T1H"])}
|
||||
{"at": at, "rain_type": _PTY[v["PTY"]], "rain_mm": parse_amount(v.get("RN1", "")), "temp_c": float(v["T1H"]), "lightning": parse_amount(v.get("LGT", "")) > 0}
|
||||
for at, v in sorted(by_time.items())
|
||||
if "PTY" in v and "T1H" in v
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user