Menu

[r6962]: / trunk / toolkits / basemap-0.9.6.1 / examples / setwh.py  Maximize  Restore  History

Download this file

82 lines (75 with data), 2.3 kB

 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# examples of using the 'width' and 'height' keywords
# to the Basemap constructor.
from matplotlib.toolkits.basemap import Basemap
from pylab import arange, show, title, figure
# setup projection centered on lon_0,lat_0
lat_0 = 40.
lon_0 = -100.
width = 6000000.
height = 2.*width/3.
delat = 25.
circles = arange(0.,90.+delat,delat).tolist()+\
arange(-delat,-90.-delat,-delat).tolist()
delon = 30.
meridians = arange(10.,360.,delon)
npanel = 0
# plots of the US.
projs = ['lcc','aeqd','aea','laea','eqdc','stere']
fig = figure(figsize=(8,12))
for proj in projs:
m = Basemap(width=width,height=height,
resolution='c',projection=proj,\
lat_0=lat_0,lon_0=lon_0)
npanel = npanel + 1
fig.add_subplot(3,2,npanel)
# setup figure with same aspect ratio as map.
m.drawcoastlines()
m.drawcountries()
m.fillcontinents()
m.drawstates()
m.drawparallels(circles)
m.drawmeridians(meridians)
title('proj = '+proj+' centered on %sW, %sN' % (lon_0,lat_0),fontsize=10)
proj = 'omerc'
delat = 10.
circles = arange(0.,90.+delat,delat).tolist()+\
arange(-delat,-90.-delat,-delat).tolist()
delon = 10.
meridians = arange(10.,360.,delon)
lat_1 = 40; lat_2 = 55
lon_1 = -120; lon_2 = -140
lat_0 = 47.5 ; lon_0 = -130
fig = figure()
width = 1500000.
height = 2.5*width
m = Basemap(width=width,height=height,
resolution='l',projection=proj,\
lon_1=lon_1,lon_2=lon_2,\
lat_1=lat_1,lat_2=lat_2,\
lat_0=lat_0,lon_0=lon_0)
m.drawcoastlines(linewidth=0.5)
m.drawcountries(linewidth=0.5)
m.fillcontinents()
m.drawstates(linewidth=0.5)
m.drawparallels(circles)
m.drawmeridians(meridians)
title('proj = '+proj+' centered on %sW, %sN' % (lon_0,lat_0),fontsize=10)
#lon_0 = -8
#lat_0 = 53.3
#width=350000.
#height= 1.33*width
#fig=figure()
#proj='tmerc'
#circles = arange(50,60,1)
#meridians = arange(-12,2,1)
#m = Basemap(width=width,height=height,
# resolution='i',projection=proj,\
# lat_0=lat_0,lon_0=lon_0)
#m.drawcoastlines(linewidth=0.5)
#m.drawcountries(linewidth=0.5)
#m.fillcontinents()
#m.drawstates(linewidth=0.5)
#m.drawparallels(circles)
#m.drawmeridians(meridians)
#title('proj = '+proj+' centered on %sW, %sN' % (lon_0,lat_0),fontsize=10)
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.