aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-12-04 01:59:51 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-12-04 01:59:51 +0100
commit3e90b2896ff8cd50c3a62169d6e7a15c56eee46a (patch)
tree56331ebe038a17724c8ff323aa12e3f5d98ce0fd
parent293b33715c3656fc54bab70ec49c04912655444f (diff)
downloadmeteo_toolbox-3e90b2896ff8cd50c3a62169d6e7a15c56eee46a.tar.gz
meteogram
-rw-r--r--config.yaml3
-rwxr-xr-xplotter/meteogram.py27
2 files changed, 25 insertions, 5 deletions
diff --git a/config.yaml b/config.yaml
index 5ba023a..d9e5d45 100644
--- a/config.yaml
+++ b/config.yaml
@@ -18,6 +18,9 @@ aggregator:
- pmsl
- t_2m
- relhum_2m
+ - hbas_con
+ - htop_con
+ - htop_dc
pressure_levels: [1000, 950, 925, 900, 875, 850, 825, 800, 775, 700, 600, 500, 400, 300, 250, 200, 150, 100]
steps: [0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48]
plotter:
diff --git a/plotter/meteogram.py b/plotter/meteogram.py
index ee8c7ea..790714e 100755
--- a/plotter/meteogram.py
+++ b/plotter/meteogram.py
@@ -2,6 +2,8 @@
import os
import json
+import numpy as np
+
import matplotlib.pyplot as plt
import xarray as xr
@@ -51,14 +53,29 @@ def _plot(data, output, name, lat, lon):
ax.invert_yaxis()
- ### Second plot
-
+ ### Temp + Dewpoint
ax2 = fig.add_subplot(5,1,3,sharex=ax)
ax2.plot(data.valid_time, data.t2m.metpy.convert_units('degC').transpose(), color='red', label='Temperature (2m)')
ax2.plot(data.valid_time, mpcalc.dewpoint_from_relative_humidity(data.t2m, data.r2).transpose(), color='blue', label='Dewpoint (2m)')
ax2.set_ylabel('Temperature [degC]')
ax2.legend(loc='lower right')
+ ## MSLP
+ ax3 = fig.add_subplot(5,1,4,sharex=ax)
+ ax3.plot(data.valid_time, data.prmsl.metpy.convert_units('hPa').transpose(), color='black', label='Temperature (2m)')
+ ax3.set_ylabel('Mean Sea Level Pressure [hPa]')
+ #ax3.legend(loc='lower right')
+ # TODO: ADD HBAS_CON, HTOP_CON
+ # If none: -500m
+
+ ax4 = ax3.twinx()
+ ax4.set_ylim(0, 14)
+ ax4.set_ylabel('Convective Clouds Height [km]')
+ ax4.bar(data.valid_time,
+ bottom=data.HBAS_CON.metpy.convert_units('km').transpose(),
+ height=(data.hcct.metpy.convert_units('km')-data.HBAS_CON.metpy.convert_units('km')).transpose(),
+ align='edge', width=np.timedelta64(3, 'h'))
+
### Info Lines
info_lines = []
@@ -71,10 +88,10 @@ def _plot(data, output, name, lat, lon):
if '_description' in data.attrs:
info_lines.append(data.attrs['_description'])
- ax = fig.add_subplot(5, 1, 4)
- ax.text(0, 0, '\n'.join(info_lines), ha='left', va='center',
+ ax_text = fig.add_subplot(5, 1, 5)
+ ax_text.text(0, 0, '\n'.join(info_lines), ha='left', va='center',
size=10, fontfamily='monospace')
- ax.axis("off")
+ ax_text.axis("off")
### Output