Skip to content

Starkregen


Übersicht

Indikator Definition
Starkregentage Anzahl der Tage mit mehr als 20 mm Regen
Dauerregen Mindestens 3 aufeinanderfolgende Starkregentage
Regenintensität dritthöchste Wert des Tagesniederschlags pro Jahr
Saisonalität Starkregentage außerhalb der Sommersaison
Jährlichkeit Abfolgen von Feuchtjahren

Steckbrief

Langname Kurzname 1971-2010 1971-2010 2011-2050 2051-2090
Jahresmitteltemperatur tmit50 8.7 8.6 9.7 11.3
Anzahl Starkregentage nied20 3.9 4.7 5.5 6.6
Regenintensität nied99 19.6 21.1 22.2 23.9
Andauer Starkregentage pr20an 8.9 12.4 15.5

Temperaturänderung

Starkregentage

Dauerregen

Regenintensität

Saisonalität

Jährlichkeit


Code

Importing

import sys
import numpy as N
import pylab as P
from scipy import stats as S
import statsmodels.api as sm
from scipy import signal

P.style.use('bmh')

params = {'legend.fontsize': 8,'font.family': 'serif'}
P.rcParams.update(params)

Setting

ort = sys.argv[1]

basz = '%sbasz.txt'%ort

jo = N.arange(1971,2101,1);nj = len(jo)

def movave(a,n=3):
    ret=N.cumsum(a,dtype=float)
    ret[n:]=ret[n:]-ret[:-n]
    return ret[n-1:]/n

def tmit50(inp):

    return N.mean(inp)

def nied20(inp):

    id = N.where(inp>20.)[0]

    return len(id)

def nied99(inp):

    return N.percentile(inp,99)

def pr20jz(inp):

    out = N.zeros(nd,float)

    for d in range(nd):

        if(inp[d]>20.):

            out[d] = 1

    return out

def pr20an(inp):

    out = N.zeros(40,float)

    n = 0

    for d in range(nd):

        if(inp[d]>20.):

            n = n+1

        else:

            if(n>1): out[n] = out[n] + 1

            n = 0

    return out

Running

pars = {'tmit50':['Jahresmitteltemperatur','[$^\circ$C]'],
        'nied20':['Anzahl Starkregentage','[Tage]'],
        'nied99':['Regenintensität','[mm/d]'],
        'pr20jz':['Anzahl Starkregentage','[Tage]'],
        'pr20jj':['',''],
        'pr20an':['Andauer Starkregentage',''],
}

mods = ['obs-dwd','cnr-clm','ece-clm','had-clm','mpi-clm','mpi-rca','cnr-rca','nor-rca','ips-rca','ece-rca','had-rca','cnr-hir','had-hir','ece-hir','nor-hir','cnr-rac','had-rac','ece-rac']

nm = len(mods)
nd = 365

f = open('./include/starkregen_steckbrief.md','w')
f.write('Langname|Kurzname|1971-2010|1971-2010|2011-2050|2051-2090\n')
f.write('---|---|---|---|---|---\n')


for par in pars:

    print (par)

    tmp = N.zeros((nj,nm),float);tmp[:,:] = N.nan
    bas = N.zeros((nj,nm),float);bas[:,:] = N.nan
    doy = N.zeros((nj,nm,nd),float)
    day = N.zeros((nj,nm,40),float)

    m = -1

    for mod in mods:

        m = m+1

        dat = N.genfromtxt('../../data/csv/rcp85/%s/%s'%(mod,basz),names=True,dtype=None)

        for j in range(nj):

            id = N.where(dat['jahr']==jo[j])[0]

            if(len(id)>0):

                if(par=='tmit50'): tmp[j,m] = tmit50(dat['tas'][id]);bas[j,m] = tmit50(dat['tas'][id])
                if(par=='nied20'): tmp[j,m] = nied20(dat['pr'][id]);bas[j,m] = tmit50(dat['tas'][id])
                if(par=='nied99'): tmp[j,m] = nied99(dat['pr'][id]);bas[j,m] = tmit50(dat['tas'][id])
                if(par=='pr20jz'): doy[j,m,:] = pr20jz(dat['pr'][id])
                if(par=='pr20jj'): tmp[j,m] = nied20(dat['pr'][id])
                if(par=='pr20an'): day[j,m,:] = pr20an(dat['pr'][id])

    if((par=='tmit50')|(par=='nied20')|(par=='nied99')):

        tmp0 = N.mean(tmp[0:40,0])
        tmp1 = N.mean(tmp[0:40,1:])
        tmp2 = N.mean(tmp[41:80,1:])
        tmp3 = N.mean(tmp[81:120,1:]) 

        f.write('%s|%s|%.1f|%.1f|%.1f|%.1f\n'%(pars[par][0],par,tmp0,tmp1,tmp2,tmp3))

        P.figure(figsize=(8,3))

        zx = []

        tt = 30.*N.ones(nj,float)
        tt[30:] = tt[30:]+N.linspace(1,10,nj-30)

        for m in range(nm):

            zz = N.cumsum(tmp[:,m]-N.mean(tmp[:30,m]))/tt
            aa = tmp[:,m]-N.mean(tmp[:30,m])

            P.subplot(121)

            if(m==0): P.plot(jo,zz,'k',alpha=1.0,lw=0.5,zorder=10)
            else:             

                for j in range(nj-1):

                    zx.append(aa[j])

                P.scatter(jo,aa,c='None',s=10,ec='gray',lw=0.5,alpha=0.5,zorder=5)
                P.plot(jo,zz,'r',lw=0.5,zorder=6)

            P.subplot(122)

            yy = N.cumsum(bas[:,m]-N.mean(bas[:30,m]))/30.

            co = ['y','orange','r']

            i = -1

            for j in [2020,2050,2080]:

                i = i+1

                id = N.where(jo==j)[0]

                P.scatter(yy[id],zz[id],color='None',ec=co[i],s=50)

        zx = N.array(zx)

        P.subplot(121)

        P.plot([2020,2020],[N.nanmin(zx),N.nanmax(zx)],'y')
        P.plot([2050,2050],[N.nanmin(zx),N.nanmax(zx)],'orange')
        P.plot([2080,2080],[N.nanmin(zx),N.nanmax(zx)],'r')

        P.xlim(1970,2100)
        P.ylim(zx.min(),zx.max())
        P.tick_params(direction='out')
        P.xlabel('Jahre',fontsize=8,weight='bold')
        P.ylabel('Änderung: '+pars[par][0],fontsize=8,weight='bold')

        P.subplot(122)
        P.xlim(0,6)
        P.ylim(zx.min(),zx.max())
        P.tick_params(direction='out')
        P.xlabel('Temperaturänderung [K]',fontsize=8,weight='bold')
        P.ylabel('Änderung: '+pars[par][0],fontsize=8,weight='bold')

        P.tight_layout()

        P.savefig('./img/%s.png'%par,dpi=240,transparent=False,bbox_inches='tight',pad_inches=0)

    if(par=='pr20jz'):

        P.figure(figsize=(8,3))
        P.subplot(111)

        do = N.arange(1,nd+1,1)

        P.plot(movave(do,5),movave(N.mean(N.sum(doy[80:120:,1:,:],0),0),5),color='r',zorder=2,label='RCM:2051-2090')
        P.plot(movave(do,5),movave(N.mean(N.sum(doy[40:80:,1:,:],0),0),5),color='orange',zorder=3,label='RCM:2011-2050')
        P.plot(movave(do,5),movave(N.mean(N.sum(doy[0:40:,1:,:],0),0),5),color='y',zorder=4,label='RCM:1971-2010') 
        #P.bar(movave(do,5),movave(N.sum(doy[0:40,0,:],0),5),color='gray',zorder=5,label='OBS:1971-2010')

        P.xticks([1,30,60,90,120,150,180,210,240,270,300,330,360],['1.Jan','1.Feb','1.Mar','1.Apr','1.May','1.Jun','1.Jul','1.Aug','1.Sep','1.Oct','1.Nov','1.Dec','1.Jan'])
        P.xlim(0,361)
        P.ylabel(pars[par][0],fontsize=12,weight='bold')
        P.legend(loc=2,shadow=True)
        P.tick_params(direction='out')

        P.savefig('./img/%s.png'%par,dpi=240,transparent=False,bbox_inches='tight',pad_inches=0)

    if(par=='pr20jj'):

        P.figure(figsize=(8,3))
        P.subplot(111)

        mx = N.nanmax(tmp[:,0])

        for m in range(nm):
            for j in range(nj):

                if(tmp[j,m]>=mx):

                    P.plot([jo[j],jo[j]],[0.1+m,0.9+m],'m')

        P.xlim(1970,2100)
        P.yticks(N.arange(nm)+0.5,mods)
        P.tick_params(direction='out')
        P.savefig('./img/%s.png'%par,dpi=240,transparent=False,bbox_inches='tight',pad_inches=0)

    if(par=='pr20an'):

        f.write('%s|%s|'%(pars[par][0],par))

        P.figure(figsize=(10,4))

        for k in [1,2,3]:

            P.subplot(1,3,k)

            if(k==1): zz = N.mean(N.sum(day[0:40,1:,:],0),0);title = '1971-2010'
            if(k==2): zz = N.mean(N.sum(day[40:80,1:,:],0),0);title ='1911-2050'
            if(k==3): zz = N.mean(N.sum(day[80:120,1:,:],0),0);title = '2051-2090'

            ratio = N.sum(zz[2:])#/N.sum(zz)

            f.write('|%.1f'%ratio)

            P.bar(N.arange(40),zz,0.8,color='m',ec='k',label='%i'%ratio)

            P.title(title,fontsize=12,weight='bold')
            P.xlim(0,10)
            P.ylim(0,25)
            P.legend(loc=2,shadow=True)
            P.xlabel(pars[par][0],fontsize=12,weight='bold')
            P.ylabel('Häufigkeit',fontsize=12,weight='bold')
            P.tick_params(direction='out')

        f.write('\n')

        P.tight_layout()
        P.savefig('./img/%s.png'%par,dpi=240,transparent=False,bbox_inches='tight',pad_inches=0)

f.close()