Updated model and normalizers to map provider “feels like” fields into a single ApparentTemperatureC field.
This commit is contained in:
@@ -68,6 +68,11 @@ func buildObservation(parsed owmResponse) (model.WeatherObservation, time.Time,
|
||||
// - wind speed is m/s -> km/h conversion
|
||||
tempC := parsed.Main.Temp
|
||||
rh := parsed.Main.Humidity
|
||||
var apparentC *float64
|
||||
if parsed.Main.FeelsLike != nil {
|
||||
v := *parsed.Main.FeelsLike
|
||||
apparentC = &v
|
||||
}
|
||||
|
||||
surfacePa := normcommon.PressurePaFromHPa(parsed.Main.Pressure)
|
||||
var seaLevelPa *float64
|
||||
@@ -117,6 +122,7 @@ func buildObservation(parsed owmResponse) (model.WeatherObservation, time.Time,
|
||||
IconURL: iconURL,
|
||||
|
||||
TemperatureC: &tempC,
|
||||
ApparentTemperatureC: apparentC,
|
||||
|
||||
WindDirectionDegrees: parsed.Wind.Deg,
|
||||
WindSpeedKmh: &wsKmh,
|
||||
|
||||
@@ -15,10 +15,11 @@ type owmResponse struct {
|
||||
Weather []owmWeather `json:"weather"`
|
||||
|
||||
Main struct {
|
||||
Temp float64 `json:"temp"` // °C when units=metric (enforced by source)
|
||||
Pressure float64 `json:"pressure"` // hPa
|
||||
Humidity float64 `json:"humidity"` // %
|
||||
SeaLevel *float64 `json:"sea_level"`
|
||||
Temp float64 `json:"temp"` // °C when units=metric (enforced by source)
|
||||
FeelsLike *float64 `json:"feels_like"` // °C when units=metric (enforced by source)
|
||||
Pressure float64 `json:"pressure"` // hPa
|
||||
Humidity float64 `json:"humidity"` // %
|
||||
SeaLevel *float64 `json:"sea_level"`
|
||||
} `json:"main"`
|
||||
|
||||
Visibility *float64 `json:"visibility"` // meters (optional)
|
||||
|
||||
Reference in New Issue
Block a user