Compare commits

..

No commits in common. "e0438ac8f98347c7838c97843915817bb621cf02" and "72d81959438aca7f020586aff69bda08d4a59f53" have entirely different histories.

2 changed files with 3 additions and 39 deletions

View file

@ -22,13 +22,8 @@ def knots(ms: float) -> float:
class Hodograph():
def __init__(self, width, height):
self.zoom = 1.2
self.offset_x = 0.1 # Percentage of the upper left quadrant rendered
self.offset_y = 0.9 # Percentage of the upper right quadrant rendered
self.min_x = 0
self.min_y = 0
self.max_x = 0
self.max_y = 0
self.offset_x = 0.1
self.offset_y = 0.9
self.width = min(width, height)
self.height = min(width, height)
@ -50,32 +45,6 @@ class Hodograph():
self.offset_y * self.height + gy
)
def find_extents(self, sounding: Sounding):
"""
Determine the boundaries of the sounding to set the center and zoom
appropriately.
"""
for sample in sounding.samples:
x, y = self.sample_to_graph(sample.wind_speed, sample.wind_dir)
if self.min_x > x:
self.min_x = x
if self.min_y > y:
self.min_y = y
if self.max_x < x:
self.max_x = x
if self.max_y < y:
self.max_y = y
self.offset_x = self.min_x / self.radius + 0.1
self.offset_y = (self.radius - self.max_y) / self.radius
self.zoom = min(self.width, self.height) / max(self.max_x - self.min_x,
self.max_y - self.min_y) / 2
self.radius = min(self.width, self.height) * self.zoom
def draw_speed_lines(self, cr: cairo.Context, x, y):
cr.save()
@ -230,8 +199,6 @@ class Hodograph():
offset += interval
def draw(self, cr: cairo.Context, x, y, sounding: Sounding):
self.find_extents(sounding)
cr.rectangle(x, y, self.width, self.height)
cr.clip()

View file

@ -10,9 +10,6 @@ from xmet.sounding import Sounding, SoundingSample
CHUNK_SEP = "\x01"
CHUNK_STRIP_CHARS = "\x01\x03\x0a\x20"
def meters_second(knots: float) -> float:
return knots / 1.944
class RAOBReaderException(Exception):
...
@ -95,7 +92,7 @@ class RAOBObs():
return {
'dir': wind_dir,
'speed': meters_second(wind_speed)
'speed': wind_speed
}
TTAA_PRESSURES = {