Persistenz
Ähnlichkeit von aufeinanderfolgenden Strömungsmustern über Europa
Europa/Deutschland: 50-55°N / 10-15°E¶
WPI ~ tas | WPI ~ pr |
---|---|
Abb.: Eine hohe Persistenz von großräumigen Strömungsmustern im Sommer über Europa können in Ostdeutschland sowohl eine heiße und trockene (bspw. 2018) aber auch warme und feuchte (bspw. 2017) Saison begünstigen.
Code¶
Importing¶
import sys
import os
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as P
from mpl_toolkits.basemap import Basemap,shiftgrid
from netCDF4 import Dataset
import numpy as N
from scipy import stats as S
from scipy import signal
params = { 'legend.fontsize': 12,\
'font.family': 'serif',\
}
P.rcParams.update(params)
P.style.use('bmh')
Running¶
jo = N.arange(1981,2020,1)
for p in ['tas','pr']:
nc = Dataset('../data/era/wpi/1981-2019_JJA_abs.cdf','r')
ssim = N.array(nc.variables['persistence'][:])
nc.close()
nc = Dataset('../data/era/%s/1981-2019_JJA_abs.cdf'%p,'r')
data = N.array(nc.variables[p][:])
lon = N.array(nc.variables['lon'][:]);nx = len(lon)
lat = N.array(nc.variables['lat'][:]);ny = len(lat)
nc.close()
if(p=='pr'): data = data*24.*3600.
if(p=='tas'): data = data-273.14
###############################
P.figure(figsize=(6,4))
ax = P.subplot(111)
iy = N.where((lat>50)&(lat<55))[0]
ix = N.where((lon>10)&(lon<15))[0]
nj = 38
xx = ssim[:,iy,:]
yy = data[:,iy,:]
xx = xx[:,:,ix]
yy = yy[:,:,ix]
values = N.vstack([xx.ravel(),yy.ravel()])
kernel = S.gaussian_kde(values)
if(p=='tas'): X, Y = N.mgrid[64:76:100j,14:20:100j]
if(p=='pr'): X, Y = N.mgrid[64:76:100j,6:14:100j]
positions = N.vstack([X.ravel(), Y.ravel()])
Z2 = N.reshape(kernel(positions).T, X.shape)
if(p=='tas'):
CF=P.contourf(X,Y,Z2*100.,N.arange(1,8,1),cmap=P.cm.Reds,extend='max')
P.contour(X,Y,Z2*100.,N.arange(1,8,1),colors='k')
if(p=='pr'):
CF=P.contourf(X,Y,Z2*100.,N.arange(1,8,1),cmap=P.cm.Blues,extend='max')
P.contour(X,Y,Z2*100.,N.arange(1,8,1),colors='k')
for j in jo:
id = N.where(jo==j)[0]
id = id[0]
P.scatter(N.mean(xx[id,:,:]),N.mean(yy[id,:,:]),s=300,c='None',ec='k',lw=1,zorder=5)
id = N.where(jo==2018)[0]
id = id[0]
P.scatter(N.mean(xx[id,:,:]),N.mean(yy[id,:,:]),s=300,c='None',ec='dodgerblue',lw=3,zorder=10,label='2018')
id = N.where(jo==2017)[0]
id = id[0]
P.scatter(N.mean(xx[id,:,:]),N.mean(yy[id,:,:]),s=300,c='None',ec='orangered',lw=3,zorder=10,label='2017')
P.xlim(64,76)
if(p=='tas'):P.ylim(14,20)
if(p=='pr'):P.ylim(6,14)
P.grid(color='k')
P.legend(loc=2,shadow=True)
P.tick_params(direction='out')
P.xlabel('Weather Persistence Index (%)',fontsize=16,weight='bold')
if(p=='tas'): P.ylabel('Temperature ($^\circ$C)',fontsize=16,weight='bold')
if(p=='pr'): P.ylabel('Precipitation (mm)',fontsize=16,weight='bold')
P.savefig('./img/wpi-%s0.png'%p,dpi=240,transparent=False,bbox_inches='tight',pad_inches=0.0)