Menu

[r6270]: / trunk / htdocs / screenshots / contour_shot.py  Maximize  Restore  History

Download this file

39 lines (28 with data), 929 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from mpl_toolkits.basemap import Basemap, interp
from pylab import *
# read in data on lat/lon grid.
hgt = load('data/500hgtdata.gz')
lons = load('data/500hgtlons.gz')
lats = load('data/500hgtlats.gz')
lons, lats = meshgrid(lons,lats)
# set up map projection (lambert azimuthal equal area).
m = Basemap(projection='nplaea',lon_0=-90,boundinglat=15.,resolution='c')
cmap = cm.jet
fig = figure(figsize=(6,6))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
x,y = m(lons, lats)
cs = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
cs = m.contourf(x,y,hgt,15,cmap=cm.jet)
# draw map.
m.drawcoastlines()
# draw parallels
delat = 30.
delon = 90.
circles = arange(10.,90.+delat,delat).tolist()
m.drawparallels(circles,labels=[0,0,1,1], fontsize=16)
# draw meridians
meridians = arange(0.,360.,delon)
m.drawmeridians(meridians,labels=[1,1,1,1],fontsize=16)
savefig('contour_small.png', dpi=50)
savefig('contour_large', dpi=120)
show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.