forked from gsn/predictor
21 lines
591 B
Go
21 lines
591 B
Go
package prediction
|
|
|
|
import "sync/atomic"
|
|
|
|
// Warnings tracks warning conditions during a prediction run.
|
|
type Warnings struct {
|
|
AltitudeTooHigh atomic.Int64
|
|
}
|
|
|
|
// ToMap returns warnings as a map suitable for JSON serialization.
|
|
// Only includes warnings that have fired.
|
|
func (w *Warnings) ToMap() map[string]any {
|
|
result := make(map[string]any)
|
|
if n := w.AltitudeTooHigh.Load(); n > 0 {
|
|
result["altitude_too_high"] = map[string]any{
|
|
"count": n,
|
|
"description": "The altitude went too high, above the max forecast wind. Wind data will be unreliable",
|
|
}
|
|
}
|
|
return result
|
|
}
|