@@ -148,6 +148,10 @@ func processDailyForecast(ctx context.Context, lat, lon float64, units string) a
148148 if windSpeed == nil {
149149 windSpeed = dayParts .WindSpeed [i * 2 + 1 ]
150150 }
151+ windDirection := dayParts .WindDirectionCardinal [i * 2 ]
152+ if windDirection == nil {
153+ windDirection = dayParts .WindDirectionCardinal [i * 2 + 1 ]
154+ }
151155 response [day ] = map [string ]any {
152156 "high" : forecast .CalendarDayTemperatureMax [i ],
153157 "low" : forecast .CalendarDayTemperatureMin [i ],
@@ -157,10 +161,11 @@ func processDailyForecast(ctx context.Context, lat, lon float64, units string) a
157161 //"moonrise": forecast.MoonriseTimeLocal[i],
158162 //"moonset": forecast.MoonsetTimeLocal[i],
159163 //"moon_phase": forecast.MoonPhase[i],
160- "qpf" : forecast .Qpf [i ],
161- "qpf_snow" : forecast .QpfSnow [i ],
162- "uv_index" : uvIndex ,
163- "wind_speed" : windSpeed ,
164+ "qpf" : forecast .Qpf [i ],
165+ "qpf_snow" : forecast .QpfSnow [i ],
166+ "uv_index" : uvIndex ,
167+ "wind_speed" : windSpeed ,
168+ "wind_direction_cardinal" : windDirection ,
164169 }
165170 }
166171 response ["temperatureUnit" ] = forecast .TemperatureUnit
@@ -182,11 +187,12 @@ func processHourlyForecast(ctx context.Context, lat, lon float64, units string)
182187 }
183188
184189 entry := map [string ]any {
185- "time" : t [11 :16 ],
186- "temperature" : hourly .Temperature [i ],
187- "uv_index" : hourly .UVIndex [i ],
188- "description" : hourly .WxPhraseLong [i ],
189- "wind_speed" : hourly .WindSpeed [i ],
190+ "time" : t [11 :16 ],
191+ "temperature" : hourly .Temperature [i ],
192+ "uv_index" : hourly .UVIndex [i ],
193+ "description" : hourly .WxPhraseLong [i ],
194+ "wind_speed" : hourly .WindSpeed [i ],
195+ "wind_direction_cardinal" : hourly .WindDirectionCardinal [i ],
190196 }
191197 if hourly .PrecipChance [i ] > 20 {
192198 entry ["precip_chance" ] = fmt .Sprintf ("%d%%" , hourly .PrecipChance [i ])
0 commit comments