Clear invalid measurements
All checks were successful
Build and Publish / release (push) Successful in 3m34s
All checks were successful
Build and Publish / release (push) Successful in 3m34s
This commit is contained in:
parent
f2f160b112
commit
ce0ef7d291
@ -15,11 +15,21 @@ func (u *WeatherUpdate) Enrich(weatherStations ...*config.WeatherStation) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear invalid measurements
|
||||||
|
if u.BaromAbsoluteIn != nil && *u.BaromAbsoluteIn < 20 {
|
||||||
|
u.BaromAbsoluteIn = nil
|
||||||
|
}
|
||||||
|
if u.BaromRelativeIn != nil && *u.BaromRelativeIn < 20 {
|
||||||
|
u.BaromRelativeIn = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate Wind Chill
|
||||||
if u.WindChillF == nil && u.TempOutdoorF != nil && u.WindSpeedMPH != nil {
|
if u.WindChillF == nil && u.TempOutdoorF != nil && u.WindSpeedMPH != nil {
|
||||||
wc := CalculateWindChill(*u.TempOutdoorF, *u.WindSpeedMPH)
|
wc := CalculateWindChill(*u.TempOutdoorF, *u.WindSpeedMPH)
|
||||||
u.WindChillF = &wc
|
u.WindChillF = &wc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculate Dew Point
|
||||||
if u.DewPointF == nil && (u.TempOutdoorF != nil && u.HumidityOudoor != nil) {
|
if u.DewPointF == nil && (u.TempOutdoorF != nil && u.HumidityOudoor != nil) {
|
||||||
if *u.TempOutdoorF != 0 || *u.HumidityOudoor != 0 {
|
if *u.TempOutdoorF != 0 || *u.HumidityOudoor != 0 {
|
||||||
dp := CalculateDewPoint(*u.TempOutdoorF, float64(*u.HumidityOudoor))
|
dp := CalculateDewPoint(*u.TempOutdoorF, float64(*u.HumidityOudoor))
|
||||||
@ -27,6 +37,7 @@ func (u *WeatherUpdate) Enrich(weatherStations ...*config.WeatherStation) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use relative pressure if absolute isn't provided
|
||||||
if u.BaromAbsoluteIn == nil && u.BaromRelativeIn != nil {
|
if u.BaromAbsoluteIn == nil && u.BaromRelativeIn != nil {
|
||||||
u.BaromAbsoluteIn = u.BaromRelativeIn
|
u.BaromAbsoluteIn = u.BaromRelativeIn
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user