feat: 지금 날씨 점수를 평균 60 정규분포로 (가장 낮은 요소로 깎기 제거, 구간별 바꾸기 표, 90점 이상 약 2.4%)

- 지금 날씨 점수는 '가장 낮은 요소로 깎기'를 하지 않는다 (밤엔 해 난 비율이 늘 0점이라 밤 점수가 62점을 못 넘었음). 각 점수는 그대로
- 원래 점수를 구간(아침·낮·저녁·밤)마다 1년 치 분포의 순위로 보고 평균 60·표준편차 15 정규분포 점수로 바꿔 보여 준다
- 바꾸기 표는 scripts/gen_weather_score_table.py 가 Open-Meteo 과거 예보로 만든다 (weather_score_table.json)
This commit is contained in:
skkim committed 2026-10-22 13:33:50 +09:00
1 parent 61fefd200a
commit 3b5afba8a1
6 files changed
+655 -8

No files matched your search

+8 -4
View File
@@ -296,9 +296,13 @@ def _summary(hours: list[Hour]) -> str:
return f"{hour_label(mid.hour % 24)} {round(mid.feels_c)}°, {tag}"
def _weighted(factors: dict[str, int], weights: dict[str, int]) -> int:
def _weighted(factors: dict[str, int], weights: dict[str, int], worst_pull: bool = True) -> int:
"""비중대로 섞고, worst_pull 이면 가장 낮은 요소로 최대 25% 깎는다 (지금 날씨 점수는 깎지 않는다)."""
mixed = sum(factors[a] * weights[a] for a in AXES) / 100
if not worst_pull:
return round(mixed)
worst = min((factors[a] for a in AXES if weights[a]), default=100)
return round(sum(factors[a] * weights[a] for a in AXES) / 100 * (1 - _WORST_PULL + _WORST_PULL * worst / 100))
return round(mixed * (1 - _WORST_PULL + _WORST_PULL * worst / 100))
def _until(definition) -> str:
@@ -338,7 +342,7 @@ def evaluate(definition, windows: list[list[Hour]], ctx: Context) -> Optional[Re
}
factors = {a: v for a, (v, _) in scored.items()}
notes = {a: n for a, (_, n) in scored.items()}
score = _weighted(factors, weights)
score = _weighted(factors, weights, getattr(definition, "worst_pull", True))
agg = {
"rain_prob": max_prob, "wind_ms": max(winds) if winds else None, "pm25": ctx.pm25,
"feels_c": (min(h.feels_c for h in hours), max(h.feels_c for h in hours)),
@@ -395,7 +399,7 @@ def estimate(definition, fc: DayForecast, windows: list[list[int]], ctx: Context
}
factors = {a: v for a, (v, _) in scored.items()}
notes = {a: n for a, (_, n) in scored.items()}
score = _weighted(factors, weights)
score = _weighted(factors, weights, getattr(definition, "worst_pull", True))
# 중기예보엔 눈 여부가 없어서, 눈이 와야 하는 각은 0점으로 둔다
# 하루 예보로는 비가 언제 그치는지 몰라 '앞서 비 옴'은 없는 것으로 본다
known = {"rain_prob": max_prob, "snow": "no", "rain_before": "no"}
@@ -0,0 +1,428 @@
{
"about": "지금 날씨 점수 바꾸기 표: 원래 점수 0~100 → 표시 점수. 평균 60·표준편차 15. scripts/gen_weather_score_table.py 가 만든다",
"period": [
"2025-10-21",
"2026-10-20"
],
"regions": 32,
"samples": {
"morning": 11680,
"day": 11680,
"evening": 11680,
"night": 11680
},
"slots": {
"morning": [
1,
1,
1,
1,
1,
1,
1,
4,
5,
5,
9,
11,
14,
16,
17,
18,
20,
21,
23,
25,
26,
28,
29,
31,
31,
32,
33,
33,
34,
34,
35,
35,
35,
36,
37,
37,
38,
38,
39,
40,
41,
42,
43,
44,
45,
46,
46,
47,
48,
49,
50,
51,
53,
54,
55,
57,
59,
61,
62,
63,
64,
64,
65,
65,
66,
66,
67,
67,
68,
68,
69,
69,
70,
71,
71,
72,
73,
73,
74,
74,
75,
76,
77,
78,
79,
80,
82,
83,
85,
88,
90,
93,
96,
99,
100,
100,
100,
100,
100,
100,
100
],
"day": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
4,
6,
9,
12,
15,
19,
22,
24,
26,
27,
28,
29,
30,
31,
31,
32,
32,
33,
33,
34,
35,
36,
37,
37,
38,
39,
40,
41,
41,
42,
42,
43,
43,
44,
44,
45,
45,
46,
46,
47,
47,
47,
48,
48,
48,
49,
49,
50,
50,
51,
52,
54,
56,
59,
61,
62,
63,
63,
64,
64,
64,
65,
65,
66,
66,
66,
67,
67,
68,
68,
69,
70,
71,
72,
73,
74,
76,
77,
79,
81,
83,
85,
87,
91,
97,
100,
100
],
"evening": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
7,
11,
14,
17,
20,
23,
25,
27,
28,
29,
30,
31,
32,
32,
33,
34,
34,
35,
36,
37,
38,
38,
39,
39,
40,
40,
41,
41,
42,
42,
43,
43,
44,
45,
45,
46,
46,
47,
47,
48,
48,
48,
49,
50,
50,
51,
52,
53,
55,
56,
59,
60,
62,
63,
63,
64,
64,
65,
65,
66,
66,
67,
67,
68,
69,
69,
70,
71,
72,
72,
74,
75,
76,
78,
79,
81,
84,
86,
89,
92,
96,
100,
100,
100,
100
],
"night": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
4,
7,
10,
11,
13,
15,
17,
20,
22,
26,
28,
30,
32,
33,
34,
34,
35,
35,
35,
36,
36,
37,
38,
38,
39,
40,
41,
41,
42,
43,
44,
45,
47,
48,
49,
50,
52,
53,
55,
57,
59,
62,
63,
65,
65,
66,
66,
66,
67,
68,
68,
69,
69,
70,
70,
71,
71,
72,
73,
74,
74,
75,
77,
78,
80,
82,
85,
88,
92,
96,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100
]
}
}