summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--weather/weather.go8
1 files changed, 8 insertions, 0 deletions
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.