next up previous contents index
Next: 6. GMT Map Projections Up: 5. GMT Coordinate Transformations Previous: 5.1.3 Cartesian Power projection   Contents   Index

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

Figure 5.6: Polar (Cylindrical) transformation of ($\theta , r$) coordinates.
\includegraphics[]{eps/GMT_polar}

This transformation converts polar coordinates (angle $\theta$ and radius $r$) to positions on a plot. Now $x' = f(\theta,r)$ and $y' = g(\theta,r)$, hence it is similar to a regular map projection because $x$ and $y$ are coupled and $x$ (i.e., $\theta$) has a 360$^{o}$ periodicity. With input and output points both in the plane it is a two-dimensional projection. The transformation comes in two flavors:

  1. Normally, $\theta$ is understood to be directions counter-clockwise from the horizontal axis, but we may choose to specify an angular offset [whose default value is zero]. We will call this offset $\theta_0$. Then, $x' = f(\theta, r) = ar \cos (\theta-\theta_0) + b$ and $y' = g(\theta, r) = ar \sin (\theta-\theta_0) + c$.
  2. Alternatively, $\theta$ can be interpreted to be azimuths clockwise from the vertical axis, yet we may again choose to specify the angular offset [whose default value is zero]. Then, $x' = f(\theta, r) = ar \cos (90 - (\theta-\theta_0)) + b$ and $y' = g(\theta, r) = ar \sin (90 - (\theta-\theta_0)) + c$.

Consequently, the polar transformation is 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.





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 --PLOT_DEGREE_FORMAT=+ddd > GMT_polar.ps
rm -f test.grd





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.6.


next up previous contents index
Next: 6. GMT Map Projections Up: 5. GMT Coordinate Transformations Previous: 5.1.3 Cartesian Power projection   Contents   Index
Paul Wessel 2006-01-01