aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-12-10 20:58:13 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-12-10 20:58:13 +0100
commit29e7ceac17cdfb2cdbf5593688eda2993a25e06f (patch)
treeb677c52cf070c6338fd6a665774b40fa0b58a970
parent3e90b2896ff8cd50c3a62169d6e7a15c56eee46a (diff)
downloadmeteo_toolbox-29e7ceac17cdfb2cdbf5593688eda2993a25e06f.tar.gz
add max barbs
-rw-r--r--skewt.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/skewt.py b/skewt.py
index 702e649..e674d09 100644
--- a/skewt.py
+++ b/skewt.py
@@ -9,13 +9,15 @@ from metpy.plots import add_metpy_logo, Hodograph, SkewT
from metpy.units import units
class Skewt:
- def __init__(self, p, T, Td, title=None):
+ def __init__(self, p, T, Td, max_barbs=20, title=None):
self._p = p
self._T = T
self._Td = Td
self._info_lines = []
+ self.barb_div = int(max(len(p)/max_barbs,1))
+
# Create a new figure. The dimensions here give a good aspect ratio
self._fig = plt.figure(figsize=(9, 9))
@@ -48,7 +50,8 @@ class Skewt:
plt.tight_layout()
plt.xlabel('$m/s$')
plt.ylabel('$m/s$')
- self._skew.plot_barbs(self._p, u, v)
+
+ self._skew.plot_barbs(self._p[::self.barb_div], u[::self.barb_div], v[::self.barb_div])
def addInfo(self, line):
self._info_lines.append(line)