Menu

[r4424]: / trunk / py4science / examples / skel / basemap2_skel.py  Maximize  Restore  History

Download this file

28 lines (26 with data), 1.1 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
import pylab, numpy
from matplotlib.toolkits.basemap import Basemap, supported_projections
# create figure.
# background color will be used for 'wet' areas.
fig = pylab.figure()
fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
# create map by specifying width and height in km.
projection = XX # map projection ('lcc','stere','laea','aea' etc)
# 'print supported_projections' gives a list
resolution = XX # resolution of boundaries ('c','l','i',or 'h')
lon_0= XX # longitude of origin of map projection domain (degrees).
lat_0= XX # standard parallel/latitude of origin of map projection domain.
width = XX # width of map projecton domain in km.
height = XX # height of map projection domain in km.
m = Basemap(lon_0=lon_0,lat_0=lat_0,\
width=width,height=height,\
resolution=resolution,projection=projection)
# draw coastlines.
m.drawcoastlines(linewidth=0.5)
# fill continents.
m.fillcontinents(color='coral')
# draw states and countries.
m.drawcountries()
m.drawstates()
pylab.title('map region specified using width and height')
pylab.show()