Package gmt :: Module gmt
[show private | hide private]
[frames | no frames]

Module gmt.gmt

Introduction

Python module for creating plots with GMT (Generic Mapping Tools). Provides a pythonic, object-oriented interface to GMT for plotting Numeric arrays. A subset of GMT's plotting capabilities are supported, including:

Download

Requirements

The GMT and ghostscript binaries must be in the unix $PATH.

Example usage

Real examples are included in the source distribution (in the examples directory). Execute the module source code (gmt.py) as a standalone script to run a simple test.

Version: 20041114

Author: Jeffrey Whitaker with contributions from Julien Vienne.

Contact: Jeff Whitaker

Copyright: copyright 2004 by Jeffrey Whitaker.

License: Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Bug: contourfill doesn't work when proj = 'ortho' (use boxfill=True instead).

Classes
GMT Generic Mapping Tools (GMT) plot class.
PanelPlot create multi-panel plots of same-sized figures using the PyX module.

Function Summary
  addcyclic(arrin, lonsin)
add cyclic (wraparound) point in longitude.
  epstoimage(psfile, imgfile, xsize, ysize, format)
converts eps file to png, gif or jpeg.
  getcint(mind, maxd, num_lev)
returns sane contour interval given max,min and approx number of levels.
  readgrd(grdname)
read attributes from a saved grd file, returns dictionary with grd file metadata.
  savegrd(grd, grdname)
save a grd file (otherwise it will be deleted when the close method of the GMT class instance is called).

Function Details

addcyclic(arrin, lonsin)

add cyclic (wraparound) point in longitude.
Parameters:
arrin - input rank-2 Numeric array. 1st dimension is assumed to be latitude, 2nd dimension longitude. Data is assumed to equally equally spaced in longitude.
lonsin - input longitudes (corresponding to second dimension of arrin).
Returns:
arrout - rank-2 Numeric array with cyclic wraparound point added. If input array has shape (nlats,nlons) output array has shape (nlats,nlons+1). lonsout - rank-1 Numeric array with longitudes corresponding to second dimension of arrout. Equal to lonsin with extra value added at end which is identical the lonsin[0].

epstoimage(psfile, imgfile=False, xsize=512, ysize=512, format='png')

converts eps file to png, gif or jpeg. Creates a nicer looking image by increasing the resolution of the postscript by 3, then reducing the size of the resulting image by 1/3 (with blurring). Requires ps2ppm and netpbm. If these are not available, the routine prints and error message and returns 1. If the image is created successfully, returns 0.
Parameters:
psfile - input postscript filename (must end in '.eps').
Keyword Parameters:
imgfile - output image filename. If not specified, image filename is input filename with '.eps' replaced by '.png', '.gif', or '.jpg'.
xsize - width of image in pixels (default 512).
ysize - height of image in pixels (default 512).
format - format of image ('png', 'gif' or 'jpg', default 'png')

getcint(mind, maxd, num_lev)

returns sane contour interval given max,min and approx number of levels.
Parameters:
mind - lowest contour level desired.
maxd - highest contour level desired.
num_lev - approximate number of contour levels desired.
Returns:
cint - contour interval.

readgrd(grdname)

read attributes from a saved grd file, returns dictionary with grd file metadata.
Parameters:
grdname - (string) grdname - name of grd file to read.
Returns:
grdfile - dictionary containing grd file metadata.

savegrd(grd, grdname)

save a grd file (otherwise it will be deleted when the close method of the GMT class instance is called).
Parameters:
grd - dictionary containing grd file metadata (returned from previous wrtgrd or readgrd call).
grdname - (string) copy grd file to file with this name.

Generated by Epydoc 2.1 on Sun Nov 14 07:18:16 2004 http://epydoc.sf.net