Update wind direction and precipitation window presentation

This commit is contained in:
2026-06-10 09:24:06 -05:00
parent c3da3af2f4
commit d1d0df11a8
10 changed files with 284 additions and 45 deletions

View File

@@ -2,6 +2,7 @@ package briefing
import (
"fmt"
"math"
"time"
"gitea.maximumdirect.net/eric/weatherreporter/internal/forecast"
@@ -46,6 +47,19 @@ func roundedInt(value *float64) *int {
return &rounded
}
func windDirectionLabel(degrees *float64) string {
if degrees == nil {
return ""
}
labels := []string{"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"}
normalized := math.Mod(*degrees, 360)
if normalized < 0 {
normalized += 360
}
sector := int(math.Floor((normalized+11.25)/22.5)) % len(labels)
return labels[sector]
}
func timedClockLabel(value *forecast.TimedValue, timezone string) string {
if value == nil {
return ""