Add an hourly forecast module and adjust the daily summary for consistency
This commit is contained in:
@@ -85,10 +85,7 @@ func derivedDailySummaryValue(summary forecast.DailySummary, timing forecast.Pre
|
||||
if maxGust != nil {
|
||||
value.MaxWindGustMph = roundedInt(&maxGust.Value)
|
||||
}
|
||||
value.DominantConditions = narrativeConditions(summary.NarrativePeriods)
|
||||
if len(value.DominantConditions) == 0 {
|
||||
value.DominantConditions = sortedSet(conditions)
|
||||
}
|
||||
value.DominantConditions = sortedSet(conditions)
|
||||
value.Hazards = sortedSet(hazards)
|
||||
return value, nil
|
||||
}
|
||||
@@ -144,22 +141,6 @@ func narrativeMaxPrecipitation(periods []weatherdata.ForecastPeriod) *forecast.T
|
||||
return maxPop
|
||||
}
|
||||
|
||||
func narrativeConditions(periods []weatherdata.ForecastPeriod) []string {
|
||||
seen := map[string]struct{}{}
|
||||
var out []string
|
||||
for _, period := range periods {
|
||||
if period.TextDescription == "" {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[period.TextDescription]; ok {
|
||||
continue
|
||||
}
|
||||
seen[period.TextDescription] = struct{}{}
|
||||
out = append(out, period.TextDescription)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func mostLikelyPrecipitationHour(maxPop *forecast.TimedValue, timezone string) string {
|
||||
if maxPop == nil || maxPop.Value <= 0 {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user