aboutsummaryrefslogtreecommitdiff
path: root/test/cross.py
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-10-08 13:00:04 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-10-08 13:00:04 +0200
commit880fdafc90626c181c1e37828f929cf247af9766 (patch)
treebc251f9e546628e7f0c041a74d53e9b31e158eae /test/cross.py
parentb623a3c8c8e660c6858995d23d762f941bedaeac (diff)
downloadmeteo_toolbox-880fdafc90626c181c1e37828f929cf247af9766.tar.gz
test/cross
Diffstat (limited to 'test/cross.py')
-rwxr-xr-xtest/cross.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/cross.py b/test/cross.py
new file mode 100755
index 0000000..0dbb8c0
--- /dev/null
+++ b/test/cross.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+import matplotlib.pyplot as plt
+
+import xarray as xr
+from metpy.interpolate import cross_section
+
+data = xr.load_dataset('dwd_icon-eu/combined.grib2', engine='cfgrib')
+lat, lon = (47.96, 11.99)
+data = data.sel(latitude=lat, longitude = lon, method='nearest')
+print(data)
+
+
+# start figure and set axis
+fig, ax = plt.subplots(figsize=(5, 5))
+
+#clc = ax.plot(data.step.values.astype('float64'), data.isobaricInhPa, data.ccl.transpose())
+clc = ax.imshow(data.ccl.transpose(), extent=(data.step.values.astype(float).min(), data.step.values.astype(float).max(), data.isobaricInhPa.min(), data.isobaricInhPa.max()), aspect='auto', cmap='Blues_r', vmin=0, vmax=100)
+plt.colorbar(clc, label='clcov')
+
+
+cf = ax.contour(data.step.values.astype('float64'), data.isobaricInhPa, data.t.metpy.convert_units('degC').transpose())
+ax.clabel(cf, inline=True, fontsize=10)
+#plt.colorbar(cf, pad=0, aspect=50)
+#plt.colorbar(cf)
+
+barbs = ax.barbs(data.step.values.astype('float64'), data.isobaricInhPa, data.u.transpose(), data.v.transpose())
+#ax.barbs(data.u, data.v, color='black', length=5, alpha=0.5)
+
+ax.invert_yaxis()
+plt.show()
+