625 lines (591 with data), 59.3 kB
@header@
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="matplotlib.html"><font color="#ffffff">matplotlib</font></a>.<a href="matplotlib.toolkits.html"><font color="#ffffff">toolkits</font></a>.<a href="matplotlib.toolkits.basemap.html"><font color="#ffffff">basemap</font></a>.basemap</strong></big></big> (version 0.9.2)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/lib/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py">/usr/lib/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="matplotlib.numerix.html">matplotlib.numerix</a><br>
<a href="dbflib.html">dbflib</a><br>
</td><td width="25%" valign=top><a href="matplotlib.numerix.ma.html">matplotlib.numerix.ma</a><br>
<a href="math.html">math</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a href="pyproj.html">pyproj</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="matplotlib.toolkits.basemap.basemap.html#Basemap">Basemap</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Basemap">class <strong>Basemap</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt> Set up a basemap with one of 18 supported map projections<br>
(cylindrical equidistant, mercator, polyconic, oblique mercator,<br>
transverse mercator, miller cylindrical, lambert conformal conic,<br>
azimuthal equidistant, equidistant conic, lambert azimuthal equal area,<br>
albers equal area conic, gnomonic, orthographic, sinusoidal, mollweide, <br>
robinson, cassini-soldner or stereographic).<br>
Doesn't actually draw anything, but sets up the map projection class and<br>
creates the coastline, lake river and political boundary data<br>
structures in native map projection coordinates.<br>
Uses a pyrex interface to C-code from proj.4 (<a href="http://proj.maptools.org">http://proj.maptools.org</a>).<br>
<br>
Useful instance variables:<br>
<br>
projection - map projection ('cyl','merc','mill','lcc','eqdc','aea',<br>
'laea', 'nplaea', 'splaea', 'tmerc', 'omerc', 'cass', 'gnom', 'poly', <br>
'sinu', 'moll', 'ortho', 'robin', 'aeqd', 'npaeqd', 'spaeqd', 'stere',<br>
'npstere' or 'spstere')<br>
(projections prefixed with 'np' or 'sp' are special case polar-centric<br>
versions of the parent projection)<br>
aspect - map aspect ratio (size of y dimension / size of x dimension).<br>
llcrnrlon - longitude of lower left hand corner of the desired map domain.<br>
llcrnrlon - latitude of lower left hand corner of the desired map domain.<br>
urcrnrlon - longitude of upper right hand corner of the desired map domain.<br>
urcrnrlon - latitude of upper right hand corner of the desired map domain.<br>
llcrnrx,llcrnry,urcrnrx,urcrnry - corners of map domain in projection coordinates.<br>
rmajor,rminor - equatorial and polar radii of ellipsoid used (in meters).<br>
resolution - resolution of boundary dataset being used ('c' for crude,<br>
'l' for low, etc.). If None, no boundary dataset is associated with the<br>
<a href="#Basemap">Basemap</a> instance. <br>
<br>
Example Usage:<br>
<br>
>>> from matplotlib.toolkits.basemap import <a href="#Basemap">Basemap</a><br>
>>> from pylab import *<br>
>>> # read in topo data (on a regular lat/lon grid)<br>
>>> etopo = load('etopo20data.gz')<br>
>>> lons = load('etopo20lons.gz')<br>
>>> lats = load('etopo20lats.gz')<br>
>>> # create <a href="#Basemap">Basemap</a> instance for Robinson projection.<br>
>>> m = <a href="#Basemap">Basemap</a>(projection='robin',lon_0=0.5*(lons[0]+lons[-1]))<br>
>>> # compute native map projection coordinates for lat/lon grid.<br>
>>> x, y = m(*meshgrid(lons,lats))<br>
>>> # make filled contour plot.<br>
>>> cs = m.<a href="#Basemap-contourf">contourf</a>(x,y,etopo,30,cmap=cm.jet)<br>
>>> m.<a href="#Basemap-drawcoastlines">drawcoastlines</a>() # draw coastlines<br>
>>> m.<a href="#Basemap-drawmapboundary">drawmapboundary</a>() # draw a line around the map region<br>
>>> m.<a href="#Basemap-drawparallels">drawparallels</a>(arange(-90.,120.,30.),labels=[1,0,0,0]) # draw parallels<br>
>>> m.<a href="#Basemap-drawmeridians">drawmeridians</a>(arange(0.,420.,60.),labels=[0,0,0,1]) # draw meridians<br>
>>> title('Robinson Projection') # add a title<br>
>>> show()<br>
<br>
[this example (simpletest.py) plus many others can be found in the<br>
examples directory of source distribution. The "OO" version of this<br>
example (which does not use pylab) is called "simpletest_oo.py".]<br>
<br>
Contact: Jeff Whitaker <jeffrey.s.whitaker@noaa.gov><br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Basemap-__call__"><strong>__call__</strong></a>(self, x, y, inverse<font color="#909090">=False</font>)</dt><dd><tt>Calling a <a href="#Basemap">Basemap</a> class instance with the arguments lon, lat will<br>
convert lon/lat (in degrees) to x/y native map projection<br>
coordinates (in meters). If optional keyword 'inverse' is<br>
True (default is False), the inverse transformation from x/y<br>
to lon/lat is performed.<br>
<br>
For cylindrical equidistant projection ('cyl'), this<br>
does nothing (i.e. x,y == lon,lat).<br>
<br>
For non-cylindrical projections, the inverse transformation<br>
always returns longitudes between -180 and 180 degrees. For<br>
cylindrical projections (self.<strong>projection</strong> == 'cyl','mill' or 'merc')<br>
the inverse transformation will return longitudes between<br>
self.<strong>llcrnrlon</strong> and self.<strong>llcrnrlat</strong>.<br>
<br>
input arguments lon, lat can be either scalar floats or N arrays.</tt></dd></dl>
<dl><dt><a name="Basemap-__init__"><strong>__init__</strong></a>(self, llcrnrlon<font color="#909090">=None</font>, llcrnrlat<font color="#909090">=None</font>, urcrnrlon<font color="#909090">=None</font>, urcrnrlat<font color="#909090">=None</font>, width<font color="#909090">=None</font>, height<font color="#909090">=None</font>, projection<font color="#909090">='cyl'</font>, resolution<font color="#909090">='c'</font>, area_thresh<font color="#909090">=None</font>, rsphere<font color="#909090">=6370997.0</font>, lat_ts<font color="#909090">=None</font>, lat_1<font color="#909090">=None</font>, lat_2<font color="#909090">=None</font>, lat_0<font color="#909090">=None</font>, lon_0<font color="#909090">=None</font>, lon_1<font color="#909090">=None</font>, lon_2<font color="#909090">=None</font>, suppress_ticks<font color="#909090">=True</font>, boundinglat<font color="#909090">=None</font>, anchor<font color="#909090">='C'</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>create a <a href="#Basemap">Basemap</a> instance.<br>
<br>
arguments:<br>
<br>
projection - map projection. 'cyl' - cylindrical equidistant, 'merc' -<br>
mercator, 'lcc' - lambert conformal conic, 'stere' - stereographic,<br>
'npstere' - stereographic, special case centered on north pole.<br>
'spstere' - stereographic, special case centered on south pole,<br>
'aea' - albers equal area conic, 'tmerc' - transverse mercator,<br>
'aeqd' - azimuthal equidistant, 'mill' - miller cylindrical,<br>
'npaeqd' - azimuthal equidistant, special case centered on north pole,<br>
'spaeqd' - azimuthal equidistant, special case centered on south pole,<br>
'eqdc' - equidistant conic, 'laea' - lambert azimuthal equal area,<br>
'nplaea' - lambert azimuthal, special case centered on north pole,<br>
'splaea' - lambert azimuthal, special case centered on south pole,<br>
'cass' - cassini-soldner (transverse cylindrical equidistant),<br>
'poly' - polyconic, 'omerc' - oblique mercator, 'ortho' - orthographic,<br>
'sinu' - sinusoidal, 'moll' - mollweide, 'robin' - robinson,<br>
and 'gnom' - gnomonic are currently available. Default 'cyl'.<br>
<br>
The map projection region can either be specified by setting these keywords:<br>
<br>
llcrnrlon - longitude of lower left hand corner of the desired map domain (degrees).<br>
llcrnrlat - latitude of lower left hand corner of the desired map domain (degrees).<br>
urcrnrlon - longitude of upper right hand corner of the desired map domain (degrees).<br>
urcrnrlat - latitude of upper right hand corner of the desired map domain (degrees).<br>
<br>
or these keywords:<br>
<br>
width - width of desired map domain in projection coordinates (meters).<br>
height - height of desired map domain in projection coordinates (meters).<br>
lon_0 - center of desired map domain (in degrees).<br>
lat_0 - center of desired map domain (in degrees).<br>
<br>
For 'ortho', 'sinu', 'moll', 'npstere', 'spstere', 'nplaea', 'splaea', 'nplaea', <br>
'splaea', 'npaeqd', 'spaeqd' or 'robin', the values of <br>
llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat,width and height are ignored (because <br>
either they are computed internally, or entire globe is always plotted). For the <br>
cylindrical projections ('cyl','merc' and 'mill'), the default is to use <br>
llcrnrlon=-180,llcrnrlat=-90, urcrnrlon=180 and urcrnrlat=90). For all other <br>
projections, either the lat/lon values of the corners or width and height must be <br>
specified by the user. <br>
<br>
resolution - resolution of boundary database to use. Can be 'c' (crude),<br>
'l' (low), 'i' (intermediate), 'h' (high), or None. Default is 'c'.<br>
If None, no boundary data will be read in (and class methods<br>
such as drawcoastlines will raise an exception if invoked).<br>
Resolution drops off by roughly 80%<br>
between datasets. Higher res datasets are much slower to draw.<br>
Default 'c'. Coastline data is from the GSHHS<br>
(<a href="http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html">http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html</a>).<br>
State, country and river datasets from the Generic Mapping<br>
Tools (<a href="http://gmt.soest.hawaii.edu">http://gmt.soest.hawaii.edu</a>).<br>
<br>
area_thresh - coastline or lake with an area smaller than area_thresh<br>
in km^2 will not be plotted. Default 10000,1000,100,10 for resolution<br>
'c','l','i','h'.<br>
<br>
rsphere - radius of the sphere used to define map projection (default<br>
6370997 meters, close to the arithmetic mean radius of the earth). If<br>
given as a sequence, the first two elements are interpreted as<br>
the the radii of the major and minor axes of an ellipsoid. Note: sometimes<br>
an ellipsoid is specified by the major axis and an 'inverse flattening<br>
parameter' (if). The minor axis (b) can be computed from the major axis (a)<br>
and the inverse flattening parameter using the formula if = a/(a-b).<br>
<br>
suppress_ticks - suppress automatic drawing of axis ticks and labels<br>
in map projection coordinates. Default False, so parallels and meridians<br>
can be labelled instead. If parallel or meridian labelling is requested<br>
(using drawparallels and drawmeridians methods), automatic tick labelling<br>
will be supressed even is suppress_ticks=False. Typically, you will<br>
only want to override the default if you want to label the axes in meters<br>
using native map projection coordinates.<br>
<br>
anchor - determines how map is placed in axes rectangle (passed to<br>
axes.set_aspect). Default is 'C', which means map is centered.<br>
Allowed values are ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'].<br>
<br>
ax - set default axes instance (default None - pylab.gca() may be used<br>
to get the current axes instance). If you don't want pylab to be imported,<br>
you can either set this to a pre-defined axes instance, or use the 'ax'<br>
keyword in each <a href="#Basemap">Basemap</a> method call that does drawing. In the first case,<br>
all <a href="#Basemap">Basemap</a> method calls will draw to the same axes instance. In the<br>
second case, you can draw to different axes with the same <a href="#Basemap">Basemap</a> instance.<br>
You can also use the 'ax' keyword in individual method calls to<br>
selectively override the default axes instance.<br>
<br>
The following parameters are map projection parameters which all default to<br>
None. Not all parameters are used by all projections, some are ignored.<br>
<br>
lat_ts - latitude of natural origin (used for mercator, and <br>
optionally for stereographic projection).<br>
lat_1 - first standard parallel for lambert conformal, albers<br>
equal area projection and equidistant conic projections. Latitude of one<br>
of the two points on the projection centerline for oblique mercator.<br>
If lat_1 is not given, but lat_0 is, lat_1 is set to lat_0 for<br>
lambert conformal, albers equal area and equidistant conic.<br>
lat_2 - second standard parallel for lambert conformal, albers<br>
equal area projection and equidistant conic projections. Latitude of one<br>
of the two points on the projection centerline for oblique mercator.<br>
If lat_2 is not given, it is set to lat_1 for <br>
lambert conformal, albers equal area and equidistant conic.<br>
lon_1 - longitude of one of the two points on the projection centerline<br>
for oblique mercator.<br>
lon_2 - longitude of one of the two points on the projection centerline<br>
for oblique mercator.<br>
lat_0 - central latitude (y-axis origin) - used by all projections, <br>
lon_0 - central meridian (x-axis origin) - used by all projections,<br>
boundinglat - bounding latitude for pole-centered projections (npstere,spstere,<br>
nplaea,splaea,npaeqd,spaeqd). These projections are square regions centered<br>
on the north or south pole. The longitude lon_0 is at 6-o'clock, and the<br>
latitude circle boundinglat is tangent to the edge of the map at lon_0.</tt></dd></dl>
<dl><dt><a name="Basemap-contour"><strong>contour</strong></a>(self, x, y, data, *args, **kwargs)</dt><dd><tt>Make a contour plot over the map (see pylab.contour documentation).<br>
extra keyword 'ax' can be used to override the default axis instance.</tt></dd></dl>
<dl><dt><a name="Basemap-contourf"><strong>contourf</strong></a>(self, x, y, data, *args, **kwargs)</dt><dd><tt>Make a filled contour plot over the map (see pylab.contourf documentation).<br>
If x or y are outside projection limb (i.e. they have values > 1.e20),<br>
the corresponing data elements will be masked.<br>
Extra keyword 'ax' can be used to override the default axis instance.</tt></dd></dl>
<dl><dt><a name="Basemap-drawcoastlines"><strong>drawcoastlines</strong></a>(self, linewidth<font color="#909090">=1.0</font>, color<font color="#909090">='k'</font>, antialiased<font color="#909090">=1</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>Draw coastlines.<br>
<br>
linewidth - coastline width (default 1.)<br>
color - coastline color (default black)<br>
antialiased - antialiasing switch for coastlines (default True).<br>
ax - axes instance (overrides default axes instance)</tt></dd></dl>
<dl><dt><a name="Basemap-drawcountries"><strong>drawcountries</strong></a>(self, linewidth<font color="#909090">=0.5</font>, color<font color="#909090">='k'</font>, antialiased<font color="#909090">=1</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>Draw country boundaries.<br>
<br>
linewidth - country boundary line width (default 0.5)<br>
color - country boundary line color (default black)<br>
antialiased - antialiasing switch for country boundaries (default True).<br>
ax - axes instance (overrides default axes instance)</tt></dd></dl>
<dl><dt><a name="Basemap-drawgreatcircle"><strong>drawgreatcircle</strong></a>(self, lon1, lat1, lon2, lat2, dtheta<font color="#909090">=0.02</font>, **kwargs)</dt><dd><tt>draw a great circle on the map.<br>
<br>
lon1,lat1 - longitude,latitude of one endpoint of the great circle.<br>
lon2,lat2 - longitude,latitude of the other endpoint of the great circle.<br>
dtheta - points on great circle computed every dtheta radians (default 0.02).<br>
<br>
Other keyword arguments (**kwargs) control plotting of great circle line,<br>
see pylab.plot documentation for details.<br>
<br>
Note: cannot handle situations in which the great circle intersects<br>
the edge of the map projection domain, and then re-enters the domain.</tt></dd></dl>
<dl><dt><a name="Basemap-drawlsmask"><strong>drawlsmask</strong></a>(self, rgba_land, rgba_ocean, lsmask<font color="#909090">=None</font>, lsmask_lons<font color="#909090">=None</font>, lsmask_lats<font color="#909090">=None</font>, lakes<font color="#909090">=False</font>, **kwargs)</dt><dd><tt>draw land-sea mask image.<br>
<br>
land is colored with rgba integer tuple rgba_land.<br>
ocean is colored with rgba integer tuple rgba_ocean.<br>
<br>
For example, to color oceans blue and land green, use<br>
rgba_ocean = (0,0,255,255) and rgba_land = (0,255,0,255).<br>
To make oceans transparent (useful if you just want to mask land<br>
regions over another image), use rgba_ocean = (0,0,255,0).<br>
<br>
If lakes=True, inland lakes are also colored with <br>
rgba_ocean (default is lakes=False).<br>
<br>
Default land-sea mask is from<br>
<a href="http://www.ngdc.noaa.gov/seg/cdroms/graham/graham/graham.htm">http://www.ngdc.noaa.gov/seg/cdroms/graham/graham/graham.htm</a><br>
and has 5-minute resolution.<br>
<br>
To specify your own global land-sea mask, set the <br>
lsmask keyword to a (nlats, nlons) array<br>
with 0's for ocean pixels, 1's for land pixels and<br>
optionally 2's for inland lake pixels.<br>
The lsmask_lons keyword should be a 1-d array<br>
with the longitudes of the mask, lsmask_lats should be<br>
a 1-d array with the latitudes. Longitudes should be ordered<br>
from -180 W eastward, latitudes from -90 S northward.<br>
If any of the lsmask, lsmask_lons or lsmask_lats keywords are not<br>
set, the default land-sea mask is used.<br>
<br>
extra keyword 'ax' can be used to override the default axis instance.</tt></dd></dl>
<dl><dt><a name="Basemap-drawmapboundary"><strong>drawmapboundary</strong></a>(self, color<font color="#909090">='k'</font>, linewidth<font color="#909090">=1.0</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>draw boundary around map projection region. If ax=None (default),<br>
default axis instance is used, otherwise specified axis instance is used.</tt></dd></dl>
<dl><dt><a name="Basemap-drawmeridians"><strong>drawmeridians</strong></a>(self, meridians, color<font color="#909090">='k'</font>, linewidth<font color="#909090">=1.0</font>, linestyle<font color="#909090">='--'</font>, dashes<font color="#909090">=[1, 1]</font>, labels<font color="#909090">=[0, 0, 0, 0]</font>, fmt<font color="#909090">='%g'</font>, xoffset<font color="#909090">=None</font>, yoffset<font color="#909090">=None</font>, ax<font color="#909090">=None</font>, **kwargs)</dt><dd><tt>draw meridians (longitude lines).<br>
<br>
meridians - list containing longitude values to draw (in degrees).<br>
color - color to draw meridians (default black).<br>
linewidth - line width for meridians (default 1.)<br>
linestyle - line style for meridians (default '--', i.e. dashed).<br>
dashes - dash pattern for meridians (default [1,1], i.e. 1 pixel on,<br>
1 pixel off).<br>
labels - list of 4 values (default [0,0,0,0]) that control whether<br>
meridians are labelled where they intersect the left, right, top or<br>
bottom of the plot. For example labels=[1,0,0,1] will cause meridians<br>
to be labelled where they intersect the left and bottom of the plot,<br>
but not the right and top.<br>
fmt is a format string to format the meridian labels (default '%g').<br>
xoffset - label offset from edge of map in x-direction<br>
(default is 0.01 times width of map in map projection coordinates).<br>
yoffset - label offset from edge of map in y-direction<br>
(default is 0.01 times height of map in map projection coordinates).<br>
ax - axes instance (overrides default axes instance)<br>
<br>
additional keyword arguments control text properties for labels (see<br>
pylab.text documentation)</tt></dd></dl>
<dl><dt><a name="Basemap-drawparallels"><strong>drawparallels</strong></a>(self, circles, color<font color="#909090">='k'</font>, linewidth<font color="#909090">=1.0</font>, linestyle<font color="#909090">='--'</font>, dashes<font color="#909090">=[1, 1]</font>, labels<font color="#909090">=[0, 0, 0, 0]</font>, fmt<font color="#909090">='%g'</font>, xoffset<font color="#909090">=None</font>, yoffset<font color="#909090">=None</font>, ax<font color="#909090">=None</font>, **kwargs)</dt><dd><tt>draw parallels (latitude lines).<br>
<br>
circles - list containing latitude values to draw (in degrees).<br>
color - color to draw parallels (default black).<br>
linewidth - line width for parallels (default 1.)<br>
linestyle - line style for parallels (default '--', i.e. dashed).<br>
dashes - dash pattern for parallels (default [1,1], i.e. 1 pixel on,<br>
1 pixel off).<br>
labels - list of 4 values (default [0,0,0,0]) that control whether<br>
parallels are labelled where they intersect the left, right, top or<br>
bottom of the plot. For example labels=[1,0,0,1] will cause parallels<br>
to be labelled where they intersect the left and bottom of the plot,<br>
but not the right and top.<br>
fmt is a format string to format the parallel labels (default '%g').<br>
xoffset - label offset from edge of map in x-direction<br>
(default is 0.01 times width of map in map projection coordinates).<br>
yoffset - label offset from edge of map in y-direction<br>
(default is 0.01 times height of map in map projection coordinates).<br>
ax - axes instance (overrides default axes instance)<br>
<br>
additional keyword arguments control text properties for labels (see<br>
pylab.text documentation)</tt></dd></dl>
<dl><dt><a name="Basemap-drawrivers"><strong>drawrivers</strong></a>(self, linewidth<font color="#909090">=0.5</font>, color<font color="#909090">='k'</font>, antialiased<font color="#909090">=1</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>Draw major rivers.<br>
<br>
linewidth - river boundary line width (default 0.5)<br>
color - river boundary line color (default black)<br>
antialiased - antialiasing switch for river boundaries (default True).<br>
ax - axes instance (overrides default axes instance)</tt></dd></dl>
<dl><dt><a name="Basemap-drawstates"><strong>drawstates</strong></a>(self, linewidth<font color="#909090">=0.5</font>, color<font color="#909090">='k'</font>, antialiased<font color="#909090">=1</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>Draw state boundaries in Americas.<br>
<br>
linewidth - state boundary line width (default 0.5)<br>
color - state boundary line color (default black)<br>
antialiased - antialiasing switch for state boundaries (default True).<br>
ax - axes instance (overrides default axes instance)</tt></dd></dl>
<dl><dt><a name="Basemap-fillcontinents"><strong>fillcontinents</strong></a>(self, color<font color="#909090">='0.8'</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>Fill continents.<br>
<br>
color - color to fill continents (default gray).<br>
ax - axes instance (overrides default axes instance)<br>
<br>
After filling continents, lakes are re-filled with axis background color.</tt></dd></dl>
<dl><dt><a name="Basemap-gcpoints"><strong>gcpoints</strong></a>(self, lon1, lat1, lon2, lat2, npoints)</dt><dd><tt>compute npoints points along a great circle with endpoints<br>
(lon1,lat1) and (lon2,lat2). Returns arrays x,y<br>
with map projection coordinates.</tt></dd></dl>
<dl><dt><a name="Basemap-imshow"><strong>imshow</strong></a>(self, *args, **kwargs)</dt><dd><tt>Display an image over the map (see pylab.imshow documentation).<br>
extent and origin keywords set automatically so image will be drawn<br>
over map region.<br>
extra keyword 'ax' can be used to override the default axis instance.</tt></dd></dl>
<dl><dt><a name="Basemap-makegrid"><strong>makegrid</strong></a>(self, nx, ny, returnxy<font color="#909090">=False</font>)</dt><dd><tt>return arrays of shape (ny,nx) containing lon,lat coordinates of<br>
an equally spaced native projection grid.<br>
if returnxy = True, the x,y values of the grid are returned also.</tt></dd></dl>
<dl><dt><a name="Basemap-pcolor"><strong>pcolor</strong></a>(self, x, y, data, **kwargs)</dt><dd><tt>Make a pseudo-color plot over the map.<br>
see pylab.pcolor documentation for definition of **kwargs<br>
If x or y are outside projection limb (i.e. they have values > 1.e20)<br>
they will be convert to masked arrays with those values masked.<br>
As a result, those values will not be plotted.<br>
extra keyword 'ax' can be used to override the default axis instance.</tt></dd></dl>
<dl><dt><a name="Basemap-pcolormesh"><strong>pcolormesh</strong></a>(self, x, y, data, **kwargs)</dt><dd><tt>Make a pseudo-color plot over the map.<br>
see pylab.pcolormesh documentation for definition of **kwargs<br>
Unlike pcolor, pcolormesh cannot handle masked arrays, and so<br>
cannot be used to plot data when the grid lies partially outside<br>
the projection limb (use pcolor or contourf instead).<br>
extra keyword 'ax' can be used to override the default axis instance.</tt></dd></dl>
<dl><dt><a name="Basemap-plot"><strong>plot</strong></a>(self, *args, **kwargs)</dt><dd><tt>Draw lines and/or markers on the map (see pylab.plot documentation).<br>
extra keyword 'ax' can be used to override the default axis instance.</tt></dd></dl>
<dl><dt><a name="Basemap-quiver"><strong>quiver</strong></a>(self, x, y, u, v, *args, **kwargs)</dt><dd><tt>Make a vector plot (u, v) with arrows on the map.<br>
<br>
Extra arguments (*args and **kwargs) passed to quiver Axes method (see<br>
pylab.quiver documentation for details).<br>
extra keyword 'ax' can be used to override the default axis instance.</tt></dd></dl>
<dl><dt><a name="Basemap-readshapefile"><strong>readshapefile</strong></a>(self, shapefile, name, drawbounds<font color="#909090">=True</font>, linewidth<font color="#909090">=0.5</font>, color<font color="#909090">='k'</font>, antialiased<font color="#909090">=1</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>read in shape file, draw boundaries on map.<br>
<br>
Restrictions:<br>
- Assumes shapes are 2D<br>
- vertices must be in geographic (lat/lon) coordinates.<br>
<br>
shapefile - path to shapefile components. Example:<br>
shapefile='/home/jeff/esri/world_borders' assumes that<br>
world_borders.shp, world_borders.shx and world_borders.dbf<br>
live in /home/jeff/esri.<br>
name - name for <a href="#Basemap">Basemap</a> attribute to hold the shapefile<br>
vertices in native map projection coordinates.<br>
Class attribute name+'_info' is a list of dictionaries, one<br>
for each shape, containing attributes of each shape from dbf file.<br>
For example, if name='counties', self.<strong>counties</strong><br>
will be a list of vertices for each shape in map projection<br>
coordinates and self.<strong>counties_info</strong> will be a list of dictionaries<br>
with shape attributes. Rings in individual shapes are split out<br>
into separate polygons. Additional keys<br>
'RINGNUM' and 'SHAPENUM' are added to shape attribute dictionary.<br>
drawbounds - draw boundaries of shapes (default True)<br>
linewidth - shape boundary line width (default 0.5)<br>
color - shape boundary line color (default black)<br>
antialiased - antialiasing switch for shape boundaries (default True).<br>
ax - axes instance (overrides default axes instance)<br>
<br>
returns a tuple (num_shapes, type, min, max) containing shape file info.<br>
num_shapes is the number of shapes, type is the type code (one of<br>
the SHPT* constants defined in the shapelib module, see<br>
<a href="http://shapelib.maptools.org/shp_api.html">http://shapelib.maptools.org/shp_api.html</a>) and min and<br>
max are 4-element lists with the minimum and maximum values of the<br>
vertices.</tt></dd></dl>
<dl><dt><a name="Basemap-rotate_vector"><strong>rotate_vector</strong></a>(self, uin, vin, lons, lats, returnxy<font color="#909090">=False</font>)</dt><dd><tt>rotate a vector field (uin,vin) on a rectilinear lat/lon grid<br>
with longitudes = lons and latitudes = lats from geographical into map<br>
projection coordinates.<br>
<br>
Differs from transform_vector in that no interpolation is done,<br>
the vector is returned on the same lat/lon grid, but rotated into<br>
x,y coordinates.<br>
<br>
lons, lats must be rank-2 arrays containing longitudes and latitudes<br>
(in degrees) of grid.<br>
<br>
if returnxy=True, the x and y values of the lat/lon grid<br>
are also returned (default False).<br>
<br>
The input vector field is defined in spherical coordinates (it<br>
has eastward and northward components) while the output<br>
vector field is rotated to map projection coordinates (relative<br>
to x and y). The magnitude of the vector is preserved.</tt></dd></dl>
<dl><dt><a name="Basemap-scatter"><strong>scatter</strong></a>(self, *args, **kwargs)</dt><dd><tt>Plot points with markers on the map (see pylab.scatter documentation).<br>
extra keyword 'ax' can be used to override the default axes instance.</tt></dd></dl>
<dl><dt><a name="Basemap-set_axes_limits"><strong>set_axes_limits</strong></a>(self, ax<font color="#909090">=None</font>)</dt><dd><tt>Set axis limits, fix aspect ratio for map domain using current<br>
or specified axes instance.</tt></dd></dl>
<dl><dt><a name="Basemap-transform_scalar"><strong>transform_scalar</strong></a>(self, datin, lons, lats, nx, ny, returnxy<font color="#909090">=False</font>, checkbounds<font color="#909090">=False</font>, order<font color="#909090">=1</font>, masked<font color="#909090">=False</font>)</dt><dd><tt>interpolate a scalar field (datin) from a lat/lon grid with longitudes =<br>
lons and latitudes = lats to a (ny,nx) native map projection grid.<br>
Typically used to transform data to map projection coordinates<br>
so it can be plotted on the map with imshow.<br>
<br>
lons, lats must be rank-1 arrays containing longitudes and latitudes<br>
(in degrees) of datin grid in increasing order<br>
(i.e. from dateline eastward, and South Pole northward).<br>
For non-cylindrical projections (those other than<br>
cylindrical equidistant, mercator and miller) <br>
lons must fit within range -180 to 180.<br>
<br>
if returnxy=True, the x and y values of the native map projection grid<br>
are also returned.<br>
<br>
If checkbounds=True, values of lons and lats are checked to see that<br>
they lie within the map projection region. Default is False.<br>
If checkbounds=False, points outside map projection region will<br>
be clipped to values on the boundary if masked=False. If masked=True,<br>
the return value will be a masked array with those points masked.<br>
<br>
The order keyword can be 0 for nearest-neighbor interpolation,<br>
or 1 for bilinear interpolation (default 1).</tt></dd></dl>
<dl><dt><a name="Basemap-transform_vector"><strong>transform_vector</strong></a>(self, uin, vin, lons, lats, nx, ny, returnxy<font color="#909090">=False</font>, checkbounds<font color="#909090">=False</font>, order<font color="#909090">=1</font>, masked<font color="#909090">=False</font>)</dt><dd><tt>rotate and interpolate a vector field (uin,vin) from a lat/lon grid<br>
with longitudes = lons and latitudes = lats to a<br>
(ny,nx) native map projection grid.<br>
<br>
lons, lats must be rank-1 arrays containing longitudes and latitudes<br>
(in degrees) of datin grid in increasing order<br>
(i.e. from dateline eastward, and South Pole northward).<br>
For non-cylindrical projections (those other than<br>
cylindrical equidistant, mercator and miller) <br>
lons must fit within range -180 to 180.<br>
<br>
The input vector field is defined in spherical coordinates (it<br>
has eastward and northward components) while the output<br>
vector field is rotated to map projection coordinates (relative<br>
to x and y). The magnitude of the vector is preserved.<br>
<br>
if returnxy=True, the x and y values of the native map projection grid<br>
are also returned (default False).<br>
<br>
If checkbounds=True, values of lons and lats are checked to see that<br>
they lie within the map projection region. Default is False.<br>
If checkbounds=False, points outside map projection region will<br>
be clipped to values on the boundary if masked=False. If masked=True,<br>
the return value will be a masked array with those points masked.<br>
<br>
The order keyword can be 0 for nearest-neighbor interpolation,<br>
or 1 for bilinear interpolation (default 1).</tt></dd></dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'Basemap' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-addcyclic"><strong>addcyclic</strong></a>(arrin, lonsin)</dt><dd><tt>arrout, lonsout = <a href="#-addcyclic">addcyclic</a>(arrin, lonsin)<br>
<br>
Add cyclic (wraparound) point in longitude.</tt></dd></dl>
<dl><dt><a name="-interp"><strong>interp</strong></a>(datain, xin, yin, xout, yout, checkbounds<font color="#909090">=False</font>, masked<font color="#909090">=False</font>, order<font color="#909090">=1</font>)</dt><dd><tt>dataout = <a href="#-interp">interp</a>(datain,xin,yin,xout,yout,order=1)<br>
<br>
This version uses array indexing and is not compatible with Numeric.<br>
<br>
interpolate data (datain) on a rectilinear grid (with x=xin<br>
y=yin) to a grid with x=xout, y=yout.<br>
<br>
datain is a rank-2 array with 1st dimension corresponding to y,<br>
2nd dimension x.<br>
<br>
xin, yin are rank-1 arrays containing x and y of<br>
datain grid in increasing order.<br>
<br>
xout, yout are rank-2 arrays containing x and y of desired output grid.<br>
<br>
If checkbounds=True, values of xout and yout are checked to see that<br>
they lie within the range specified by xin and xin. Default is False.<br>
If checkbounds=False, and xout,yout are outside xin,yin, interpolated<br>
values will be clipped to values on boundary of input grid (xin,yin)<br>
if masked=False. If masked=True, the return value will be a masked<br>
array with those points masked. If masked is set to a number, then<br>
points outside the range of xin and yin will be set to that number.<br>
<br>
The order keyword can be 0 for nearest-neighbor interpolation,<br>
or 1 for bilinear interpolation (default 1).<br>
<br>
If datain is a masked array and order=1 (bilinear interpolation) is <br>
used, elements of dataout will be masked if any of the four surrounding<br>
points in datain are masked. To avoid this, do the interpolation in two<br>
passes, first with order=1 (producing dataout1), then with order=0<br>
(producing dataout2). Then replace all the masked values in dataout1<br>
with the corresponding elements in dataout2 (using numerix.where).<br>
This effectively uses nearest neighbor interpolation if any of the<br>
four surrounding points in datain are masked, and bilinear interpolation<br>
otherwise.</tt></dd></dl>
<dl><dt><a name="-interp_numeric"><strong>interp_numeric</strong></a>(datain, xin, yin, xout, yout, checkbounds<font color="#909090">=False</font>, masked<font color="#909090">=False</font>, order<font color="#909090">=1</font>)</dt><dd><tt>dataout = <a href="#-interp">interp</a>(datain,xin,yin,xout,yout,order=1)<br>
<br>
This version uses 'take' instead of array indexing, and<br>
thus is compatible with Numeric.<br>
<br>
interpolate data (datain) on a rectilinear grid (with x=xin<br>
y=yin) to a grid with x=xout, y=yout.<br>
<br>
datain is a rank-2 array with 1st dimension corresponding to y,<br>
2nd dimension x.<br>
<br>
xin, yin are rank-1 arrays containing x and y of<br>
datain grid in increasing order.<br>
<br>
xout, yout are rank-2 arrays containing x and y of desired output grid.<br>
<br>
If checkbounds=True, values of xout and yout are checked to see that<br>
they lie within the range specified by xin and xin. Default is False.<br>
If checkbounds=False, and xout,yout are outside xin,yin, interpolated<br>
values will be clipped to values on boundary of input grid (xin,yin)<br>
if masked=False. If masked=True, the return value will be a masked<br>
array with those points masked. If masked is set to a number, then<br>
points outside the range of xin and yin will be set to that number.<br>
<br>
The order keyword can be 0 for nearest-neighbor interpolation,<br>
or 1 for bilinear interpolation (default 1).<br>
<br>
If datain is a masked array and order=1 (bilinear interpolation) is <br>
used, elements of dataout will be masked if any of the four surrounding<br>
points in datain are masked. To avoid this, do the interpolation in two<br>
passes, first with order=1 (producing dataout1), then with order=0<br>
(producing dataout2). Then replace all the masked values in dataout1<br>
with the corresponding elements in dataout2 (using numerix.where).<br>
This effectively uses nearest neighbor interpolation if any of the<br>
four surrounding points in datain are masked, and bilinear interpolation<br>
otherwise.</tt></dd></dl>
<dl><dt><a name="-shiftgrid"><strong>shiftgrid</strong></a>(lon0, datain, lonsin, start<font color="#909090">=True</font>)</dt><dd><tt>shift global lat/lon grid east or west.<br>
assumes wraparound (or cyclic point) is included.<br>
<br>
lon0: starting longitude for shifted grid<br>
(ending longitude if start=False). lon0 must be on<br>
input grid (with the range of lonsin).<br>
datain: original data.<br>
lonsin: original longitudes.<br>
start[True]: if True, lon0 represents the starting longitude<br>
of the new grid. if False, lon0 is the ending longitude.<br>
<br>
returns dataout,lonsout (data and longitudes on shifted grid).</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>__revision__</strong> = '20060831'<br>
<strong>__version__</strong> = '0.9.2'<br>
<strong>isnan</strong> = <ufunc 'isnan'><br>
<strong>matplotlib_version</strong> = '0.87.6'<br>
<strong>mpl_required_version</strong> = '0.87.3'<br>
<strong>rcParams</strong> = {'axes.axisbelow': False, 'axes.edgecolor': 'k', 'axes.facecolor': 'w', 'axes.grid': False, 'axes.hold': True, 'axes.labelcolor': 'k', 'axes.labelsize': 'medium', 'axes.linewidth': 1.0, 'axes.titlesize': 'large', 'backend': 'GTKAgg', ...}</td></tr></table>
@footer@