fix: 노을 결론이 공기(가시거리·습도)로 깎인 점수와 어긋나던 것 — 공기 보정 0.7배 미만이면 결론 한 단계 낮추고 이유 표시, 피드 노을 카드 점수 크게, 예보 기준 시각 표시
This commit is contained in:
1 parent
f4fe3e965c
commit
0a98fb8879
10 files changed
+67
-17
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import statistics
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from common.enums import Confidence, SkyGrade, SkySituation, SkyType
|
||||
@@ -54,6 +55,21 @@ def air_factor(air: Air) -> float:
|
||||
return f
|
||||
|
||||
|
||||
HAZY = 0.7 # 공기 보정이 이보다 작으면 결론을 한 단계 낮추고 이유에 공기를 말한다
|
||||
|
||||
|
||||
def air_note(air: Optional[dict]) -> Optional[str]:
|
||||
"""공기 보정이 크게 깎였으면 그 이유 한 마디 (예: 공기가 뿌예 색이 흐려요 (가시거리 6.5km·습도 80%)). 아니면 None."""
|
||||
if not air or air.get("factor") is None or air["factor"] >= HAZY:
|
||||
return None
|
||||
parts = []
|
||||
if air.get("visibility_km") is not None and air["visibility_km"] < 20:
|
||||
parts.append(f"가시거리 {air['visibility_km']:g}km")
|
||||
if air.get("humidity") is not None and air["humidity"] >= 70:
|
||||
parts.append(f"습도 {air['humidity']}%")
|
||||
return "공기가 뿌예 색이 흐려요" + (f" ({'·'.join(parts)})" if parts else "")
|
||||
|
||||
|
||||
def grade(value: int) -> SkyGrade:
|
||||
if value >= 80:
|
||||
return SkyGrade.RED
|
||||
|
||||
Reference in new issue
Block a user