<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import numpy as N
import string
import datetime
import pylab as P
from mpl_toolkits.basemap import Basemap
from matplotlib.colors import LightSource

jd=N.genfromtxt('gliste.txt',usecols=(0),skip_header=0,dtype="S")

id=N.genfromtxt('gitter.txt',usecols=(0),skip_header=0,dtype="S")
xo=N.genfromtxt('gitter.txt',usecols=(1),skip_header=0,dtype="f")
yo=N.genfromtxt('gitter.txt',usecols=(2),skip_header=0,dtype="f")

lo = N.sort(N.array(list(set(xo))));nx = len(lo)
la = N.sort(N.array(list(set(yo))));ny = len(la)

jx = 2000
mx = 1
dx = 1

los,las = N.meshgrid(lo,la)

dat = N.zeros((ny,nx),float);dat[:,:] = N.nan

for i in jd:

    ind = N.where(id==i)[0]
    
    xi = xo[ind][0]
    yi = yo[ind][0]
    
    distance = (los-xi)**2 + (las-yi)**2
    idy,idx = N.where(distance==distance.min())

    file = '../output_grid/'+i+'.dat'    

    print file
    
    day=N.genfromtxt(file,usecols=(0),skip_header=1,dtype="i")
    mon=N.genfromtxt(file,usecols=(1),skip_header=1,dtype="i")
    yea=N.genfromtxt(file,usecols=(2),skip_header=1,dtype="i")
    dum=N.genfromtxt(file,usecols=(3),skip_header=1,dtype="f")
    
    ind = N.where((day==dx)&amp;(mon==mx)&amp;(yea==jx))[0]
    
    dat[idy,idx] = dum[ind]

########################

P.figure(figsize=(6,7))

m = Basemap(projection='merc', lon_0=10,lat_0=52, lat_ts=58, llcrnrlat=46.5,urcrnrlat=55.0,llcrnrlon=5.0,urcrnrlon=16.5,resolution='h')
m.drawcoastlines()
m.drawcountries(linewidth=1.0)
m.drawrivers(color='b')
m.shadedrelief()

ls = LightSource(azdeg=0,altdeg=65)
rgb = ls.shade(dat[::-1,:],P.cm.spectral)

#P.imshow(rgb,cmap=P.cm.spectral,alpha=0.3)
 
x,y = m(los,las)                                                         
CM = m.contourf(x,y,dat[::-1,:],levels=N.arange(-11,21,1),cmap=P.get_cmap('spectral'),extend='both')
m.contour(x,y,dat[::-1,:],levels=N.arange(-10,20,1),colors='k')

cbar = m.colorbar(CM,location='bottom',pad="5%",drawedges=True)
cbar.set_label(r'tas ($^\circ$C)',fontsize=12)

P.title('%04i-%02i-%02i'%(jx,mx,dx),fontsize=20)

#m.imshow(rgb,alpha=1.0)

#xo=N.genfromtxt('../interpol_stationen/sliste.txt',usecols=(1),skip_header=0,dtype="f")
#yo=N.genfromtxt('../interpol_stationen/sliste.txt',usecols=(2),skip_header=0,dtype="f")

#x,y = m(xo,yo)

#m.scatter(x,y,s=10,facecolors='none', edgecolors='w')

P.savefig('maps.png')</pre></body></html>