Tmax
Verteilungsdichte der Schadensmeldungen in Abhängigkeit von der Maximaltemperatur
Ergebnis¶
Hohe Temperaturen begünstigen die Gleichzeitigkeit von Störmeldungen, weil diese zumeist großräumig auftreten.
Abb.: Verteilungsdichte der Störmeldungen (N) in Abhängigkeit von der Tagesmaximumtemperatur (Tmax) über alle PDs: N>0 und N>40.
Code¶
Module
# -*- coding: utf-8 -*-
import sys
import numpy as N
import shapefile
import scipy.stats as stats
import pylab as P
from matplotlib.collections import PatchCollection
from pylab import Polygon
from mpl_toolkits.basemap import Basemap
P.style.use('bmh')
params = {'legend.fontsize': 8,'font.family': 'serif'}
P.rcParams.update(params)
Reading
tmp=N.genfromtxt('../shp/GP.csv',names=True,comments='#',delimiter=';',dtype=None)#,encoding='UTF-8')
pds = tmp['Name']
print (pds)
Plotting
filter = 'Filter1'
P.figure(figsize=(8,5))
xx = []
yy = []
for pd in pds:
pd = pd.replace('\xfc', 'ü').replace('\xf6', 'ö')
file = '../csv/obs-dwd/'+pd+'.csv'
data=N.genfromtxt(file,names=True,comments='#',delimiter=';',dtype=None,encoding='utf-8')
id = N.where((data['ja']>=2015)&(data['ja']<=2019))[0]
tmax = data['tmax'][id]
wmax = data['wmax'][id]
nied = data['nied'][id]
mona = data['mo'][id]
file = '../csv/pds-uas/'+pd+'.csv'
data=N.genfromtxt(file,names=True,comments='#',delimiter=';',dtype=None,encoding='utf-8')
id = N.where((data['ja']>=2015)&(data['ja']<=2019))[0]
uas = data[filter][id]
id = N.where((uas>0))[0]
#id = N.where((uas>0)&(wmax<10))[0]
for i in id:
xx.append(tmax[i])
yy.append(uas[i])
xx = N.array(xx)
yy = N.array(yy)
for sw in [0,40]:
id = N.where((yy>sw)&(xx>2))[0]
xs = xx[id]
ys = yy[id]
values = N.vstack([xs,ys])
kernel = stats.gaussian_kde(values)
X, Y = N.mgrid[-10:40:200j,0:100:200j]
positions = N.vstack([X.ravel(),Y.ravel()])
Z2 = N.reshape(kernel(positions).T, X.shape)
#xnew = N.linspace(-10,40,num=200)
#density = stats.kde.gaussian_kde(xx)
#Z3 = density(xnew)
lev = N.arange(0.2,5.0,0.2)
CF=P.contourf(X,Y,1000*Z2,levels=lev,cmap=P.cm.YlOrRd,zorder=1)
P.contour(X,Y,1000*Z2,levels=lev,colors='k',linewidths=0.5,zorder=1)
P.text(0,45,'N>40',size=22,weight='bold',ha='center',va='center',bbox=dict(boxstyle="circle", ec='k', fc='gray',alpha=0.5,lw=2))
P.tick_params(direction='out')
P.xlim(-5,40)
P.ylim(0,60)
P.grid(color='k')
P.xlabel('tmax [$^\circ$C]',fontsize=16,weight='bold')
P.ylabel('Meldungen pro Tag je PD',fontsize=16,weight='bold')
P.title('Meldungen ('+filter+') ~ Tmax',fontsize=16,weight='bold')
P.savefig('./img/tmax_'+filter+'.png',dpi=240,bbox_inches='tight')