feat: 피드 노을 카드도 결론·가장 붉을 때·쉬운 이유로, 노을 이유를 숫자 없는 쉬운 말로, 자세히에서 예보 모델 수 빼고 점수 뜻 설명, 노을 탭 오늘·주소 중복 칩 제거
This commit is contained in:
1 parent
c30fac20a6
commit
f5575711fe
10 files changed
+53
-42
No files matched your search
@@ -59,15 +59,17 @@ HAZY = 0.7 # 공기 보정이 이보다 작으면 결론을 한 단계 낮추
|
||||
|
||||
|
||||
def air_note(air: Optional[dict]) -> Optional[str]:
|
||||
"""공기 보정이 크게 깎였으면 그 이유 한 마디 (예: 공기가 뿌예 색이 흐려요 (가시거리 6.5km·습도 80%)). 아니면 None."""
|
||||
"""공기 보정이 크게 깎였으면 그 이유를 눈에 보이는 말로 (숫자 없이). 아니면 None.
|
||||
가시거리 20km 미만 = 먼 건물이 흐릿하게 보이는 정도, 습도 70% 이상 = 습한 공기."""
|
||||
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 "")
|
||||
hazy = air.get("visibility_km") is not None and air["visibility_km"] < 20
|
||||
humid = air.get("humidity") is not None and air["humidity"] >= 70
|
||||
if hazy and humid:
|
||||
return "먼 건물이 흐릿할 만큼 공기가 뿌옇고 습해서 노을 색이 바래 보일 거예요"
|
||||
if hazy:
|
||||
return "먼 건물이 흐릿할 만큼 공기가 뿌예서 노을 색이 바래 보일 거예요"
|
||||
return "공기가 습해서 노을 색이 바래 보일 거예요"
|
||||
|
||||
|
||||
def plain_line(situation: SkySituation | None, air: Optional[dict], kind: SkyType = SkyType.SUNSET) -> Optional[str]:
|
||||
@@ -83,8 +85,8 @@ def plain_line(situation: SkySituation | None, air: Optional[dict], kind: SkyTyp
|
||||
if air_note(air) is None:
|
||||
return base
|
||||
if situation is SkySituation.GLOW:
|
||||
return "구름은 좋은데 공기가 뿌예서 색이 흐릴 거예요"
|
||||
return f"{base}. 공기도 뿌예요" if base else "공기가 뿌예서 색이 흐릴 거예요"
|
||||
return "구름은 좋은데 공기가 뿌예서 색이 바랠 거예요"
|
||||
return f"{base}. 공기도 뿌예요" if base else "공기가 뿌예서 색이 바랠 거예요"
|
||||
|
||||
|
||||
def grade(value: int) -> SkyGrade:
|
||||
@@ -168,17 +170,17 @@ def reason(near20: Layers, far100: Layers, kind: SkyType = SkyType.SUNSET) -> st
|
||||
"""score() 가 깎는 순서대로 본다: 먼 쪽 빛이 막혔나 → 머리 위 낮은 구름 → 물들 중·높은 구름의 양."""
|
||||
side = "해 뜨는 쪽" if kind is SkyType.SUNRISE else "해 지는 쪽"
|
||||
if far100.low + 0.5 * far100.mid >= 60:
|
||||
return f"{side} 먼 하늘이 구름에 막혀 빛이 못 들어와요"
|
||||
return f"{side} 멀리까지 구름이 끼어 햇빛이 하늘을 물들이지 못해요"
|
||||
if near20.low >= 60:
|
||||
return "낮은 구름이 머리 위를 덮어 붉은빛을 가려요"
|
||||
return "낮게 깔린 구름이 하늘을 덮어 붉은빛을 가려요"
|
||||
canvas = round(max(near20.mid, near20.high))
|
||||
if canvas < 10:
|
||||
return "물들 구름이 거의 없어 하늘이 은은하게 끝나요"
|
||||
return "하늘에 구름이 거의 없어요. 노을은 구름에 햇빛이 비쳐야 붉어져서 은은하게 끝나요"
|
||||
if canvas > 85:
|
||||
return f"중·높은 구름이 {canvas}%로 두꺼워 빛이 덜 비쳐요"
|
||||
return "구름이 너무 두껍게 덮여 햇빛이 잘 안 비쳐요"
|
||||
if 25 <= canvas <= 75:
|
||||
return f"중·높은 구름이 {canvas}% 알맞게 깔리고 {side}이 트였어요"
|
||||
return f"물들 중·높은 구름이 {canvas}%로 {'적은' if canvas < 25 else '많은'} 편이에요"
|
||||
return f"{side} 하늘에 구름이 적당히 있어 햇빛을 받아 물들기 좋아요"
|
||||
return f"구름이 {'적은' if canvas < 25 else '많은'} 편이라 물드는 색이 약할 수 있어요"
|
||||
|
||||
|
||||
def sunrise_timeline(blue_at: datetime, peak_at: datetime | None, sun_at: datetime, golden_end_at: datetime) -> list[dict]:
|
||||
|
||||
Reference in new issue
Block a user