Revision: 4559
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4559&view=rev
Author: jswhit
Date: 2007-12-03 06:41:11 -0800 (Mon, 03 Dec 2007)
Log Message:
-----------
cleanup basemap examples.
Modified Paths:
--------------
trunk/py4science/examples/skel/basemap1_skel.py
trunk/py4science/examples/skel/basemap2_skel.py
trunk/py4science/examples/skel/basemap3_skel.py
trunk/py4science/examples/skel/basemap4_skel.py
trunk/py4science/examples/skel/basemap5_skel.py
Modified: trunk/py4science/examples/skel/basemap1_skel.py
===================================================================
--- trunk/py4science/examples/skel/basemap1_skel.py 2007-12-03 13:27:16 UTC
(rev 4558)
+++ trunk/py4science/examples/skel/basemap1_skel.py 2007-12-03 14:41:11 UTC
(rev 4559)
@@ -1,8 +1,5 @@
import pylab, numpy
from matplotlib.toolkits.basemap import Basemap
-
-# create figure.
-fig = pylab.figure()
# create map by specifying lat/lon values at corners.
projection = 'lcc' # map projection
resolution = XX # resolution of boundaries ('c','l','i',or 'h')
Modified: trunk/py4science/examples/skel/basemap2_skel.py
===================================================================
--- trunk/py4science/examples/skel/basemap2_skel.py 2007-12-03 13:27:16 UTC
(rev 4558)
+++ trunk/py4science/examples/skel/basemap2_skel.py 2007-12-03 14:41:11 UTC
(rev 4559)
@@ -1,8 +1,5 @@
import pylab, numpy
from matplotlib.toolkits.basemap import Basemap, supported_projections
-
-# create figure.
-fig = pylab.figure()
# create map by specifying width and height in km.
projection = XX # map projection ('lcc','stere','laea','aea' etc)
# 'print supported_projections' gives a list
Modified: trunk/py4science/examples/skel/basemap3_skel.py
===================================================================
--- trunk/py4science/examples/skel/basemap3_skel.py 2007-12-03 13:27:16 UTC
(rev 4558)
+++ trunk/py4science/examples/skel/basemap3_skel.py 2007-12-03 14:41:11 UTC
(rev 4559)
@@ -1,27 +1,15 @@
import pylab, numpy
from matplotlib.toolkits.basemap import Basemap
-
-# create figure.
-# background color will be used for 'wet' areas.
-fig = pylab.figure()
# create map by specifying width and height in km.
-resolution = 'l'
-lon_0 = -50
-lat_0 = 60
-projection = 'lcc'
-width = 12000000
-height = 0.75*width
-m = Basemap(lon_0=lon_0,lat_0=lat_0,\
- width=width,height=height,\
+resolution = 'l'; projection='lcc'
+lon_0 = -50; lat_0 = 60.
+width = 12000000; height = 0.75*width
+m = Basemap(lon_0=lon_0,lat_0=lat_0,width=width,height=height,\
resolution=resolution,projection=projection)
# lat/lon and name of location 1.
-lat1 = XX
-lon1 = XX
-name1 = XX
+lat1 = XX; lon1 = XX; name = XX
# ditto for location 2.
-lat2 = XX
-lon2 = XX
-name2 = XX
+lat2 = XX; lon2 = XX; name2 = XX
# convert these points to map projection coordinates
# (using __call__ method of Basemap instance)
x1, y1 = m(lon1, lat1)
Modified: trunk/py4science/examples/skel/basemap4_skel.py
===================================================================
--- trunk/py4science/examples/skel/basemap4_skel.py 2007-12-03 13:27:16 UTC
(rev 4558)
+++ trunk/py4science/examples/skel/basemap4_skel.py 2007-12-03 14:41:11 UTC
(rev 4559)
@@ -1,16 +1,10 @@
import pylab, numpy
from matplotlib.toolkits.basemap import Basemap
-# create figure.
-fig = pylab.figure()
# create map by specifying width and height in km.
-resolution = 'l'
-lon_0 = -50
-lat_0 = 60
-projection = 'lcc'
-width = 12000000
-height = 0.75*width
-m = Basemap(lon_0=lon_0,lat_0=lat_0,\
- width=width,height=height,\
+resolution = 'l'; projection='lcc'
+lon_0 = -50; lat_0 = 60.
+width = 12000000; height = 0.75*width
+m = Basemap(lon_0=lon_0,lat_0=lat_0,width=width,height=height,\
resolution=resolution,projection=projection)
m.drawcoastlines(linewidth=0.5)
m.drawmapboundary(fill_color='aqua')
Modified: trunk/py4science/examples/skel/basemap5_skel.py
===================================================================
--- trunk/py4science/examples/skel/basemap5_skel.py 2007-12-03 13:27:16 UTC
(rev 4558)
+++ trunk/py4science/examples/skel/basemap5_skel.py 2007-12-03 14:41:11 UTC
(rev 4559)
@@ -1,16 +1,13 @@
from matplotlib.toolkits.basemap import Basemap, NetCDFFile, cm
import pylab, numpy
-
# read in netCDF sea-surface temperature data
# can be a local file, a URL for a remote opendap dataset,
# or (if PyNIO is installed) a GRIB or HDF file.
+# See http://nomads.ncdc.noaa.gov/ for some NOAA OPenDAP datasets.
ncfile = NetCDFFile('data/sst.nc')
sst = ncfile.variables['analysed_sst'][:]
lats = ncfile.variables['lat'][:]
lons = ncfile.variables['lon'][:]
-
-print sst.shape, sst.min(), sst.max()
-
# Basemap comes with extra colormaps from Generic Mapping Tools
# (imported as cm, pylab colormaps in pylab.cm)
cmap = XX
@@ -23,6 +20,8 @@
x, y = m(*numpy.meshgrid(lons, lats))
# plot with pcolor
im = m.pcolormesh(x,y,sst,shading='flat',cmap=cmap)
+# or try 100 filled contours.
+#CS = m.contourf(x,y,sst,100,cmap=cmap)
# draw parallels and meridians, but don't bother labelling them.
m.drawparallels(numpy.arange(-90.,120.,30.))
m.drawmeridians(numpy.arange(0.,420.,60.))
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins