fix(weather): wind_d returns None when no valid samples, not fabricated 0.0° #1700
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#1700
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/weather-wind-d-allnone"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Проблема
weather_cache.py: при всехwinddirection_10m_dominant = null(или пустом списке) циркулярное среднее давалоatan2(0,0)=0.0→ фабриковало реальный 0° (север) вместо None.Решение
Фильтр None upfront (как для t_max/t_min/uv);
dominant_direction_deg: float|None; циркулярное среднее только при непустом списке; deg и label = None при отсутствии валидных сэмплов. Mixed null+valid работал и раньше (None уже фильтровались в суммах) — не тронут.Verify
ruffclean;pytest→ 70 passed, 1 skipped (+4 кейса all-None).When all winddirection_10m_dominant samples were None (or the key was absent), atan2(0, 0) produced 0.0° (due north) as a fabricated value. Root causes: 1. [None, None, ...] is truthy → entered circular-mean branch, but filtered sums x=y=0 → atan2(0,0)=0 → 0.0° 2. Empty list → else 0.0 branch → same fabrication Fix: filter None from wind_d before aggregation (consistent with t_max / t_min / uv). Only compute circular mean when at least one valid sample exists; otherwise dominant_direction_deg and dominant_direction_label are None. Adds TestWindDirectionAllNone covering all-None, missing key, valid samples sanity, and mixed None+valid cases.