Documentation
¶
Index ¶
- Constants
- func CheckBasicMETARSOA(soa BasicMETARSOA, orig []BasicMETAR) error
- func CheckSampleSetConversion(cell SampleSet, soa SampleSetSOA) error
- func DirSpeedToUV(dir, speed float32) (float32, float32)
- func FetchRadarImage(center math.Point2LL, radius float32, resolution int) (image.Image, math.Extent2D, error)
- func RadarImageToDBZ(img image.Image) []byte
- func UVToDirSpeed(u, v float32) (float32, float32)
- type BasicMETAR
- type BasicMETARSOA
- type MBLevelSOA
- type METAR
- type Sample
- type SampleSet
- type SampleSetSOA
- type WeatherModel
- type WeatherSample
- type WindLayer
- type WindSample
- type WindTreeNode
Constants ¶
View Source
const WindHeightOffset = 500
Variables ¶
This section is empty.
Functions ¶
func CheckBasicMETARSOA ¶
func CheckBasicMETARSOA(soa BasicMETARSOA, orig []BasicMETAR) error
func CheckSampleSetConversion ¶
func CheckSampleSetConversion(cell SampleSet, soa SampleSetSOA) error
func DirSpeedToUV ¶
func FetchRadarImage ¶
func RadarImageToDBZ ¶
func UVToDirSpeed ¶
Types ¶
type BasicMETAR ¶
type BasicMETAR struct {
ICAO string `json:"icaoId"`
ReportTime string `json:"reportTime"`
Temperature float32 `json:"temp"`
Altimeter float32 `json:"altim"`
WindDir any `json:"wdir"` // nil or string "VRB" for variable, else number for heading
WindSpeed int `json:"wspd"`
WindGust *int `json:"wgst"`
Raw string `json:"rawOb"`
}
This is as much of the METAR as we need at runtime.
func DecodeBasicMETARSOA ¶
func DecodeBasicMETARSOA(soa BasicMETARSOA) []BasicMETAR
type BasicMETARSOA ¶
type BasicMETARSOA struct {
// These are all delta coded
ReportTime [][]byte
Temperature []int16 // fixed point, one decimal digit
Altimeter []int16 // fixed point, one decimal digit
WindDir []int16
WindSpeed []int16
WindGust []int16
// This is not; it's not worth delta encoding the raw METAR reports
// since there's generally not much character alignment between
// successive reports.
Raw []string
}
Structure-of-arrays representation of an array of BasicMETAR objects for better compressability.
func MakeBasicMETARSOA ¶
func MakeBasicMETARSOA(recs []BasicMETAR) (BasicMETARSOA, error)
type MBLevelSOA ¶
type METAR ¶
type METAR struct {
ICAO string `json:"icaoId"`
ReportTime string `json:"reportTime"`
Temperature float32 `json:"temp"` // in Celcius
Dewpoint float32 `json:"dewp"` // in Celcius
Wind struct {
Variable bool
Direction float32 // Only set/valid if Variable is false.
Speed float32 `json:"wspd"` // Wind speed in knots
Gust float32 `json:"wgst"` // Wind gusts in knots
}
Altimeter float32 `json:"altim"` // in hPa
RawText string `json:"rawOb"` // Raw text of observation
Latitude float32 `json:"lat"`
Longitude float32 `json:"lon"`
// The JSON comes back sort of wonky; we decode into this but then
// clean it up into the Wind member above.
WindDirRaw any `json:"wdir"` // Wind direction in degrees or "VRB" for variable winds
}
func (METAR) Altimeter_inHg ¶
func (METAR) ShortString ¶
type SampleSet ¶
Lat-longs to stack of levels
func SampleSetSOAToAOS ¶
func SampleSetSOAToAOS(s SampleSetSOA) SampleSet
type SampleSetSOA ¶
type SampleSetSOA struct {
Lat, Long []float32
Levels []MBLevelSOA
}
func SampleSetToSOA ¶
func SampleSetToSOA(c SampleSet) (SampleSetSOA, error)
type WeatherModel ¶
type WeatherModel struct {
METAR map[string]*METAR
NmPerLongitude float32
MagneticVariation float32
WindRoot *WindTreeNode
StartTime time.Time
CurrentTime time.Time
GustStartTime time.Time
GustActiveDuration time.Duration
GustCalmDuration time.Duration
}
func MakeWeatherModel ¶
func (*WeatherModel) GetMETAR ¶
func (w *WeatherModel) GetMETAR(icao string) *METAR
func (*WeatherModel) LookupWX ¶
func (w *WeatherModel) LookupWX(p math.Point2LL, alt float32) WeatherSample
func (*WeatherModel) LookupWind ¶
func (w *WeatherModel) LookupWind(p math.Point2LL, alt float32) WindSample
func (*WeatherModel) UpdateTime ¶
func (w *WeatherModel) UpdateTime(t time.Time)
type WeatherSample ¶
type WeatherSample struct {
Altimeter float32
Temperature float32
Dewpoint float32
Wind WindSample
}
type WindLayer ¶
type WindLayer struct {
Altitude float32
Direction float32 // 0 -> variable
DirectionVector [2]float32 // normalized vector
Speed float32
Gust float32
}
func BlendWindLayers ¶
func ParseWindLayers ¶
func ParseWindLayers(str string, e *util.ErrorLogger) []WindLayer
ParseWindLayers parses a string of the form "alt/dir/spd,alt/dir/spd,..." and returns the corresponding WindLayer objects. Errors are logged to the provided ErrorLogger.
type WindSample ¶
type WindSample struct {
// Vector is the wind vector at the sample time, incorporating
// gusting, if relevant. Note that it corresponds to the wind's
// effect on an aircraft (e.g., if the wind heading is 090, the
// vector will be pointed in the -x direction.)
Vector [2]float32
Direction float32
Speed float32 // current speed in knots, including gusting.
Gust float32
}
type WindTreeNode ¶
type WindTreeNode struct {
Children [2]*WindTreeNode
Location math.Point2LL
SplitAxis int
Layers []WindLayer
}
Click to show internal directories.
Click to hide internal directories.