IaGraph Examples: Latitude-Longitude Contour Plots

Settings and Data

All examples below use the following import statements, data, and system variable settings. We control the x- and y-axis tick labels via system variables because we wish to express latitude/longitude with N/S, E/W designations. Also, in our example data we set some values to "missing," and change data into a masked array (MA) to accomodate those missing values (missing value value is 1e+20):

>>> import Numeric as N
>>> import IaGraph, MA
>>> from IaGraph import *
>>> lat = N.arange(13) * 15.0 - 90.0
>>> lon = N.arange(25) * 15.0 - 180.0
>>> data = N.outerproduct( N.sin(lat*N.pi/360.) \
...                      , N.cos(lon*N.pi/360.) )
>>> data[3:4,6:8] = 1e+20
>>> data = MA.masked_values(data, 1e+20)
>>> sysvar = IaGraph.Sysvar()
>>> sysvar.__class__.x_tickvalues = \
...     {-180:'180W', -90:'90W', 0:'0', 90:'90E', 180:'180E'}
>>> sysvar.__class__.y_tickvalues = \
...     {-90:'90S', -45:'45S', 0:'EQ', 45:'45N', 90:'90N'}

A link to the full source code for all the examples on this page is at the bottom of this page. For more information on the contour command, type help(contour).


Examples

Default plot with continents

>>> contour(data, lon, lat, continents=1)

Remove color bar, add titles, show continents, and use blue-red color map

>>> contour( data, lon, lat \
...    , ctindex=11 \
...    , colorbar=0 \
...    , title='Example Contour Plot' \
...    , xtitle='Longitude [deg]',ytitle='Latitude [deg]' \
...    , continents=1 )


Full Code For Examples


Return to IaGraph Home Page.
Return to Johnny Lin's Python Library.

Updated: December 19, 2003 by Johnny Lin <email address>. License.