%-----------------------------------------------------------------------
%;  Copyright (C) 1995
%;  Associated Universities, Inc. Washington DC, USA.
%;
%;  This program is free software; you can redistribute it and/or
%;  modify it under the terms of the GNU General Public License as
%;  published by the Free Software Foundation; either version 2 of
%;  the License, or (at your option) any later version.
%;
%;  This program is distributed in the hope that it will be useful,
%;  but WITHOUT ANY WARRANTY; without even the implied warranty of
%;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%;  GNU General Public License for more details.
%;
%;  You should have received a copy of the GNU General Public
%;  License along with this program; if not, write to the Free
%;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
%;  MA 02139, USA.
%;
%;  Correspondence concerning AIPS should be addressed as follows:
%;          Internet email: aipsmail@nrao.edu.
%;          Postal address: AIPS Project Office
%;                          National Radio Astronomy Observatory
%;                          520 Edgemont Road
%;                          Charlottesville, VA 22903-2475 USA
%-----------------------------------------------------------------------
\documentstyle [twoside]{article}
\input psfig
\newcommand{\memnum}{46}
\newcommand{\memtit}{Additional Non-linear Coordinates in \AIPS}
\title{
%   \hphantom{Hello World} \\
   \vskip -35pt
   \fbox{AIPS Memo \memnum} \\
   \vskip 28pt
   \memtit \\
    Reissue of May 1986 version \\}
\author{Eric W. Greisen\thanks{National Radio Astronomy Observatory}}
%\input doctxt:amemo.mac  gnu
\newcommand{\da}{\Delta\alpha}
\newcommand{\hda}{(\Delta\alpha/2)}
\newcommand{\fa}{f_{\alpha}}
\newcommand{\fd}{f_{\delta}}
\newcommand{\Da}{\Delta_{\alpha}}
\newcommand{\Dd}{\Delta_{\delta}}
%
%
\newcommand{\AIPS}{{$\cal AIPS\/$}}
\newcommand{\POPS}{{$\cal POPS\/$}}
\newcommand{\eg}{{\it e.g.},}
\newcommand{\ie}{{\it i.e.},}
\newcommand{\daemon}{d\ae mon}
\newcommand{\boxit}[3]{\vbox{\hrule height#1\hbox{\vrule width#1\kern#2%
\vbox{\kern#2{#3}\kern#2}\kern#2\vrule width#1}\hrule height#1}}
%
\newcommand{\sign}{\hbox{sign}}
\newcommand{\Vobs}{V_{\hbox{\scriptsize OBS}}}
\newcommand{\vobs}{v_{\hbox{\scriptsize OBS}}}
\newcommand{\V}{{\hbox{\scriptsize V}}}
\newcommand{\s}{{\hbox{\scriptsize S}}}
\newcommand{\G}{{\hbox{\scriptsize G}}}
\newcommand{\GAL}{{\hbox{\scriptsize GAL}}}
\newcommand{\CEL}{{\hbox{\scriptsize CEL}}}
%
\parskip 4mm
\linewidth 6.5in
\textwidth 6.5in                     % text width excluding margin
\textheight 8.81 in
\marginparsep 0in
\oddsidemargin .25in                 % EWG from -.25
\evensidemargin -.25in
\topmargin -.5in
\headsep 0.25in
\headheight 0.25in
\parindent 0in
\newcommand{\normalstyle}{\baselineskip 4mm \parskip 2mm \normalsize}
\newcommand{\tablestyle}{\baselineskip 2mm \parskip 1mm \small }
%
%
\begin{document}

\pagestyle{myheadings}
\thispagestyle{empty}

\newcommand{\Rheading}{\AIPS\ Memo \memnum \hfill \memtit \hfill Page~~}
\newcommand{\Lheading}{~~Page \hfill \memtit \hfill \AIPS\ Memo \memnum}
\markboth{\Lheading}{\Rheading}
%
%

\vskip -.5cm
\pretolerance 10000
\listparindent 0cm
\labelsep 0cm
%
%

\vskip -30pt
\maketitle
\vskip -30pt
\normalstyle

\begin{abstract}
Four additional non-linear coordinate types have been added to \AIPS.
These are the stereographic projective geometry and the non-projective
Aitoff, ``global-sinusoidal'' and Mercator geometries appropriate to
the display of very large fields.

{\bf Added January 1993: It is the author's current opinion that the
generalizations of these coordinates to non-null reference values,
given below, is not the most desirable.  A new and more functional
generalization is explicated in the 1993 proposed FITS conventions.
Substantial changes from this memo to the 1993 proposal are footnoted
where appropriate.}
\end{abstract}

\section{Introduction}

     In \AIPS\ Memo No.~27 (1983), the basic non-linear coordinates
used in \AIPS\ were described.  These included three projective,
tangent-plane geometries called SIN, TAN, and ARC, descriptive of the
form of the projection.  An additional geometry using a projection to
a plane tangent to the pole was also described.  In the {\tt 15JUL86}
release of \AIPS, four additional non-linear geometries are supported.
These are the stereographic projective geometry and the non-projective
Aitoff, ``global-sinusoidal'' and Mercator geometries appropriate to
the display of very large fields.  This memorandum describes the
algebra and \AIPS\ parameters used in this implementation.

\section{The Coordinates}

     Like the SIN, TAN, and ARC geometries, the stereographic geometry
is a true projection to a plane tangent to the celestial sphere at the
reference pixel.  It is a tangent projection from the opposite side of
the celestial sphere; the TAN projection is a projection from the
center  of the sphere.  The stereographic projection has the attribute
that celestial circles remain circles in the projected image and is
also useful for displaying polar regions and large fields.

   The Aitoff system has been used with IRAS data and is intended to
be one of the primary systems used for large-field imagery from the
Space Telescope.  The global-sinusoidal coordinate system is an
obvious system in astronomy and is usually what people mean when they
assert that their coordinates are $\alpha$--$\delta$.  Both of these
projections have the ``equal-area'' property; this means that a unit
area on the sky (\eg\ one square spherical arc second) anywhere in the
field of view projects to a constant number of pixels in the digital
image.  None of the four projections described in \AIPS\ Memo No.~27
has this property, nor does the stereographic and Mercator projections
described below.  Equal-area projections conserve both the numerical
values of surface brightness and fluxes integrated over areas, making
them suitable for most forms of photometric analysis.  However, they
distort angular relationships and, hence, shapes, especially near the
poles.  The global sinusoidal geometry has the advantage of
simplicity, but the distortions are less severe in the Aitoff geometry.

     The Mercator system is sometimes used in planetary studies and
was developed as an aid to navigation.  It has the property that
``rhumb'' lines are straight, where a rhumb line is the trajectory
produced by maintaining a constant compass reading as latitude
changes.  In general, arcs of great circles are more interesting in
astronomy and appear as straight lines in the gnomic projection
(called TAN in \AIPS).  The four new systems will be referred to here
by their initials --- STG, GLS, AIT, and MER, respectively.

     In a plane, the position of a point $(x,y\,)$ with respect to the
coordinate reference point in an arbitrary linear system may be
represented as
\begin{equation}
\begin{array}{lcl}
  x & = &L\cos\rho+M\sin\rho \\
  y & = &M\cos\rho-L\sin\rho \, ,
\end{array}
\label{eq:xy=LM}
\end{equation}
or
\begin{equation}
\begin{array}{lcl}
  L & = &x\cos\rho - y \sin\rho \\
  M & = &y\cos\rho + x \sin\rho \, ,
\end{array}
\label{eq:LM=xy}
\end{equation}
where $\rho$ is a rotation, $L$ is the direction cosine parallel to
latitude at the reference pixel, and $M$ is the direction cosine
parallel to longitude at the reference pixel.  Both the $(x,y\,)$ and
$(L,M)$ systems are simple linear, perpendicular systems.  If we
represent longitude and latitude with the symbols $\alpha$ and
$\delta$, the fun arises in solving the four problems: ($i$) given
$\alpha,\delta$ find  $x,y\,$; ($ii$) given $x,y\,$ find
$\alpha,\delta\,$; ($iii$) given $x,\delta$ find $\alpha,y\,$; and
($iv$) given $\alpha,y$ find $x,\delta$.  The solutions to these
problems for the three new coordinate systems are given in the
sections below.  In the derivations, I will use the definitions
$\da \equiv \alpha - \alpha_0$ and $\Delta\delta \equiv
\delta - \delta_0$ for simplicity and the subscript $0$ to refer to
quantities evaluated at the reference pixel.

\subsection{STG geometry}
\subsubsection{Find $x,y$ from $\alpha,\delta$}

     The STG geometry requires the usual basic formul\ae\ from
spherical triangles:
\begin{eqnarray}
 \cos\theta & = &\sin\delta\sin\delta_0+\cos\delta \cos\delta_0
                 \cos\Delta \alpha  \label{eq:cost}\\
 \sin\theta \sin\phi & = &\cos\delta \sin\da  \label{eq:ssinp}\\
 \sin\theta \cos\phi & = &\sin\delta \cos\delta_0 - \cos\delta
                  \sin\delta_0 \cos\da \, .  \label{eq:scosp}
\end{eqnarray}
A simple extension of Figure 1 in \AIPS\ Memo No.~27 followed by
simple trigonometry yields the projections
\begin{eqnarray}
   L & = &2\,\frac{\sin\theta}{1+\cos\theta} \sin\phi \nonumber \\
 \noalign{\vskip 0.8pt}
   M & = &2\,\frac{\sin\theta}{1+\cos\theta}\cos\phi \label{eq:STGLM1}
\end{eqnarray}
or, substituting equations~\ref{eq:cost}, \ref{eq:ssinp}, and
\ref{eq:scosp},
\begin{eqnarray}
   L & = &2\,\frac{\cos\delta\sin\da}{1+\sin\delta\sin\delta_0
               +\cos\delta\cos\delta_0\cos\da} \nonumber \\
 \noalign{\vskip 1.5pt}
   M & = &2\,\frac{\sin\delta\cos\delta_0-\cos\delta\sin\delta_0
            \cos\da}{1 + \sin\delta\sin\delta_0
           + \cos\delta\cos\delta_0\cos\da} \, .  \label{eq:STGLM2}
\end{eqnarray}
Then equations~\ref{eq:xy=LM} determine $x$ and $y$.

\subsubsection{Find $\alpha,\delta$ from $x,y$}

     Equations~\ref{eq:LM=xy} yield $L$ and $M$ from $x$ and $y$.
Then, using equations~\ref{eq:STGLM1},
\begin{eqnarray*}
   L^2+M^2 & = &\frac{4\sin^2\theta}{(1+\cos\theta)^2} \\
\noalign{\hbox{or}}
   \cos\theta & = &\frac{4-L^2-M^2}{4+L^2+M^2} \, .
\end{eqnarray*}
Then, solving equations~\ref{eq:cost} and \ref{eq:scosp} for
$\cos\delta\cos\da$, equating the results, and rearranging,
we find
\begin{eqnarray*}
   \delta & = &\sin^{-1}\left(\cos\theta\sin\delta_0 +
                M\cos\delta_0\,(1+\cos\theta)/2 \right) \\
 \noalign{\vskip 1.5pt}
   \alpha & = &\alpha_0 + \sin^{-1}\left( \frac{L\,(1+\cos\theta)}{
                     2\cos\delta}\right) \, .
\end{eqnarray*}
We do have to test to make sure that the correct value of $M$ is given
by the chosen root of the $\sin^{-1}$ in the computation for $\alpha$.

\subsubsection{Find $\alpha,y$ from $x,\delta$}

     Using equations~\ref{eq:xy=LM} for $x$ and substituting $L$ and
$M$ from equations~\ref{eq:STGLM2}, we find an equation for
$\da$ of the form
\begin{displaymath}
  A\sin\da - B\cos\da = C \, ,
\end{displaymath}
where
\begin{eqnarray*}
   A & \equiv &2\cos\delta\cos\rho \\
   B & \equiv &2\cos\delta\sin\delta_0\sin\rho +
                   x\cos\delta\cos\delta_0 \\
   C & \equiv &x + x\sin\delta\sin\delta_0 -
                 2\sin\delta\cos\delta_0\sin\rho \, .
\end{eqnarray*}
This is simply an equation for the $\sin$ of the difference of two
angles and has solution
\begin{eqnarray*}
   \alpha & = &\alpha_0 + \tan^{-1}\left(\frac{B}{A}\right) +
                  \sin^{-1}\left(\frac{C}{\strut\sqrt{A^2+B^2}}
                  \right) \, , \\
\noalign{\hbox{which then allows us to compute}\vskip 1pt}
   y & = &2\,\frac{(\sin\delta\cos\delta_0 - \cos\delta\sin\delta_0
            \cos\da)\cos\rho - \cos\delta\sin\da\sin\rho}{1 + \sin
            \delta\sin\delta_0 + \cos\delta\cos\delta_0\cos\da} \, .
\end{eqnarray*}

\subsubsection{Find $x,\delta$ from $\alpha,y$}

     Reversing the equation for $y$ above, we get another equation of
the form
\begin{displaymath}
  A\sin\delta - B\cos\delta = C \, ,
\end{displaymath}
where
\begin{eqnarray*}
   A & \equiv &2\cos\delta_0\cos\rho - y\sin\delta_0 \\
   B & \equiv &\left( y\cos\delta_0+2\sin\delta_0\cos\rho \right)
                 \cos\da + 2\sin\rho\sin\da \\
   C & \equiv &y \, .
\end{eqnarray*}
This is simply an equation for the $\sin$ of the sum of two angles and
has solution
\begin{eqnarray*}
   \delta & = &\tan^{-1}\left(\frac{B}{A}\right) + \sin^{-1}\left(
                 \frac{C}{\strut\sqrt{A^2+B^2}}\right) \, , \\
\noalign{\hbox{which then allows us to compute}\vskip 1pt}
   x & = &2\,\frac{(\sin\delta\cos\delta_0-\cos\delta\sin\delta_0
            \cos\da)\sin\rho + \cos\delta\sin\da\cos\rho}{1 +
            \sin\delta\sin\delta_0 + \cos\delta\cos\delta_0\cos\da} \, .
\end{eqnarray*}

\subsection{AIT geometry\protect\footnotemark}
\footnotetext{{\bf 1993: }The new proposal provides an entirely new
generalization to non-zero reference pixels.  These equations match
those of the new proposal only when $\alpha_0=\delta_0=M_0=0$ and
$\fa=\fd=1$.}

\subsubsection{Find $x,y$ from $\alpha,\delta$}\

     The IRAS documentation gives the following definition for the
Aitoff coordinate system:
\begin{eqnarray*}
   \cos\phi & = &\cos\delta \cos\hda \\
      \noalign{\vskip 0.8pt}
   \sin\theta & = &\frac{\cos\delta\sin\hda}{\sin\phi} \\
       \noalign{\vskip 0.8pt}
   L          & = &2\sin(\phi/2)\sin\theta \\
       \noalign{\vskip 0.8pt}
   M          & = &\sin(\phi/2)\cos\theta \, .
\end{eqnarray*}
This definition is difficult to use because of the considerable
non-linearity and because the sign of $\phi$, which is important,
remains undefined.  An alternate definition, which may be shown to be
equivalent at $\delta_0 = 0$ within a scale factor, is given by
\begin{eqnarray}
   L & = &\frac{2\fa\cos\delta\sin\hda}{Z} \nonumber\\
   M & = &\frac{\fd\sin\delta}{Z} -M_0 \, , \label{eq:AITLM}
\end{eqnarray}
where $Z$ and $M_0$ are defined, for convenience, by
\begin{eqnarray*}
   Z    & = &\sqrt{\frac{1 + \cos\delta\cos\hda}{2}} \\
   M_0  & = &\frac{\fd\sin\delta_0}{\strut\sqrt{(1+\cos\delta_0)/2}}
                 \, .
\end{eqnarray*}
Equations~\ref{eq:xy=LM} may then be used to find $x$ and $y$.

The scaling factors $\fa$ and $\fd$ are a generalization of the
geometry to allow the specification of a ``reference pixel'' at some
latitude other than zero, \ie\ inside the field of view.  The
axis increments given are, by convention, arc seconds on the sky
evaluated at the reference pixel.  The linear system $(x,y)$ is
derived from the pixel positions $(i,j)$ in this convention by
\begin{eqnarray*}
   x & = & \Delta_x (i-i_0) \\
   y & = & \Delta_y (j-j_0) \, ,
\end{eqnarray*}
where the $\Delta$s are the axis increments and $(i_0,j_0)$ is the
reference pixel position.  To handle rotations, we define
\begin{eqnarray*}
   \Da & = & \Delta_x\cos\rho - \Delta_y\sin\rho \\
   \Dd & = & \Delta_y\cos\rho + \Delta_x\sin\rho \, .
\end{eqnarray*}
Then the scaling parameters for this geometry are given by
\begin{eqnarray*}
   \fa & = &\frac{\Da\sqrt{\left(1+\cos\delta_0\cos({
                 \mathstrut\Da\over2}) \right)/2}}{2\cos\delta_0
                  \sin({\mathstrut\Da\over2})} \\
     \noalign{\vskip 1pt}
   \fd & = &\frac{\Dd}{\frac{\sin(\delta_0+\Dd)}{\mathstrut
               \sqrt{\left(1+\cos(\delta_0+\Dd)\right)/2}} -
               \frac{\mathstrut\sin\delta_0}{\mathstrut\sqrt{(1+
                  \cos\delta_0)/2}}} \, .
\end{eqnarray*}
Note that the choice of $\delta_0 = 0$ makes $\fa$ and $\fd$ very
close to one, as one would expect.

\subsubsection{Find $\alpha,\delta$ from $x,y$}

  Given $x,y$, we use equations~\ref{eq:LM=xy} to derive $L,M$.  It
turns out that $Z$ may then be computed from $L$ and $M$ as follows:
\begin{eqnarray*}
   Z & \equiv &\sqrt{\frac{1 + \cos\delta\cos\hda}{2}} \\
   Z & = &\frac{1}{2}\,\sqrt{\frac{1+2\cos\delta\cos\hda +
              \cos^2\delta\cos^2\hda }{\left(1+\cos\delta\cos
              \hda\right)/2}} \\
   Z & = &\frac{1}{2}\,\sqrt{\frac{4Z^2-1+\cos^2\delta\cos^2\hda
              }{Z^2}} \\
   Z & = &\frac{1}{2}\,\sqrt{4-\frac{\cos^2\delta+\sin^2\delta -
              \cos^2\delta\cos^2\hda}{Z^2}} \\
   Z & = &\frac{1}{2}\,\sqrt{4-\left(\frac{L}{2\fa}\right)^2
              - \left(\frac{M+M_0}{\fd}\right)^2}
\end{eqnarray*}
using equations~\ref{eq:AITLM}.  Then,
\begin{eqnarray}
   \delta & = & \sin^{-1}\left({(M+M_0)Z\over\fd}\right) \\
   \alpha & = &\alpha_0 + 2\sin^{-1}\left(\frac{LZ}{2\fa\cos\delta}
                   \right)
\end{eqnarray}
follow directly.
\label{sec:Bii}

\subsubsection{Find $\alpha,y$ from $x,\delta$}

     Like the ARC geometry, the AIT geometry requires iterative
methods for two of the four problems.  Some of the unknowns appear
primarily in $Z$ which is only weakly dependent on $\alpha$ and
$\delta$.  However, the iterative methods do encounter a variety of
problems in more extreme, but reasonably normal, cases.  The iterative
methods described in this memo are meant to be illustrative rather
than an exact description of the methods implemented in \AIPS.  The
subroutines themselves employ derivatives of the functions with
various restraining and bounding conditions to estimate the unknown
parameters for the next iteration, \ie\ a bounded version of Newton's
method.

Equations~\ref{eq:LM=xy} and \ref{eq:AITLM}, after a bit of
rearrangement yield
\begin{eqnarray}
   y        & = &\frac{\fd\sin\delta}{Z\cos\rho} -
                  \frac{x\sin\rho}{\cos\rho} - \frac{M_0}{\cos\rho}
                  \nonumber \\
   \sin\hda & = &\left(\frac{Z}{2\fa\cos\delta}\right)(x\cos\rho
                   -y\sin\rho) \nonumber \\
\noalign{\hbox{or}}
   \sin\hda & = &\frac{xZ + (M_0Z - \fd\sin\delta)\sin\rho}{2\fa
                   \cos\delta\cos\rho} \, . \label{eq:AITD}
\end{eqnarray}
The iterative method simply involves guessing $\hda$ and then looping
between computing $Z$ and recomputing $\hda$ using
equation~\ref{eq:AITD}. When convergence is achieved, $y$ may be
computed with the equation given above.

\subsubsection{Find $x,\delta$ from $\alpha,y$}

     Similarly, equations~\ref{eq:LM=xy} and \ref{eq:AITLM}, after a
bit of rearrangement yield
\begin{eqnarray}
   x          & = &\frac{2\fa\sin\hda\cos\delta}{Z\cos\rho} +
                     \frac{y\sin\rho}{\cos\rho} \nonumber \\
   \sin\delta & = &\frac{Z}{\fd} \left(y\cos\rho+x\sin\rho+M_0\right)
                     \nonumber \\
\noalign{\hbox{or}}
   \sin\delta & = &\frac{yZ + M_0Z\cos\rho + 2\fa\cos\delta\sin\rho
                     \sin\hda}{\fd\cos\rho} \, . \label{eq:AITD2}
\end{eqnarray}
The iterative method simply involves guessing $\delta$ and then
looping between computing $Z$ and recomputing $\delta$ using
equation~\ref{eq:AITD2}.  When convergence is achieved, $x$ may be
computed with the equation given above.

\subsection{GLS geometry\protect\footnotemark}
\footnotetext{{\bf 1993: }The generalization to reference pixels other
than $(\alpha_0, \delta_0) = (0, 0)$ is entirely different in the FITS
proposal.  Older images may be corrected simply by changing the
declination reference value to zero with a corresponding linear shift
of the reference pixel location.}

\subsubsection{Find $x,y$ from $\alpha,\delta$}

     The ``global sinusoidal'' coordinates are defined by
\begin{eqnarray}
\begin{array}{lcl}
   L & = &\da\cos\delta \\
   M & = &\Delta\delta
\end{array}
\label{eq:GLSLM}
\end{eqnarray}
and $x$ and $y$ may be determined by
equations~\ref{eq:xy=LM}.

\subsubsection{Find $\alpha,\delta$ from $x,y$}

     Using equations~\ref{eq:LM=xy} and \ref{eq:GLSLM},
\begin{eqnarray*}
   \delta & = &M+\delta_0 \\
\noalign{\hbox{or}}
   \delta & = &\delta_0+x\sin\rho+y\cos\rho. \\
\noalign{\hbox{Then}}
   \alpha & = &\alpha_0 + \frac{L}{\cos\delta} \\
\noalign{\hbox{or}}
   \alpha & = &\alpha_0 + \frac{x\cos\rho-y\sin\rho}{\cos\delta} \, .
\end{eqnarray*}

\subsubsection{Find $\alpha,y$ from $x,\delta$}

     Again using equations~\ref{eq:LM=xy} and \ref{eq:GLSLM},
\begin{eqnarray*}
   y      & = &\frac{\Delta\delta - x\sin\rho}{\cos\rho} \\
\noalign{\hbox{and then}}
   \alpha & = &\alpha_0 + \frac{x\cos\rho-y\sin\rho}{\cos\delta} \, .
\end{eqnarray*}

\subsubsection{Find $x,\delta$ from $\alpha,y$}

     The last of the problems does not yield a simple, analytic
solution.  We proceed as follows, using equations~\ref{eq:xy=LM},
\ref{eq:LM=xy} and \ref{eq:GLSLM} to get
\begin{eqnarray*}
   \delta & = &\delta_0+x\sin\rho+y\cos\rho \\
   x      & = &\da\cos\delta\cos\rho+\Delta\delta\sin\rho, \\
\noalign{\hbox{which yields}}
   \delta & = &\delta_0 + \frac{y+\da\cos\delta\sin\rho}{\cos\rho} \, .
\end{eqnarray*}
An iterative method may be used, beginning with $\delta =
\delta_0+y/\cos\rho$, to derive eventually a correct value for
$\delta$.  Then the equation above for $x$ may be applied.

\subsection{MER geometry\protect\footnotemark}
\footnotetext{{\bf 1993: }The new proposal provides an entirely new
generalization to non-zero reference pixels.  These equations match
those of the new proposal only when $\alpha_0=\delta_0=M_0=0$ and
$\fa=\fd=1$.}

\subsubsection{Find $x,y$ from $\alpha,\delta$}

     In the Mercator projection, lines of longitude are parallel and
evenly spaced while lines of latitude are parallel with a spacing
which increases as one approaches the pole.  The basic equations are
\begin{eqnarray}
   L & = & \fa\,\da \nonumber \\
   M & = & \fd\,\ln\left(\tan(\frac{\delta}{2} + \frac{\pi}{4})\right)
              - M_0 \, , \label{eq:MERLM} \\
\noalign{\hbox{with}}
   \fa & = &\cos\delta_0 \nonumber \\
   \fd & = &\frac{\Dd}{\strut\ln\left(\tan(\frac{\mathstrut\delta_0 +
              \Dd}{2} + \frac{\pi}{4})\right) - \ln\left(\tan
              (\frac{\mathstrut\delta_0}{2} + \frac{\pi}{4})\right)}
              \nonumber \\
   M_0 & = &\fd\,\ln\left(\tan(\frac{\delta_0}{2} + \frac{\pi}{4})
               \right) \nonumber
\end{eqnarray}
providing a service similar to that provided in the AIT geometry.  The
peculiar form of this geometry comes from from integrating
$\sec\delta$.

\subsubsection{Find $\alpha,\delta$ from $x,y$}

     $(L,M)$ are found from $(x,y)$ by equations~\ref{eq:LM=xy}.  Then
\begin{eqnarray*}
   \alpha & = & L/\fa + \alpha_0 \\
   \delta & = & 2 \tan^{-1}\left(e^{(\frac{M+M_0}{\fd})}\right) -
                   \pi/2\, .
\end{eqnarray*}

\subsubsection{Find $\alpha,y$ from $x,\delta$}

     Equations~\ref{eq:xy=LM} and \ref{eq:MERLM} are manipulated as
follows:
\begin{eqnarray*}
   M & = &\fd\,\ln\left(\tan(\frac{\delta}{2} + \frac{\pi}{4})\right)
            - M_0 \\
   L & = &\frac{x - M\sin\rho}{\cos\rho} \\
   y & = &M\cos\rho - L\sin\rho \\
   \alpha & = &\alpha_0 + L/\fa \, .
\end{eqnarray*}

\subsubsection{Find $x,\delta$ from $\alpha,y$}

     Similarly, equations~\ref{eq:xy=LM} and \ref{eq:MERLM} may be
manipulated as follows:
\begin{eqnarray*}
   L      & = &\fa\,\da \\
   M      & = &\frac{y + L\sin\rho}{\cos\rho} \\
   \delta & = &2 \tan^{-1}\left(e^{(\frac{M+M_0}{\fd})}\right)-\pi/2 \\
   x      & = & L\cos\rho + M\sin\rho \, .
\end{eqnarray*}

\section{\AIPS\ Implementation}

     These new coordinates are implemented in \AIPS\ with the same
subroutines and commons which are used for the previously documented
geometries and, hence, their introduction should be relatively
transparent to most programmers.  The subroutine {\tt SETLOC}
recognizes the new coordinates by the suffixes {\tt -STG}, {\tt -GLS},
{\tt -AIT}, and {\tt -MER} in the axis type parameter of the image
header.  The {\tt AXFUNC} parameter in common {\tt /LOCATI/} is then
set to 9, 6, 8, or 7, respectively.  The subroutines {\tt DIRCOS},
{\tt NEWPOS}, {\tt DIRRA} and {\tt DIRDEC} apply the geometry to solve
the four problems posed here.  In these geometries, there can be large
regions in a rectangular image which are forbidden, \ie\ which have no
latitude and longitude.  To handle this condition properly, error
return parameters were added to the call sequences of the basic
position routines and a new subroutine, {\tt TICINC}, was written to
handle the more elaborate steps now used to determine tick values and
increments.  Constants for use by each geometry were added to the
location common and are initialized by {\tt SETLOC}.  They are $\fa =$
{\tt GEOMD1}, $\fd =$ {\tt GEOMD2}, and $M_0 =$ {\tt GEOMD3} in the
MER and AIT geometries.

     The global shapes of the non-projective geometries are
illustrated on the next page of this memo.  These figures were
produced with \AIPS\ using the new {\tt DOCIRCLE} option designed to
show full coordinate grids.

\section{Acknowledgements}

     The STG geometry was suggested by Don Wells; the GLS geometry was
suggested and documented by Jim Condon; the formulation of the AIT
geometry used here was given to me by Don Wells; and the basics of the
MER geometry were taken from W. M. Smart, {\it Text-Book on Spherical
Astronomy}.  The IRAS formulation, including the ``trick'' used in
section~\ref{sec:Bii}, is contained in {\it IRAS Catalogs and Atlases,
Explanatory Supplement}, Birchman, C. A., Neugebauer, G., Habing, H.
J., Clegg, P. E., and Chester, T. J., {\tt JPL D--1855}.  Don Wells
also made very useful suggestions on this manuscript and on the
iterative methods actually employed.  The National Radio Astronomy
Observatory is operated by Associated Universities Inc.~under contract
with the National Science Foundation.

\vfill\eject
%\section{Figures}
%\hphantom{p}

\begin{figure}
\centerline{\psfig{figure=coord4.eps,height=3.85in}}
\end{figure}
\vfill
\begin{figure}
\centerline{\psfig{figure=coord5.eps,height=3.85in}}
\end{figure}

\end{document}
