aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2024-01-24 00:58:36 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2024-01-24 00:58:36 +0100
commit40e1a9eb35a771cdaea7973f8b0642860da1a069 (patch)
tree764d21efe18eaa1f86e91deca8d04898825e76d7
parent037e23d4109869559549d10d1e66c78dfd319008 (diff)
downloadmeteo_toolbox-40e1a9eb35a771cdaea7973f8b0642860da1a069.tar.gz
meteogram add precip
-rw-r--r--config.yaml44
-rwxr-xr-xplotter/meteogram.py26
2 files changed, 63 insertions, 7 deletions
diff --git a/config.yaml b/config.yaml
index d9e5d45..74a9377 100644
--- a/config.yaml
+++ b/config.yaml
@@ -21,8 +21,10 @@ aggregator:
- hbas_con
- htop_con
- htop_dc
+ - tot_prec
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]
+ steps: [0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72]
+ description: FORECAST DWD ICON-EU
plotter:
- module: plotter.meteogram
aggregator: icon_eu
@@ -31,6 +33,9 @@ plotter:
- name: meteogram_antersberg
lat: 47.96
lon: 11.99
+ - name: meteogram_munich
+ lat: 48.16
+ lon: 11.57
- module: 'plotter.vertical_from_grib'
aggregator: icon_eu
@@ -40,10 +45,19 @@ plotter:
lon: 11.99
name: skewt_antersberg
analysis: lcl
+ - lat: 11.57
+ lon: 48.16
+ name: skewt_munich
+ analysis: lcl
- module: 'plotter.horizontal'
aggregator: icon_eu
output: web/data
plots:
+ - name: dry_con_top
+ area: null
+ layers:
+ - layertype: raster
+ field: HTOP_DC
- name: t_fi_850
area: null
layers:
@@ -58,6 +72,34 @@ plotter:
plot_units: '_gpdm'
contours: 5
clabels: true
+ - name: t_fi_500
+ area: null
+ layers:
+ - layertype: raster
+ field: t
+ level: 500
+ plot_units: degC
+ colormap: jet
+ - layertype: contour
+ field: z
+ level: 500
+ plot_units: '_gpdm'
+ contours: 5
+ clabels: true
+ - name: t_fi_200
+ area: null
+ layers:
+ - layertype: raster
+ field: t
+ level: 200
+ plot_units: degC
+ colormap: jet
+ - layertype: contour
+ field: z
+ level: 200
+ plot_units: '_gpdm'
+ contours: 5
+ clabels: true
- name: pmsl_t850
area: null
layers:
diff --git a/plotter/meteogram.py b/plotter/meteogram.py
index a360fef..a04fe34 100755
--- a/plotter/meteogram.py
+++ b/plotter/meteogram.py
@@ -13,6 +13,8 @@ from metpy.units import units
import misc
+HEIGHT = 11
+
def run(data, plots, output='.'):
misc.create_output_dir(output)
index = []
@@ -32,11 +34,11 @@ def _plot(data, output, name, lat, lon):
init_str = init.strftime('%d %b %Y - %HUTC')
init_for_filename = init.strftime('%Y-%m-%d-%HUTC')
- fig = plt.figure(figsize=(10, 10), layout="constrained")
+ fig = plt.figure(figsize=(12, 10), layout="constrained")
# start figure and set axis
- ax = fig.add_subplot(5,1,(1,2))
+ ax = fig.add_subplot(HEIGHT,1,(1,4))
ax.set_ylabel('Pressure level [hPa]')
@@ -54,15 +56,16 @@ def _plot(data, output, name, lat, lon):
ax.invert_yaxis()
### Temp + Dewpoint
- ax2 = fig.add_subplot(5,1,3,sharex=ax)
+ ax2 = fig.add_subplot(HEIGHT,1,(5,6),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.plot(data.valid_time, data.sel(isobaricInhPa=850.0).t.metpy.convert_units('degC').transpose(), color='grey', label='Tempreature (850hPa)')
ax2.set_ylabel('Temperature [degC]')
ax2.legend(loc='lower right')
+
## MSLP
- ax3 = fig.add_subplot(5,1,4,sharex=ax)
+ ax3 = fig.add_subplot(HEIGHT,1,(7,8),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')
@@ -77,8 +80,19 @@ def _plot(data, output, name, lat, lon):
height=(data.hcct.metpy.convert_units('km')-data.HBAS_CON.metpy.convert_units('km')).transpose(),
align='edge', width=np.timedelta64(3, 'h'))
- ### Info Lines
+ # Precip
+ ax5 = fig.add_subplot(HEIGHT,1,(9,10),sharex=ax)
+ ax5.set_ylabel('Total precipitation [mm]')
+ ax5.set_ylim(0, 30)
+ ax5.bar(data.valid_time[:-1], data.tp.diff('step').transpose(), width=np.timedelta64(3, 'h'),
+ align='edge', alpha=0.7, color='green')
+ ax6 = ax5.twinx()
+ ax6.set_ylabel('Snow depth [m]')
+ ax6.set_ylim(bottom=0)
+ ax6.plot(data.valid_time, data.sde.transpose(), color='blue')
+
+ ### Info Lines
info_lines = []
init = misc.np_time_convert(data.time.values)
init_str = init.strftime('%d %b %Y - %HUTC')
@@ -89,7 +103,7 @@ def _plot(data, output, name, lat, lon):
if '_description' in data.attrs:
info_lines.append(data.attrs['_description'])
- ax_text = fig.add_subplot(5, 1, 5)
+ ax_text = fig.add_subplot(HEIGHT, 1, 11)
ax_text.text(0, 0, '\n'.join(info_lines), ha='left', va='center',
size=10, fontfamily='monospace')
ax_text.axis("off")