fix: 각 정의 검토 반영 — 지금 비 오면 바깥 각 상한(비 소식 조건), 습도 상한, 시간대가 구간과 2시간 이상 겹쳐야 구간 점수, 뜨아·환기·김서림·화장붕괴·냉면·택시·배달·야구·사진·공부·넷플릭스·군밤·연날리기·이불빨래·실내건조·귤·군고구마·붕어빵·눈사람·빙수·캠핑·단풍·해돋이 비중·조건 조정, 새 각 우산·파전·감성노래

This commit is contained in:
minaChoi committed 2026-10-13 09:44:22 +09:00
1 parent c0ba463e54
commit d020d27715
7 files changed
+505 -76

No files matched your search

+6 -3
View File
@@ -229,7 +229,7 @@ def axis_label(axis: str, rules: dict) -> str:
rule = rules.get("air", _AIR_RULE)
return "공기 탁함" if rule["full"] > rule["zero"] else "공기 맑음"
table = {"temp": _TEMP_LABEL, "wind": _WIND_LABEL, "humidity": _HUMIDITY_LABEL, "time": _TIME_LABEL}[axis]
return table[rules[axis]["type"]]
return rules[axis].get("label") or table[rules[axis]["type"]]
def _zero(rules: list[dict], agg: dict) -> tuple[Optional[str], Optional[int]]:
@@ -249,9 +249,9 @@ def _zero(rules: list[dict], agg: dict) -> tuple[Optional[str], Optional[int]]:
_FIELD_TEXT = {
"rain_prob": "비 확률", "wind_ms": "바람", "feels_c": "체감", "pm25": "초미세먼지", "cloudy_ratio": "흐린 하늘",
"gust_ms": "돌풍", "ground_c": "지표면 온도",
"gust_ms": "돌풍", "ground_c": "지표면 온도", "humidity": "습도",
}
_UNIT = {"rain_prob": "%", "wind_ms": "m/s", "feels_c": "°", "pm25": "㎍/㎥", "cloudy_ratio": "%", "gust_ms": "m/s", "ground_c": "°"}
_UNIT = {"rain_prob": "%", "wind_ms": "m/s", "feels_c": "°", "pm25": "㎍/㎥", "cloudy_ratio": "%", "gust_ms": "m/s", "ground_c": "°", "humidity": "%"}
def _cond(r: dict) -> tuple[str, str, str]:
@@ -260,6 +260,8 @@ def _cond(r: dict) -> tuple[str, str, str]:
return "강풍 특보가 있어", "강풍 특보가 있거나", "강풍 특보가 있으면"
if r["field"] == "snow":
return "눈 소식이 없어", "눈 소식이 없거나", "눈 소식이 없으면"
if r["field"] == "rain":
return "비 소식이 있어", "비 소식이 있거나", "비 소식이 있으면"
base = f"{_FIELD_TEXT[r['field']]} {r['value']}{_UNIT[r['field']]} {'이상' if r['op'] == '>=' else '미만'}"
return f"{base}이라", f"{base}이거나", f"{base}이면"
@@ -341,6 +343,7 @@ def evaluate(definition, windows: list[list[Hour]], ctx: Context) -> Optional[Re
"warning": "wind" if ctx.wind_warning else None,
"gust_ms": max(gusts, default=None), "ground_c": max(grounds, default=None),
"snow": "yes" if any(h.rain_type in (RainType.SNOW, RainType.SLEET) for h in hours) else "no",
"rain": "yes" if raining else "no", "humidity": round(mean(h.humidity for h in hours)),
}
reason, cap = _zero(definition.zero_rules, agg)
if reason is not None: