radar

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const NumWxLevels = 6

Variables

This section is empty.

Functions

Types

type Brightness

type Brightness int

func (Brightness) ScaleRGB

func (b Brightness) ScaleRGB(r renderer.RGB) renderer.RGB

type ScopeTransformations

type ScopeTransformations struct {
	// contains filtered or unexported fields
}

func GetScopeTransformations

func GetScopeTransformations(paneExtent math.Extent2D, magneticVariation float32, nmPerLongitude float32,
	center math.Point2LL, rangenm float32, rotationAngle float32) ScopeTransformations

GetScopeTransformations returns a ScopeTransformations object corresponding to the specified radar scope center, range, and rotation angle.

func (*ScopeTransformations) LatLongFromWindowP

func (st *ScopeTransformations) LatLongFromWindowP(p [2]float32) math.Point2LL

LatLongFromWindowP transforms a point p in window coordinates to latitude-longitude.

func (*ScopeTransformations) LatLongFromWindowV

func (st *ScopeTransformations) LatLongFromWindowV(v [2]float32) math.Point2LL

LatLongFromWindowV transforms a vector in window coordinates to a vector in latitude-longitude coordinates.

func (*ScopeTransformations) LoadLatLongViewingMatrices

func (st *ScopeTransformations) LoadLatLongViewingMatrices(cb *renderer.CommandBuffer)

LoadLatLongViewingMatrices adds commands to the provided command buffer to load viewing matrices so that latitude-longiture positions can be provided for subsequent vertices.

func (*ScopeTransformations) LoadWindowViewingMatrices

func (st *ScopeTransformations) LoadWindowViewingMatrices(cb *renderer.CommandBuffer)

LoadWindowViewingMatrices adds commands to the provided command buffer to load viewing matrices so that window-coordinate positions can be provided for subsequent vertices.

func (*ScopeTransformations) NormalizedFromWindowP

func (st *ScopeTransformations) NormalizedFromWindowP(p [2]float32) [2]float32

NormalizedFromWindowP transforms a point p in window coordinates to normalized [0,1]^2 coordinates.

func (*ScopeTransformations) PixelDistanceNM

func (st *ScopeTransformations) PixelDistanceNM(nmPerLongitude float32) float32

PixelDistanceNM returns the space between adjacent pixels expressed in nautical miles.

func (*ScopeTransformations) WindowFromLatLongP

func (st *ScopeTransformations) WindowFromLatLongP(p math.Point2LL) [2]float32

WindowFromLatLongP transforms a point given in latitude-longitude coordinates to window coordinates, snapped to a pixel center.

type WeatherRadar

type WeatherRadar struct {
	// contains filtered or unexported fields
}

WeatherRadar provides functionality for fetching precipitation data from the server and displaying it in radar scopes.

func (*WeatherRadar) Draw

func (w *WeatherRadar) Draw(ctx *panes.Context, hist int, intensity float32,
	wxColors [NumWxLevels]renderer.RGB, wxStippleColor renderer.RGB, wxLevelStipple [NumWxLevels]int,
	active [NumWxLevels]bool, transforms ScopeTransformations, cb *renderer.CommandBuffer)

Draw draws the current weather radar data, if available.

func (*WeatherRadar) HaveWeather

func (w *WeatherRadar) HaveWeather() [NumWxLevels]bool

func (*WeatherRadar) LatestPrecip added in v0.14.6

func (w *WeatherRadar) LatestPrecip(ctx *panes.Context) (*wx.Precip, int)

LatestPrecip advances the fetch state machine and returns the most recent decoded precipitation blob (may be nil) along with a generation counter that bumps each time the blob changes. Callers that build their own command buffers should rebuild only when the counter changes.

func (*WeatherRadar) Reset added in v0.15.0

func (w *WeatherRadar) Reset(lg *log.Logger)

Reset clears all cached weather state so that the next tick starts fetching fresh data. It must be called when a new sim is loaded, since nextFetchTime is anchored to the previous sim's calendar date and the cached command buffers belong to the previous sim's weather.

type WxScheme added in v0.14.6

type WxScheme struct {
	// Thresholds is an ascending list of dBZ values; a sample whose dBZ
	// exceeds Thresholds[i] but not Thresholds[i+1] maps to level i+1.
	Thresholds []byte
}

WxScheme captures how a scope bins NEXRAD dBZ samples into discrete display levels. Scopes (STARS, ERAM, ...) supply their own scheme and use MakeCommandBuffers to turn raw precip data into per-level command buffers.

func (WxScheme) LevelForDBZ added in v0.14.6

func (s WxScheme) LevelForDBZ(dbz byte) int

func (WxScheme) MakeCommandBuffers added in v0.14.6

func (s WxScheme) MakeCommandBuffers(precip *wx.Precip) []*renderer.CommandBuffer

MakeCommandBuffers walks the precip grid once per level, merging horizontal runs of same-level cells into single quads, and returns one CommandBuffer per level (nil entries for empty levels).

func (WxScheme) NumLevels added in v0.14.6

func (s WxScheme) NumLevels() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL