import math from typing import Optional def wet_bulb_c(temp_c: float, humidity: float) -> float: """Stull(2011) 습구온도 근사식.""" t, rh = temp_c, humidity return ( t * math.atan(0.151977 * math.sqrt(rh + 8.313659)) + math.atan(t + rh) - math.atan(rh - 1.676331) + 0.00391838 * rh ** 1.5 * math.atan(0.023101 * rh) - 4.686035 ) def feels_like_c(temp_c: float, humidity: float, wind_ms: Optional[float], month: int) -> float: """기상청 체감온도: 5~9월은 여름식(습도), 10~4월은 겨울식(바람).""" if 5 <= month <= 9: tw = wet_bulb_c(temp_c, humidity) return round(-0.2442 + 0.55399 * tw + 0.45535 * temp_c - 0.0022 * tw ** 2 + 0.00278 * tw * temp_c + 3.0, 1) v = (wind_ms or 0.0) * 3.6 if temp_c > 10 or v < 4.8: return round(temp_c, 1) return round(13.12 + 0.6215 * temp_c - 11.37 * v ** 0.16 + 0.3965 * temp_c * v ** 0.16, 1) def discomfort_index(temp_c: float, humidity: float) -> int: return round(0.81 * temp_c + 0.01 * humidity * (0.99 * temp_c - 14.3) + 46.3)