From bfb2a5d84671e05b05912ac1c15d347ba816592b Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Sun, 7 Aug 2022 15:15:30 -0400 Subject: weather: update `NewWeather` Add humidity. --- weather/weather.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/weather/weather.go b/weather/weather.go index 3a2f9f8..e72b601 100644 --- a/weather/weather.go +++ b/weather/weather.go @@ -31,6 +31,7 @@ type WeatherNow struct { Forecast string WindSpeed string WindDirection string + Humidity int } type WeatherPeriod struct { @@ -58,6 +59,12 @@ func NewWeather(lat, lng float32) (*Weather, error, int) { return nil, nwsErr, nwsErr.Status } + // Get humidity from the grid data. + h, err := humidity(fBundle.ForecastGrid) + if err != nil { + return nil, err, 500 + } + w := new(Weather) w.Location = fmt.Sprintf("%s, %s", strings.ToLower(fBundle.Point.Properties.RelativeLocation.Properties.City), @@ -71,6 +78,7 @@ func NewWeather(lat, lng float32) (*Weather, error, int) { Forecast: fBundle.ForecastHourly.Properties.Periods[0].ShortForecast, WindSpeed: fBundle.ForecastHourly.Properties.Periods[0].WindSpeed, WindDirection: fBundle.ForecastHourly.Properties.Periods[0].WindDirection, + Humidity: h, } // Build Q2H timeline for the 12 hours. -- cgit v1.2.3