Removed detection for "thunder" as a special weather indicator
This commit is contained in:
@@ -47,13 +47,12 @@ type TimedValue struct {
|
||||
}
|
||||
|
||||
type Indicators struct {
|
||||
Thunder bool `json:"thunder,omitempty"`
|
||||
Snow bool `json:"snow,omitempty"`
|
||||
Ice bool `json:"ice,omitempty"`
|
||||
Fog bool `json:"fog,omitempty"`
|
||||
Heat bool `json:"heat,omitempty"`
|
||||
Cold bool `json:"cold,omitempty"`
|
||||
Wind bool `json:"wind,omitempty"`
|
||||
Snow bool `json:"snow,omitempty"`
|
||||
Ice bool `json:"ice,omitempty"`
|
||||
Fog bool `json:"fog,omitempty"`
|
||||
Heat bool `json:"heat,omitempty"`
|
||||
Cold bool `json:"cold,omitempty"`
|
||||
Wind bool `json:"wind,omitempty"`
|
||||
}
|
||||
|
||||
type AlertOverlap struct {
|
||||
@@ -291,11 +290,10 @@ func sortedKeys(values map[string]struct{}) []string {
|
||||
func indicatorsForText(text string) Indicators {
|
||||
lower := strings.ToLower(text)
|
||||
return Indicators{
|
||||
Thunder: strings.Contains(lower, "thunder") || strings.Contains(lower, "storm"),
|
||||
Snow: strings.Contains(lower, "snow"),
|
||||
Ice: strings.Contains(lower, "ice") || strings.Contains(lower, "freezing") || strings.Contains(lower, "sleet"),
|
||||
Fog: strings.Contains(lower, "fog"),
|
||||
Wind: strings.Contains(lower, "wind") || strings.Contains(lower, "gust"),
|
||||
Snow: strings.Contains(lower, "snow"),
|
||||
Ice: strings.Contains(lower, "ice") || strings.Contains(lower, "freezing") || strings.Contains(lower, "sleet"),
|
||||
Fog: strings.Contains(lower, "fog"),
|
||||
Wind: strings.Contains(lower, "wind") || strings.Contains(lower, "gust"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,13 +316,12 @@ func numericIndicators(period ForecastPeriod) Indicators {
|
||||
|
||||
func mergeIndicators(left Indicators, right Indicators) Indicators {
|
||||
return Indicators{
|
||||
Thunder: left.Thunder || right.Thunder,
|
||||
Snow: left.Snow || right.Snow,
|
||||
Ice: left.Ice || right.Ice,
|
||||
Fog: left.Fog || right.Fog,
|
||||
Heat: left.Heat || right.Heat,
|
||||
Cold: left.Cold || right.Cold,
|
||||
Wind: left.Wind || right.Wind,
|
||||
Snow: left.Snow || right.Snow,
|
||||
Ice: left.Ice || right.Ice,
|
||||
Fog: left.Fog || right.Fog,
|
||||
Heat: left.Heat || right.Heat,
|
||||
Cold: left.Cold || right.Cold,
|
||||
Wind: left.Wind || right.Wind,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@ func TestBuildDailySummaryGroupsDaypartsAndComputesMetrics(t *testing.T) {
|
||||
t.Fatalf("morning peak gust = %#v, want 40", morning.PeakWindGust)
|
||||
}
|
||||
if morning.DominantCondition != "Thunderstorms and gusty wind" {
|
||||
t.Fatalf("morning dominant = %q, want thunderstorm condition", morning.DominantCondition)
|
||||
t.Fatalf("morning dominant = %q, want raw forecast condition", morning.DominantCondition)
|
||||
}
|
||||
if !morning.Indicators.Thunder || !morning.Indicators.Wind {
|
||||
t.Fatalf("morning indicators = %#v, want thunder and wind", morning.Indicators)
|
||||
if !morning.Indicators.Wind {
|
||||
t.Fatalf("morning indicators = %#v, want wind", morning.Indicators)
|
||||
}
|
||||
|
||||
afternoon := summary.Dayparts[2]
|
||||
@@ -87,8 +87,8 @@ func TestBuildDailySummaryFromFixtureBundle(t *testing.T) {
|
||||
if len(summary.Dayparts) != 2 {
|
||||
t.Fatalf("Dayparts length = %d, want 2", len(summary.Dayparts))
|
||||
}
|
||||
if !summary.Dayparts[0].Indicators.Thunder {
|
||||
t.Fatalf("morning indicators = %#v, want thunder", summary.Dayparts[0].Indicators)
|
||||
if summary.Dayparts[0].DominantCondition != "Showers and thunderstorms" {
|
||||
t.Fatalf("morning dominant = %q, want raw forecast condition", summary.Dayparts[0].DominantCondition)
|
||||
}
|
||||
if len(summary.AlertOverlaps) != 1 {
|
||||
t.Fatalf("AlertOverlaps length = %d, want 1", len(summary.AlertOverlaps))
|
||||
|
||||
Reference in New Issue
Block a user