46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// WeatherPoint represents weather conditions at a specific point in time
|
|
type WeatherPoint struct {
|
|
Time time.Time
|
|
WindSpeedMPH float64
|
|
WindDirection int // 0-359 degrees
|
|
WindGustMPH float64
|
|
}
|
|
|
|
// Thresholds defines the criteria for flyable conditions
|
|
type Thresholds struct {
|
|
SpeedMin float64 `json:"speedMin"` // default 7 mph
|
|
SpeedMax float64 `json:"speedMax"` // default 14 mph
|
|
DirCenter int `json:"dirCenter"` // default 270 (West)
|
|
DirRange int `json:"dirRange"` // default 15 degrees
|
|
}
|
|
|
|
// DefaultThresholds returns the default threshold values
|
|
func DefaultThresholds() Thresholds {
|
|
return Thresholds{
|
|
SpeedMin: 7,
|
|
SpeedMax: 14,
|
|
DirCenter: 270,
|
|
DirRange: 15,
|
|
}
|
|
}
|
|
|
|
// Assessment contains the analysis of weather conditions for paragliding
|
|
type Assessment struct {
|
|
Status string // "GOOD" or "BAD"
|
|
Reason string // explanation of the status
|
|
FlyableNow bool // whether conditions are currently flyable
|
|
BestWindow *FlyableWindow // the best flyable window (if any)
|
|
AllWindows []FlyableWindow // all flyable windows found
|
|
}
|
|
|
|
// FlyableWindow represents a continuous period of flyable conditions
|
|
type FlyableWindow struct {
|
|
Start time.Time
|
|
End time.Time
|
|
Duration time.Duration
|
|
}
|