Updated model and normalizers to map provider “feels like” fields into a single ApparentTemperatureC field.

This commit is contained in:
2026-01-17 10:36:19 -06:00
parent c12cf91115
commit b4a67e208c
8 changed files with 33 additions and 14 deletions

View File

@@ -80,6 +80,14 @@ func buildObservation(parsed nwsObservationResponse) (model.WeatherObservation,
// NWS observation responses typically do not include a day/night flag -> nil.
canonicalText := standards.WMOText(wmo, nil)
// Apparent temperature: prefer wind chill when both are supplied.
var apparentC *float64
if parsed.Properties.WindChill.Value != nil {
apparentC = parsed.Properties.WindChill.Value
} else if parsed.Properties.HeatIndex.Value != nil {
apparentC = parsed.Properties.HeatIndex.Value
}
obs := model.WeatherObservation{
StationID: parsed.Properties.StationID,
StationName: parsed.Properties.StationName,
@@ -108,8 +116,7 @@ func buildObservation(parsed nwsObservationResponse) (model.WeatherObservation,
VisibilityMeters: parsed.Properties.Visibility.Value,
RelativeHumidityPercent: parsed.Properties.RelativeHumidity.Value,
WindChillC: parsed.Properties.WindChill.Value,
HeatIndexC: parsed.Properties.HeatIndex.Value,
ApparentTemperatureC: apparentC,
ElevationMeters: parsed.Properties.Elevation.Value,
RawMessage: parsed.Properties.RawMessage,