summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weather.go56
1 files changed, 28 insertions, 28 deletions
diff --git a/weather.go b/weather.go
index 996b3e4..ca7fe12 100644
--- a/weather.go
+++ b/weather.go
@@ -139,20 +139,20 @@ var TypeDescription = map[int]string{
// Our prefered struct
type Weather struct {
- airquality int
- date string
- feelsliketemp float64
- humidity int
- maxuv int
- precipitation int
- pressure int
- temperature float64
- time string
- visibility int
- weathertype int
- winddir string
- windgust float64
- windspeed float64
+ airquality int
+ date string
+ feelsliketempDegC float64
+ humidity int
+ maxuv int
+ precipitationPerc int
+ pressure int
+ temperatureDegC float64
+ time string
+ visibilityMetres int
+ weathertype int
+ winddir string
+ windgustMph float64
+ windspeedMph float64
}
var (
@@ -173,16 +173,16 @@ func processBBC(b []byte) []Weather {
for _, report := range f.Detailed.Reports {
w.date = report.LocalDate
w.time = report.Timeslot
- w.feelsliketemp = float64(report.FeelsLikeTemperatureC)
+ w.feelsliketempDegC = float64(report.FeelsLikeTemperatureC)
w.humidity = report.Humidity
- w.temperature = float64(report.TemperatureC)
- w.precipitation = report.PrecipitationProbabilityInPercent
+ w.temperatureDegC = float64(report.TemperatureC)
+ w.precipitationPerc = report.PrecipitationProbabilityInPercent
w.pressure = report.Pressure
- w.visibility = estimateVisibility(report.Visibility)
+ w.visibilityMetres = estimateVisibility(report.Visibility)
w.weathertype = report.WeatherType
w.winddir = report.WindDirectionFull
- w.windgust = float64(report.GustSpeedMph)
- w.windspeed = float64(report.WindSpeedMph)
+ w.windgustMph = float64(report.GustSpeedMph)
+ w.windspeedMph = float64(report.WindSpeedMph)
weather = append(weather, w)
}
}
@@ -208,17 +208,17 @@ func parseMetWeather(wp WeatherParams) Weather {
var w Weather
w.airquality = wp.AQIndex
- w.feelsliketemp = wp.F
+ w.feelsliketempDegC = wp.F
w.humidity = wp.H
w.pressure = wp.P
- w.precipitation = wp.PP
- w.temperature = wp.T
+ w.precipitationPerc = wp.PP
+ w.temperatureDegC = wp.T
w.maxuv = wp.UV
- w.visibility = wp.V
+ w.visibilityMetres = wp.V
w.weathertype = wp.WT
w.winddir = wp.WD
- w.windgust = wp.WG
- w.windspeed = wp.WS * mpsToMphMultiplier
+ w.windgustMph = wp.WG
+ w.windspeedMph = wp.WS * mpsToMphMultiplier
return w
}
@@ -302,8 +302,8 @@ func main() {
if !ok {
desc = fmt.Sprintf("%d", w.weathertype)
}
- fmt.Printf("%18s, Temp: %4.1f°C, ", desc, w.temperature)
- fmt.Printf("Rain: %2d%%, Wind: %4.1fmph\n", w.precipitation, w.windspeed)
+ fmt.Printf("%18s, Temp: %4.1f°C, ", desc, w.temperatureDegC)
+ fmt.Printf("Rain: %2d%%, Wind: %4.1fmph\n", w.precipitationPerc, w.windspeedMph)
if *verbose {
fmt.Printf("%+v\n\n", w)
}