Score the evening window from real sunset, not 8 pm local #12
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/time-of-day-sunset"
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?
What
classify_time_period/2keyed the morning on latitude/month sunrise but the evening on a hardcodedlocal >= 20, and its clause order meant any hour withd > 6before 20:00 scored 18 "Afternoon — full convective mixing". In December at 40°N the sun sets ~16:45 local, so 17:00–20:00 — the best radiation-inversion window of the day — was scored as peak convective mixing. (tmp/bugs.md§B, P1.)BandConfig.sunset_hour/2: same solar-declination + hour-angle formula assunrise_hour/2, mirrored about solar noon (12 + ha/15), clamped to[15.0, 20.0].Scorer.score_time_of_day/5threads the real sunset intoclassify_time_period/3: evening runs from local sunset for three hours, the daytime mixing clauses only apply before sunset, everything later stays night.rust/prop_grid_rs/src/{band_config,scorer}.rs— same clause order, scores and clamp.Resulting curve at 40°N: December (sunset 16.6) → 16:35–19:35 scores 72 evening (was 18 "afternoon"), then 55 night; June (sunset 19.4) → 19:25–22:25 evening.
Verification
mix test test/microwaveprop/propagation/→ 568 passed, 0 failures (the whole scorer blast radius).cargo clippy --all-targets -- -D warningsclean;cargo test --releasegreen, includingscorer_golden. The golden fixture regenerates byte-identical (no golden sample lands in the corrected window), so the new window is pinned by mirrored Elixir/Rust unit tests at identical inputs instead.mix credo --strict: no issues.mix format --check-formattedon the touched files: clean.Known follow-ups (not in this PR)
scripts/validate_algo.pyandscripts/validate_forecast.pystill re-implement the old month-only sunrise plus the fixed 8 pm evening window. The validator is fixed by the sibling PRfix/validator-production-parity;scripts/validate_forecast.pyand thealgo.mddescription of the old window are untouched.First review at
5e75fb4: no blocking findings.Checked and clean:
sunset_hour/2and the newclassify_time_period/3clause order are clause-for-clause identical betweenscorer.ex/band_config.exand the Rust mirror (same DOY table, same mirrored clamp, samelocal < sunsetguards, so the twotime_of_day_*suites assert the same values on both sides).Two things I verified rather than took on trust, both hold:
priv/rust_goldenconditions (06:15, 07:32, 14:32, 05:10, 11:48 local) all score in the part of the day this PR did not touch, so leavingscores.bincodeunregenerated is correct and the exact-matchscorer_goldengate stays green.scripts/validate_*.pyports, which the PR already lists as follow-ups.