- Notifications
You must be signed in to change notification settings - Fork 397
/
Copy pathgeos_demo.py
41 lines (36 loc) · 1.37 KB
/
geos_demo.py
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
from __future__ import (absolute_import, division, print_function)
frommpl_toolkits.basemapimportBasemap
importnumpyasnp
importmatplotlib.pyplotasplt
importsys
defget_input(prompt):
ifsys.hexversion>0x03000000:
returninput(prompt)
else:
returnraw_input(prompt)
# create Basemap instance for Geostationary (satellite view) projection.
lon_0=float(get_input('enter reference longitude (lon_0):'))
# map with land/sea mask plotted
fig=plt.figure()
m=Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution=None)
# plot land-sea mask.
# land red, oceans blue.
# lakes=True means plot inland lakes with ocean color.
m.drawmapboundary()
m.drawlsmask(land_color='red',ocean_color='blue',lakes=True)
# draw parallels and meridians.
m.drawparallels(np.arange(-90.,120.,30.))
m.drawmeridians(np.arange(0.,420.,60.))
plt.title('Geostationary Map Centered on Lon=%s'% (lon_0))
# map with continents drawn and filled.
fig=plt.figure()
m=Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution='l')
m.drawcoastlines()
m.fillcontinents(color='coral',lake_color='aqua')
m.drawmapboundary(fill_color='aqua')
m.drawcountries()
# draw parallels and meridians.
m.drawparallels(np.arange(-90.,120.,30.))
m.drawmeridians(np.arange(0.,420.,60.))
plt.title('Geostationary Map Centered on Lon=%s'% (lon_0))
plt.show()