702 lines (670 with data), 65.0 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.8)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jdhunter/dev/lib/python2.5/site-packages/matplotlib/toolkits/basemap/basemap.py">/home/jdhunter/dev/lib/python2.5/site-packages/matplotlib/toolkits/basemap/basemap.py</a></font></td></tr></table>
<p><tt>Module for plotting data on maps with matplotlib.<br>
<br>
Contains the <a href="#Basemap">Basemap</a> class (which does most of the <br>
heavy lifting), and the following functions:<br>
<br>
NetCDFFile: Read local and remote NetCDF datasets.<br>
<br>
interp: bilinear interpolation between rectilinear grids.<br>
<br>
shiftgrid: shifts global lat/lon grids east or west.<br>
<br>
addcyclic: Add cyclic (wraparound) point in longitude.</tt></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="_geos.html">_geos</a><br>
<a href="dbflib.html">dbflib</a><br>
<a href="numpy.core.ma.html">numpy.core.ma</a><br>
</td><td width="25%" valign=top><a href="math.html">math</a><br>
<a href="numpy.html">numpy</a><br>
<a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="matplotlib.toolkits.basemap.pupynere.html">matplotlib.toolkits.basemap.pupynere</a><br>
<a href="matplotlib.toolkits.basemap.pyproj.html">matplotlib.toolkits.basemap.pyproj</a><br>
<a href="sys.html">sys</a><br>
</td><td width="25%" valign=top></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>Class for plotting data on map projections with matplotlib.<br>
See __init__ docstring for details on how to create a class<br>
instance for a given map projection.<br>
<br>
Useful instance variables:<br>
<br>
projection - map projection. Print the module variable<br>
"supported_projections" to see a list.<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>
srs - a string representing the 'spatial reference system' for the map<br>
projection as defined by PROJ.4.<br>
<br>
Example Usage:<br>
<br>
>>> from matplotlib.toolkits.basemap import <a href="#Basemap">Basemap</a><br>
>>> from pylab import load, meshgrid, title, arange, show<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> </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>, satellite_height<font color="#909090">=None</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>
This sets up a basemap with specified map projection.<br>
and creates the coastline data structures in native map projection<br>
coordinates.<br>
<br>
arguments:<br>
<br>
projection - map projection. Supported projections are:<br>
'aeqd' = Azimuthal Equidistant<br>
'poly' = Polyconic<br>
'gnom' = Gnomonic<br>
'moll' = Mollweide<br>
'tmerc' = Transverse Mercator<br>
'nplaea' = North-Polar Lambert Azimuthal<br>
'mill' = Miller Cylindrical<br>
'merc' = Mercator<br>
'stere' = Stereographic<br>
'npstere' = North-Polar Stereographic<br>
'geos' = Geostationary<br>
'laea' = Lambert Azimuthal Equal Area<br>
'sinu' = Sinusoidal<br>
'spstere' = South-Polar Stereographic<br>
'lcc' = Lambert Conformal<br>
'npaeqd' = North-Polar Azimuthal Equidistant<br>
'eqdc' = Equidistant Conic<br>
'cyl' = Cylindrical Equidistant<br>
'omerc' = Oblique Mercator<br>
'aea' = Albers Equal Area<br>
'spaeqd' = South-Polar Azimuthal Equidistant<br>
'ortho' = Orthographic<br>
'cass' = Cassini-Soldner<br>
'splaea' = South-Polar Lambert Azimuthal<br>
'robin' = Robinson<br>
<br>
Default is 'cyl'.<br>
<br>
For most map projections, the map projection region can either be<br>
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 '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<br>
(because either they are computed internally, or entire globe is<br>
always plotted). For the cylindrical projections<br>
('cyl','merc' and 'mill'), the default is to use<br>
llcrnrlon=-180,llcrnrlat=-90, urcrnrlon=180 and urcrnrlat=90). For all other<br>
projections except 'ortho' and 'geos', either the lat/lon values of the<br>
corners or width and height must be specified by the user.<br>
For 'ortho' and 'geos', the lat/lon values of the corners may be specified,<br>
but if they are not, the entire globe is plotted.<br>
<br>
resolution - resolution of boundary database to use. Can be 'c' (crude),<br>
'l' (low), 'i' (intermediate), 'h' (high), 'f' (full) or None.<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,1 for resolution<br>
'c','l','i','h','f'.<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. suppress_ticks=False<br>
is useful if you want to use your own custom tick formatter, or<br>
if you want to let matplotlib 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>
The module variable 'projection_params' is a dictionary which<br>
lists which parameters apply to which projections.<br>
<br>
lat_ts - latitude of true scale for mercator projection, optional<br>
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>
Must be equator for mercator projection.<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.<br>
satellite_height - height of satellite (in m) above equator -<br>
only relevant for geostationary projections ('geos').<br>
<br>
Here are the most commonly used class methods (see the docstring<br>
for each for more details):<br>
<br>
To draw a graticule grid (labelled latitude and longitude lines)<br>
use the drawparallels and drawmeridians methods.<br>
<br>
To draw coastline, rivers and political boundaries, use the<br>
the drawcontinents, drawrivers, drawcountries and drawstates methods.<br>
<br>
To fill the continents and inland lakes, use the fillcontinents method.<br>
<br>
To draw the boundary of the map projection region, and fill the <br>
interior a certain color, use the drawmapboundary method.<br>
<br>
The contour, contourf, pcolor, pcolormesh, plot, scatter<br>
quiver and imshow methods use the corresponding matplotlib axes<br>
methods to draw on the map.<br>
<br>
The transform_scalar method can be used to interpolate regular<br>
lat/lon grids of scalar data to native map projection grids.<br>
<br>
The transform_vector method can be used to interpolate and rotate<br>
regular lat/lon grids of vector data to native map projection grids.<br>
<br>
The rotate_vector method rotates a vector field from lat/lon<br>
coordinates into map projections coordinates, without doing any <br>
interpolation.<br>
<br>
The readshapefile method can be used to read in data from ESRI<br>
shapefiles.<br>
<br>
The drawgreatcircle method draws great circles on the map.</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>, zorder<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)<br>
zorder - sets the zorder for the coastlines (if not specified,<br>
uses default zorder for LineCollections).</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>, zorder<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)<br>
zorder - sets the zorder for the country boundaries (if not specified,<br>
uses default zorder for LineCollections).</tt></dd></dl>
<dl><dt><a name="Basemap-drawgreatcircle"><strong>drawgreatcircle</strong></a>(self, lon1, lat1, lon2, lat2, del_s<font color="#909090">=100.0</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>
del_s - points on great circle computed every delta kilometers (default 100).<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>
*Note* the land-sea mask image cannot be overlaid on top<br>
of other images, due to limitations in matplotlib image handling.<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>, fill_color<font color="#909090">=None</font>, zorder<font color="#909090">=None</font>, ax<font color="#909090">=None</font>)</dt><dd><tt>draw boundary around map projection region, optionally<br>
filling interior of region.<br>
<br>
linewidth - line width for boundary (default 1.)<br>
color - color of boundary line (default black)<br>
fill_color - fill the map region background with this<br>
color (default is no fill or fill with axis background color).<br>
zorder - sets the zorder for filling map background<br>
(default 0).<br>
ax - axes instance to use (default None, use default axes <br>
instance).</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>, zorder<font color="#909090">=None</font>, dashes<font color="#909090">=[1, 1]</font>, labels<font color="#909090">=[0, 0, 0, 0]</font>, labelstyle<font color="#909090">=None</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>
zorder - sets the zorder for meridians (if not specified,<br>
uses default zorder for Line2D class).<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>
labelstyle - if set to "+/-", east and west longitudes are labelled<br>
with "+" and "-", otherwise they are labelled with "E" and "W".<br>
fmt can be is a format string to format the meridian labels<br>
(default '%g') or a function that takes a longitude value<br>
in degrees as it's only argument and returns a formatted string.<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>, zorder<font color="#909090">=None</font>, dashes<font color="#909090">=[1, 1]</font>, labels<font color="#909090">=[0, 0, 0, 0]</font>, labelstyle<font color="#909090">=None</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>
zorder - sets the zorder for parallels (if not specified,<br>
uses default zorder for Line2D class).<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>
labelstyle - if set to "+/-", north and south latitudes are labelled<br>
with "+" and "-", otherwise they are labelled with "N" and "S".<br>
fmt can be is a format string to format the parallel labels<br>
(default '%g') or a function that takes a latitude value <br>
in degrees as it's only argument and returns a formatted string.<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>, zorder<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)<br>
zorder - sets the zorder for the rivers (if not specified,<br>
uses default zorder for LineCollections).</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>, zorder<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)<br>
zorder - sets the zorder for the state boundaries (if not specified,<br>
uses default zorder for LineCollections).</tt></dd></dl>
<dl><dt><a name="Basemap-fillcontinents"><strong>fillcontinents</strong></a>(self, color<font color="#909090">='0.8'</font>, lake_color<font color="#909090">=None</font>, ax<font color="#909090">=None</font>, zorder<font color="#909090">=None</font>)</dt><dd><tt>Fill continents.<br>
<br>
color - color to fill continents (default gray).<br>
lake_color - color to fill inland lakes (default axes background).<br>
ax - axes instance (overrides default axes instance).<br>
zorder - sets the zorder for the continent polygons (if not specified,<br>
uses default zorder for a Polygon patch). Set to zero if you want to paint<br>
over the filled continents).<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>
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>, zorder<font color="#909090">=None</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>
zorder = shape boundary zorder (if not specified, default for LineCollection<br>
is used).<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 descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</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="-NetCDFFile"><strong>NetCDFFile</strong></a>(file, maskandscale<font color="#909090">=True</font>)</dt><dd><tt>NetCDF File reader. API is the same as Scientific.IO.NetCDF.<br>
If 'file' is a URL that starts with 'http', it is assumed<br>
to be a remote OPenDAP dataset, and the python dap client is used<br>
to retrieve the data. Only the OPenDAP Array and Grid data<br>
types are recognized. If file does not start with 'http', it<br>
is assumed to be a local file. If possible, the file will be read <br>
with a pure python NetCDF reader, otherwise PyNIO <br>
(<a href="http://www.pyngl.ucar.edu/Nio.shtml">http://www.pyngl.ucar.edu/Nio.shtml</a>) will be used (if it is installed).<br>
PyNIO supports NetCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS2 files.<br>
Data read from OPenDAP and NetCDF version 3 datasets will <br>
automatically be converted to masked arrays if the variable has either<br>
a 'missing_value' or '_FillValue' attribute, and some data points<br>
are equal to the value specified by that attribute. In addition,<br>
variables stored as integers that have the 'scale_factor' and<br>
'add_offset' attribute will automatically be rescaled to floats when<br>
read. If PyNIO is used, neither of the automatic conversions will<br>
be performed. To suppress these automatic conversions, set the<br>
maskandscale keyword to False.</tt></dd></dl>
<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>
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 (within 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>__version__</strong> = '0.9.8'<br>
<strong>basemap_datadir</strong> = '/home/jdhunter/dev/lib/python2.5/site-packages/matplotlib/toolkits/basemap/data'<br>
<strong>has_pynio</strong> = False<br>
<strong>projection_params</strong> = {'aea': 'lon_0,lat_0,lat_1', 'aeqd': 'lon_0,lat_0', 'cass': 'lon_0,lat_0', 'cyl': 'corners only (no width/height)', 'eqdc': 'lon_0,lat_0,lat_1,lat_2', 'geos': 'lon_0,lat_0,satellite_height', 'gnom': 'lon_0,lat_0', 'laea': 'lon_0,lat_0', 'lcc': 'lon_0,lat_0,lat_1,lat_2', 'merc': 'corners plus lat_ts (no width/height)', ...}<br>
<strong>rcParams</strong> = {'figure.subplot.right': 0.90000000000000002, 'm...persize': 'letter', 'svg.embed_char_paths': True}<br>
<strong>supported_projections</strong> = "'aeqd' = Azimuthal Equidistant<font color="#c040c0">\n</font>'poly' = Polyconi...South-Polar Lambert Azimuthal<font color="#c040c0">\n</font>'robin' = Robinson<font color="#c040c0">\n</font>"</td></tr></table>
@footer@