%
% To start the document, use
%  \levela{...}
% For lover level, sections use
%  \levelb{...}
%  \levelc{...}
%
\levela{Line of sight, 1D}
 \label{sec:los}


%
% Document history, format:
%  \starthistory
%    date1 & text .... \\
%    date2 & text .... \\
%    ....
%  \stophistory
%
\starthistory
  000307 & Started by Patrick Eriksson. \\
  000914 & First version finished by Patrick Eriksson.\\
\stophistory


%
% Symbol table, format:
%  \startsymbols
%    ... & \verb|...| & text ... \\
%    ... & \verb|...| & text ... \\
%    ....
%  \stopsymbols
%
%
%\startsymbols
%  \view     & \verb|view|     & zenith angle from zenith                  \\
%  $z$       & \verb|z|       & vertical altitude                          \\
%  $z_p$     & \verb|z_plat|  & platform altitude                          \\
%  $z_t$     & \verb|z_tan|   & tangent altitude                           \\
%  $z_g$     & \verb|z_ground|& altitude of the ground                     \\
%  $z_{lim}$ & \verb|z_abs_max|& practical upper limit of the atmosphere   \\
%  $l$       & \verb|l|       & distance along LOS                         \\
%  $e$       & \verb|gr_emiss|& ground emissivity                          \\
%  $\Delta l$& \verb|l_step|  & step length along LOS                      \\
%  $l_{lim}$ & \verb|llim|    & distance from lowest LOS point to $z_{lim}$\\
%  $l_p$     & \verb|l1|      & distance used for downward observation     \\
%  $i_p$     & -              & index for platform altitude for downward obs.\\
% \label{symtable:los}     
%\stopsymbols



%
% Introduction
%
This section describes how the line of sight (LOS) can be determined
for situations where the atmosphere is assumed to be horizontally
stratified, a 1D atmosphere. Expressions are given both for pure
geometrical calculations and when considering refraction.



\levelb{Definitions}
 \label{sec:los:defs}
 
 Vertical (geometrical) altitudes are denoted as $z$, pressures as $p$
 and distances along the LOS are denoted as $l$. Vertical distances
 are measured from the geoid and $l$ is the distance from the lowest
 point of the LOS.
 
 As a 1D atmosphere is assumed here, the conditions are symmetrical
 around tangent points and points of ground reflection, and, for such
 cases, only one half of the LOS is stored for efficiency reasons.
 The points of the LOS are stored by increasing vertical altitude
 point. Index 1 corresponds accordingly to either the platform, the
 tangent point or the ground.  The internal description of the LOS is
 further described in the file \verb|los.h|.
  
 The line of sight is defined by two variables, the platform altitude,
 $z_p$, and the zenith angle, $\view$, (see Fig. \ref{fig:los1d:geoms}):

 \begin{description}
  \item[The platform altitude] is the altitude above the geoid of the
       sensor used to detect the spectrum simulated.
  \item[The zenith angle] is the angle between the zenith
       direction and the direction of observation. As an 1D atmosphere is
       assumed, there is no difference between positive and negative
       zenith angles.
  \end{description}

  \noindent
  The lower limit of the atmosphere is given by the ground altitude,
  $z_g$. The practical upper limit of the atmosphere is denoted
  $z_{lim}$ and is in the forward model determined by the highest
  point of the absorption grid. The absorption grid can
  extend below $z_g$. On the other hand, it is not allowed that any
  part of the LOS is between the lowest absorption altitude and the ground.
 
  If $\view>90^{\circ}$ the lowest point of the LOS is not the platform
  altitude, and this point is denoted as the tangent point, $z_t$. The
  angle between the LOS and the vector to the Earth center is at the
  tangent point $90^\circ$. If the tangent point is below ground
  level, $z_t$ is determined by an imaginary geometric prolonging of
  the LOS inside the Earth.

  \begin{figure}[tb]
   \begin{center}
    \includegraphics*[width=0.95\hsize]{Figs/geoms.eps}
    \caption{Schematic description of the main variables of the 
             observation geometry and the LOS. $R_e$ is the Earth
             radius. Other variables defined in the text.}  
    \label{fig:los1d:geoms}  
   \end{center}
  \end{figure}
  
  The forward model uses internally three main observation geometries:

  \begin{description}
  \item[Upward looking] signifies observation from
    within the atmosphere in an upward direction ($z_p<z_{lim}$ and
    $\view\leq90^{\circ}$). 
  \item[Limb sounding] covers here all observations from a point
    outside the atmosphere ($z_p \geq z_{lim}$). All zenith angles are
    covered, and, for example, nadir looking observations
    ($\view=180$) are treated as limb sounding in the forward model.
    If the LOS does not pass the atmosphere ($z_{tan} \geq z_{lim}$),
    cosmic background radiation, or correspondingly, is returned.
  \item[Downward looking] is observation from within the atmosphere in
    a downward direction ($z_p<z_{lim}$ and $\view>90^{\circ}$).
  \end{description}
 

\levelb{Outlook towards 2D}
 \label{sec:los:2d}
 So far ARTS is only capable of calculating spectra for 1D cases.
 It is planned to also handle satellite measurements with atmospheric 
 horizontal variations, but limited to observations in the orbit
 plane, here denoted as 2D observations. 
 
 For 2D observations there is no symmetry to be used, each point of
 the LOS is unique. This is also the case for 1D upward looking
 observations, and it is planned that 2D and 1D upward calculations of
 radiative transfer and weighting functions shall be performed with
 the same general functions.  The 2D case exhibits however one
 difference compared to the 1D upward case. For 2D cases there could
 be a ground reflection along the LOS, which is never the case for 1D
 upward looking observations by definition. This question is discussed
 a bit further in Section \ref{sec:los:ground}. Note that if the 1D
 upward functions are used for 2D simulations, the point of LOS
 closest to the sensor will throughout have index 1.


 
\levelb{The step length}
 \label{sec:rte:stepl}
 
 As described in Section \ref{sec:rte}, the LOS is divided into equal
 long geometrical steps, $\Delta l$. The user gives an upper limit for
 this step length. A point of the LOS is always placed at the sensor
 (if inside the atmosphere), tangent points and points of ground
 reflection, but no adjustment to the upper atmospheric limit is made.
 This gives a single fixed point for limb sounding and upward looking
 observation and $\Delta l$ is set to the value given by the user if
 the LOS has at least two definition points. If the LOS gets only one
 point with the user defined value, for example when the tangent point
 is just below the atmospheric limit, the step length is adjusted to
 the length from the fixed point of the LOS (the sensor or the tangent 
 point) and the atmospheric limit.
 
 In contrast to upward and limb sounding observations, for downward
 observations there are two fixed points inside the atmosphere (the
 platform and the tangent point, or the point of ground reflection)
 and $\Delta l$ is here adjusted according to the the distance between
 these two points. See further Section \ref{sec:los:down}.



\levelb{Geometrical calculations}
  
 Most of the equations of this section are described further, both in text
 and by figures (with a slightly different notation and definition
 of the zenith angle) in Section 4 of \citet{eriksson:97a}.

 \levelc{Upward looking}   
  \label{sec:los:up}
  
  The relationship between vertical altitude ($z$) and distance along
  LOS ($l$) can be found be the law of cosines, giving
  \begin{equation}
    (R_e+z)^2 = (R_e+z_p)^2 + l^2 + 2l(R_e+z)\cos(\view)
  \end{equation}
  This equation gives
  \begin{equation}
    z = \sqrt{ (R_e+z_p)^2 + l^2 + 2l(R_e+z)\cos(\view) } - R_e
  \end{equation}
  The distance between the sensor and the limit of the atmosphere is
  \begin{equation}
      l_{lim} = \sqrt{ (R_e+z_{lim})^2 - (R_e+z_p)^2\sin^2(\view) } - 
                                       (R_e+z_p)\cos(\view)
  \end{equation}


 \levelc{Limb sounding}
  \label{sec:los:limb}
  
  The tangent altitude is
  \begin{equation}
    z_t = (R_e+z_p)\sin(\view) - R_e \qquad  \view\geq90^\circ
   \label{eq:los:ztan}
  \end{equation}
  This relationship holds even if $z_t<z_g$. Note that
  $\sin(180^\circ-\view)=\sin(\view)$ and it must be checked that
  $\view\geq90^\circ$. Zenith angles $<90^\circ$ correspond to an
  imaginary tangent point behind the sensor, and are treated as
  observations into the space.
  
  The Pythagorean relation gives the distance from the tangent point
  to the atmospheric limit:
  \begin{equation}
      l_{lim} = \sqrt{ (R_e+z_{lim}) - (R_e+z_t)}
  \end{equation}
  If $l_{lim}$ is smaller than upper limit for $\Delta l$ specified by
  the user, $\Delta l$ is set to $l_{lim}$ as also described in Section
  \ref{sec:rte:stepl}.

  The vertical altitude as a function of the distance from the
  tangent point is
  \begin{equation}
    z = \sqrt{ (R_e+z_t) + l^2} - R_e
  \end{equation}
  If the tangent point is below ground, the LOS is determined by the
  upward expressions (Sec. \ref{sec:los:up}) by setting
  \begin{eqnarray}
     z_p  & \gets & z_g          \nonumber  \\
     \view & \gets & \sin^{-1}\left((R_e+z_t)/(R_e+z_g) \right) \nonumber 
  \end{eqnarray}


 \levelc{Downward looking}
  \label{sec:los:down}
  
  This observation geometry can be handled by the upward and limb
  sounding functions by suitable exchange of variables. However, as
  the lowest point of the LOS is either the tangent point or the
  ground, and one point of LOS must fit the sensor altitude, the step
  length must be adjusted to this distance.

  The distance between the sensor and a tangent point is
  \begin{equation}
    l_p = \sqrt{ (R_e+z_p) - (R_e+z_t) } \qquad  z_t \geq z_g
  \end{equation}
  and the distance between the sensor and a point of ground
  reflection is
  \begin{equation}
    l_p = \sqrt{ (R_e+z_p) - (R_e+z_t) } - \sqrt{ (R_e+z_g) - (R_e+z_t) }
            \qquad z_t < z_g
  \end{equation}
  where $z_t$ is determined by Equation \ref{eq:los:ztan}.

 The part of the LOS between the sensor and the tangent or ground
 point gets the following number of points:
 \begin{equation}
    m = 1 + \mathbf{ ceil}(l_{lim}/\Delta l_{max})
  \label{eq:los:m}
 \end{equation}
 where $\Delta l_{max}$ is the upper limit for $\Delta l$ specified by
 the user, and $\mathbf{ ceil}$ is a function giving the first integer
 larger than the argument. The step length is accordingly
 \begin{equation}
    \Delta l = \frac{l_{lim}}{m-1}
  \label{eq:los:dl}
 \end{equation} 
 If the tangent altitude is above the ground ($z_{tan} \geq z_t$),
 the LOS is determined by the same expressions as applied for limb
 sounding, but with the adjusted value for $\Delta l$.
 If there is an intersection with the ground, the upward
 looking expressions can be used as described above for limb sounding,
 again with the adjusted value for $\Delta l$.


 \levelb{With refraction}
  \label{sec:los:refraction}
  
  Refraction affects the radiative transfer in several ways. The
  distance through a layer of a fixed vertical thickness will be
  changed, and for limb sounding observation the tangent point is
  moved both vertically and horisontally. If the atmosphere is assumed
  to be horizontally stratified, as done here (1D), a horisontal
  displacement is of no importance but for 2D calculations this effect
  must be considered. For limb sounding and a fixed zenith angle, the
  tangent point is moved downwards compared to the pure geometrical
  case, resulting in that inclusion of refraction in general gives
  higher intensities. However, the LOS is still symmetric around
  tangent and ground points.

 \levelc{General theory}

   When determining the LOS through the atmosphere geometrical optics 
   can be applied because the change of the refractivce index over a
   wavelength can be neglected. Applying Snell's law to the geometry 
   shown in Figure \ref{fig:los:snell} gives
   \begin{equation}
     n_i \sin (\theta_i) = n_{i+1} \sin (\theta_i')
   \end{equation}
   \begin{figure}
    \begin{center}
      \includegraphics*{Figs/snell.eps}
      \caption{Geometry to derive Snell's law for a spherical atmosphere. 
               The Earth radius is $R_e$, the vertical
               altitude $z$, the refractive index $n$ and the angle
               between the LOS and the vector to the Earth centre $\theta$.}
      \label{fig:los:snell} 
    \end{center} 
  \end{figure}
  Using the same figure, the law of sines gives the relationship
  \begin{equation}
    \frac{\sin(\theta_{i+1})}{R_e+z_i} = 
    \frac{\sin(180^\circ-\theta_{i+1}')}{R_e+z_{i+1}} =
    \frac{\sin(\theta_i')}{R_e+z_{i+1}} 
  \end{equation}
  By combining the two equations above, the Snell's law for a spherical
  atmosphere (i.e. 1D) is derived \citep[e.g.][]{kyle:91,balluch:97}:
  \begin{equation}
    c = (R_e+z_i) n_i \sin(\theta_i) = (R_e+z_{i+1}) n_{i+1}\sin(\theta_{i+1}) 
   \label{eq:los:snellspherical}
  \end{equation}
  where $c$ is a constant. With other words, the Snell's law for spherical
  atmospheres says that the product of $n$, $(R_e+z)$ and $\sin(\theta)$ is
  constant along the LOS.

  The radiative transfer is evaluated along the LOS, while Equation 
  \ref{eq:los:snellspherical} is expressed for vertical altitudes.
  The relationship between a change in vertical altitude and the
  corresponding change along the LOS is here denoted as the geometrical term
  and it is
  \begin{equation}
    g(z) = \frac{1}{\cos(\theta)}
  \end{equation}
  which can be rewritten using trigonometric identities and Equation
  \ref{eq:los:snellspherical}:
  \begin{equation}
    g(z) = \frac {(R_e+z)n(z)} {\sqrt{ (R_e+z)^2n^2(z) - c^2 }}
   \label{eq:los:gterm}
  \end{equation}
  A possible solution for calculating the LOS would be to integrating the
  geometrical term as \citep{eriksson:00a}
  \begin{eqnarray}
    l_1^2 = \int_{z_1}^{z_2}{g(z)\dd z} \nonumber
  \end{eqnarray}
  where $z_1$ and $z_2$ are two vertical altitudes and $l_1^2$ the length
  along the LOS between these two altitudes. However, this appraoch is
  problematic for limb sounding as the geometric factor is
  singular at the tangent point (Sec. !!).


 \levelc{The relative geometrical factor}
 
  To avoid the singularity of the geometrical factor at tangent points,
  the relative geometrical factor is here introduced. This factor is
  defined as
  \begin{equation}
    h(z) = \frac {(R_e+z)n(z)} {\sqrt{ (R_e+z)^2n^2(z) - c^2 }} 
   \label{eq:los:gtermcor}
  \end{equation}




   \begin{figure}
    \begin{center}
      \includegraphics*[width=0.8\hsize]{Figs/fig_geomfac.eps}
      \caption{The geometrical factor, as a function of altitude, for limb 
               sounding and three tangent altitudes.}
    \end{center} 
   \label{fig:los:gfac}
  \end{figure}

  
 \levelb{Ground intersections}
   \label{sec:los:ground}
  
   Ground reflections are indicated by a special flag. This flag is
   zero when there is no ground intersection or gives the index of the
   LOS point corresponding to the ground, $i_g$. For 1D calculations,
   $i_g$ is either 0 or 1, as index 1 is here defined to always be the
   lowest altitude of the LOS. However, to pave the way for 2D
   calculations, cases where the ground is placed at other positions
   than index 1 are handled.
  
   For 1D cases, where only half of the total LOS is stored and the
   ground can only have index 1 ($i_g=1$), the effect of a ground
   reflection (Eq. \ref{eq:rte:ground}) is put in when reversing the
   loop order.  Accordingly, the calculation order is: ... step2, step
   1, ground, step 1, step 2, ... Ground reflections for 1D cases are
   treated internally in ARTS by the limb sounding functions.
  
   \begin{figure}
   \begin{center}
     \includegraphics*[width=0.75\hsize]{Figs/ground.eps}
    \caption{Schematic of ground reflections for 2D cases. The index 
             of the point corresponding to the ground is $i_g$. Point 1
             of the LOS is the point closest to the sensor. }  
    \label{fig:los1d:ground}  
   \end{center}
   \end{figure}
 
   When solving the radiative transfer (Eq. \ref{eq:rte:iteration})
   for 2D cases, the ground reflection is treated between evaluating
   step $i_g$ and $i_{g-1}$ (the iteration goes from $n$ to 1), as
   shown in Figure \ref{fig:los1d:ground}.  Ground reflections for 2D
   cases are treated internally in ARTS by the upward looking
   functions (Sec.  \ref{sec:los:2d}).
  
  
  





%\levelb{The geometrical term}
% \label{sec:los:gterm}
%
% !! The new scheme for WF do not use the geometrical term. Is there
% another good approach for refraction that also works for 2D. Check Kyle.
% Accordingly, this section is maybe obsolete.!!
%  
% The equations above could be determined from trigonometric
% relationships as they not consider refraction. To include the
% effect of refraction, the LOS can be treated to consist of piecewise
% geometrical parts, but another approach is selected here (see Sec.
% \ref{sec:los:refr}) and this approach includes the geometrical term.
%   
%  The geometrical term, $g$, is the ratio between an incremental distance
%  along the LOS and the corresponding change in vertical altitude:
%  \begin{equation}
%    g(z) = \frac{\dd l(z)}{\dd z}
%   \label{eq:los:gterm}
%  \end{equation}
% 
%  \levelc{Derivation}
%    
%   The Snell's law for a spherically geometry says that the following
%   product is constant, $c$, along the LOS \citep[e.g.][]{kyle:91,balluch:97}
%   \begin{equation}
%     c = (R_e+z) n(z) \sin(\theta)
%     \label{eq:los:snell}
%   \end{equation}
%   where $n$ is the refractive index and $\theta$ is the angle
%   between LOS and the vector to the Earth center (Fig.
%   \ref{fig:los:snell}). This relationship is described somewhat more in
%   detail by \citet{eriksson:97a}.
%
%   \begin{figure}[tb]
%    \begin{center}
%      \includegraphics*{Figs/snell.eps}
%      \caption{Definition of the angle $\theta$ in Snell's law for a 
%               spherically geometry (Eq. \ref{eq:los:snell}).}  
%      \label{fig:los:snell} 
%    \end{center} 
%  \end{figure}
%
%  By noticing that 
%  \begin{equation}
%    g(z) = \frac{1}{\cos(\theta)}
%  \end{equation}
%  it can be derived that the geometrical term can be expressed
%  generally as
%  \begin{equation}
%    g(z) = \frac {(R_e+z)n(z)} {\sqrt{ (R_e+z)^2n^2(z) - c^2 }}
%   \label{eq:los:gterm2}
%  \end{equation}
%
%
%
% \levelc{Corrected geometrical term}
%  \label{sec:los:gcorr}
%
%  To obtain the LOS with refraction the geometrical term,
%  multiplicated with some other quantities, is integrated vertically.
%  There are two problems associated with this integration, (1) the
%  geometrical term is infinite at tangent points, (2) as the
%  geometrical term is a monotonous function (see Fig. 24 of
%  \citet{eriksson:97a}), the integration routine can consequently
%  under- or overestimate its integrated value.
%   
%  The integral of the geometrical term between two altitudes
%  $(z_1,z_2)$ is the distance along LOS between these two
%  altitudes $(l_{12})$:
%  \begin{equation}
%    l_{12} = \int_{z_1}^{z_2}g(z)\dd z
%   \label{eq:los:gintegr}
%  \end{equation}
%  If refraction is neglected, we can then easily make a correction to
%  the geometrical term in such way that the integration routine
%  applied gives the expected result. The integration routine applied
%  assumes that the integrand is linear between the given points, and
%  an integration of the geometrical term between two points of the LOS
%  would give the result
%  \begin{eqnarray}
%    \frac {(z_{i+1}-z_i)(g_{i+1}-g_i)}{2}   \nonumber
%  \end{eqnarray}
%  The correct answer for this integration is $\Delta l$.  Accordingly, a
%  corrected geometrical term, $g'$, can be calculated iteratively as
%  \begin{equation}
%     g'_i = \frac {2\Delta l} {z_{i+1}-z_i} - g'_{i+1} 
%   \label{eq:los:gcorr}
%  \end{equation}
%  where the iteration is started at the top of the atmosphere where $g'$
%  is set to the value of the geometrical term without refraction, $g_{n=1}$.
%  
%  !! Check if this part shall be moved
%  When $g�$ is determined, the ratio $g'/g_{n=1}$ can be used as a
%  correction factor when integrating the geometrical term with refraction.
%  The basic idea is that the correction factor shall compensate for an
%  inaccurate integration of the geometrical term, i.e. an integration
%  of the product
%  \begin{eqnarray}
%    \frac{g(z)g'(z)}{g_{n=1}(z)}
%   \nonumber
%  \end{eqnarray}
%  should give a more accurate answer then applying Equation
%  \ref{eq:los:gintegr} directly. For example, the scheme described
%  gives a totally correct answer when the refractive index is set to 1
%  (except at tangent points). Hence, the problem of integrating the
%  geometrical term is reduced significantly. Note that the main problem
%  is not the refractive index, which varies relatively slowly, it is
%  the rapid change of the geometrical term around tangent points.
%  However, the term $gg'/g_{n=1}$ is singular at tangent points, and
%  the integration must be started some distance from the tangent point
%  of the case considered. 
%
%  The term $g/g_{n=1}$ can be simplified to
%  \begin{equation}
%    \frac{g(z)}{g_{n=1}(z)} = \sqrt{n(z)\frac{1-n(z_t)}{n(z)-n(z_t)}}
%  \end{equation}
%  
%  
%
%\levelb{LOS with refraction}
% \label{sec:los:refr}
% 
% A smaller integration step is used to calculate LOS with refraction
% than compared to the integration of RTE. This step is here denoted
% $\Delta l_r$. This section is partly based on Section 4 of
% \citet{eriksson:97a}.
% 
% \levelc{Upward looking} 
%  
%  The constant for Snell's law is
%  \begin{equation}
%    c = (R_e+z_p)n(z_p) \sin (\view)
%  \end{equation}
%  Note that $\sin(\theta)=sin(180^\circ-\view)=sin(\view)$.
%    
%  The refracted LOS is determined by first calculating a geometric LOS
%  with steps of $\Delta l_r$ by using the geometrical function for
%  upward geometry. The refractive index is interpolated for these
%  altitudes, and the product $gg'/g_{n=1}$ is integrated, as described
%  in Section \ref{sec:los:gcorr}.  The obtained vector of distances
%  along LOS resulting from this integration is then interpolated at
%  $0, \Delta l, 2\Delta l,\dots$ to yield the final refracted vertical
%  altitudes of LOS.
%    
%  If the zenith angle is very close to $90^\circ$ ($\geq
%  89.999^\circ$), then the limb sounding function is called (with $z_t
%  \gets z_p$).
%
%
%
% \levelc{Limb sounding}
%    
%  Most important for limb sounding is to get a correct tangent
%  altitude, and the calculation of LOS should, if possible, start from
%  the tangent point. Fortunately, Snell's law (Eq.  \ref{eq:los:snell})
%  makes it possible to determine the tangent point without following the
%  LOS downwards from the upper limit of the atmosphere. The angle
%  $\theta$ is at the tangent point $90^\circ$ and thus
%  \begin{equation}
%     (R_e+z_t)n(z_t) = c
%  \end{equation}
%  where
%  \begin{equation}
%    c = (R_e+z_p) \sin(\view)
%  \end{equation}
%  as the refractive index in space is 1.
%  
%  The tangent altitude is calculated practically by calculating the
%  product $\left(R_e+z\right)n\left(z_t\right)$ for the absorption
%  vertical grid, looping downwards until $c$ is greater than this
%  product, and making an interpolation between this and the previous
%  altitude.  This scheme is taken from \citet{eriksson:97a}.
%  
%  If the tangent altitude is found to be below ground level, a
%  geometrical continuation of the LOS is assumed inside the Earth. This
%  tangent altitude can be determined by calling the function that
%  calculates the tangent altitude geometrically, where the platform
%  altitude and the zenith angle is set to
%  \begin{eqnarray}
%    z_p  & \gets & z_g \nonumber \\
%     \view & \gets & \pi-\sin^{-1}\left(\frac{c}{(R_e+z_g)n(z_g)}\right) 
%                                                 \nonumber
%  \end{eqnarray}   
%  The refracted vertical altitudes of the LOS are calculated in a
%  similar manner as for the upward looking case, but, of course, using
%  corresponding limb sounding functions. Howver, the integration of
%  the corrected geometrical term starts at some distance from the
%  tangent point, instead of at the platform.  This distance is
%  determined by the compile time variable \verb|REFR_MIN_FROM_TAN|.
%    
%  If the tangent altitude is below ground level, LOS is determined by
%  the corresponding upward function for refraction as
%  \begin{eqnarray}
%    z_p  & \gets & z_g \nonumber \\
%    \view & \gets & \sin^{-1}\left(\frac{R_e+z_t}{R_e+z_g}\right) 
%                                                 \nonumber
%  \end{eqnarray}   
%  Note that LOS is assumed to be straight below $z_g$ and a
%  geometrical calculation for calculation of $\view$ works for this
%  case.
%
%
% \levelc{Downward looking}
%  
%  The tangent altitude can be calculated with corresponding limb
%  sounding function if it is considered that the refractive index at
%  the platform deviates from unity.
%  
%  The refracted LOS for downward looking observations is obtained by
%  calling repeatedly the upward (if $z_t<z_g$) or the limb sounding
%  (if $z_t\geq z_g$) function for refraction, adjusting the step
%  length until one altitude of the LOS is sufficiently close to the
%  platform altitude. The stop criterion is controlled by the
%  compilation time variable \verb|REFR_DOWN_PREC|.




%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "main"
%%% End: 
