next up previous contents index
Next: 5.2 Conic Projections Up: 5.1 Non-map Projections Previous: 5.1.4 Geographical linear projection   Contents   Index

5.1.5 Linear Projection with Polar ($\theta , r$) Coordinates (-–Jp -–JP)

Figure 5.5: Polar (Cylindrical) transformation of ($\theta , r$) coordinates
\begin{figure}\centering\epsfig{figure=eps/GMT_polar.eps}\end{figure}

In many applications the data is better described in polar or cylindrical ($\theta$, r) coordinates rather than the usual Cartesian coordinates (x, y). The relationship between the Cartesian and polar coordinates are described by $x = r \cdot \cos{\theta}, y = r \cdot \sin{\theta}$. The polar transformation is simply defined by providing

$\bullet$
scale in inches/unit (-Jp) or full width of plot in inches (-JP)
$\bullet$
Optionally, insert a after p$\vert$P to indicate CW azimuths rather than CCW directions
$\bullet$
Optionally, append /$origin$ in degrees to indicate an angular offset [0]

As an example of this projection we will create a gridded data set in polar coordinates $z(\theta, r) = r^2 \cdot \cos{4\theta}$ using grdmath, a RPN calculator that operates on or creates grdfiles.





#!/bin/sh
#    $Id: GMT_polar.sh,v 1.1 2001/03/21 04:10:21 pwessel Exp $
#

grdmath -R0/360/2/4 -I6/0.1 X 4 MUL PI MUL 180 DIV COS Y 2 POW MUL = test.grd
grdcontour test.grd -JP3i -B30Ns -P -C2 -S4 > GMT_polar.ps





We used grdcontour to make a contour map of this data. Because the data file only contains values with $2 \leq r \leq 4$, a donut shaped plot appears in Figure 5.5.


next up previous contents index
Next: 5.2 Conic Projections Up: 5.1 Non-map Projections Previous: 5.1.4 Geographical linear projection   Contents   Index
Paul Wessel 2001-04-18