Compare commits
3 commits
eee4c781cc
...
e5b95b3079
Author | SHA1 | Date | |
---|---|---|---|
e5b95b3079 | |||
606dda3c14 | |||
66392f0612 |
2 changed files with 13 additions and 1 deletions
|
@ -33,6 +33,9 @@ class Hodograph():
|
||||||
box_height = max_y - min_y
|
box_height = max_y - min_y
|
||||||
box = max(box_width, box_height) * 1.5
|
box = max(box_width, box_height) * 1.5
|
||||||
|
|
||||||
|
if box == 0:
|
||||||
|
box = 1.5
|
||||||
|
|
||||||
#
|
#
|
||||||
# Ensure the data points are centered within the hodograph
|
# Ensure the data points are centered within the hodograph
|
||||||
# viewbox.
|
# viewbox.
|
||||||
|
@ -286,7 +289,11 @@ class Hodograph():
|
||||||
cr.rectangle(offset + x, y + width * 1.5, width, width)
|
cr.rectangle(offset + x, y + width * 1.5, width, width)
|
||||||
cr.stroke()
|
cr.stroke()
|
||||||
|
|
||||||
text = "%dm" % (height) if height < 1000 else "%dkm" % (height /1000)
|
if height < 1000:
|
||||||
|
text = "%dm" % (height)
|
||||||
|
else:
|
||||||
|
text = "%dkm" % (int(height / 1000.0))
|
||||||
|
|
||||||
extents = cr.text_extents(text)
|
extents = cr.text_extents(text)
|
||||||
|
|
||||||
cr.move_to(offset + x - extents.width / 4, y + 3.5*width)
|
cr.move_to(offset + x - extents.width / 4, y + 3.5*width)
|
||||||
|
|
|
@ -285,6 +285,11 @@ class Sounding(DatabaseTable):
|
||||||
|
|
||||||
return wind_speed_dir(shear_u / levels, shear_v / levels)
|
return wind_speed_dir(shear_u / levels, shear_v / levels)
|
||||||
|
|
||||||
|
def hodograph_samples(self) -> list[SoundingSample]:
|
||||||
|
samples = filter(lambda s: s.height is not None, self.samples)
|
||||||
|
|
||||||
|
return sorted(samples, key=lambda s: s.height)
|
||||||
|
|
||||||
def between(n, a, b):
|
def between(n, a, b):
|
||||||
return n > a and n < b
|
return n > a and n < b
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue