Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_recazl

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_RECAZL converts rectangular coordinates of a point to range,
   azimuth and elevation.

I/O


   Given:

      rectan   the rectangular coordinates of a point.

               help, rectan
                  DOUBLE = Array[3]

      azccw    a flag indicating how azimuth is measured.

               help, azccw
                  BOOLEAN = Scalar

               If `azccw' is True, azimuth increases in the
               counterclockwise direction; otherwise it increases in
               the clockwise direction.

      elplsz   a flag indicating how elevation is measured.

               help, elplsz
                  BOOLEAN = Scalar

               If `elplsz' is True, elevation increases from
               the XY plane toward +Z; otherwise toward -Z.

   the call:

      cspice_recazl, rectan, azccw, elplsz, range, az, el

   returns:

      range    the distance of the point from the origin.

               help, range
                  DOUBLE = Scalar

               The units associated with `range' are those associated
               with the input point.

      az       the azimuth of the point.

               help, az
                  DOUBLE = Scalar

               This is the angle between the projection onto the XY plane of
               the vector from the origin to the point and the +X axis of
               the reference frame. `az' is zero at the +X axis.

               The way azimuth is measured depends on the value of the
               logical flag `azccw'. See the description of the argument
               `azccw' for details.

               `az' is output in radians. The range of `az' is [0, 2*pi].

      el       the elevation of the point.

               help, el
                  DOUBLE = Scalar

               This is the angle between the vector from the origin to the
               point and the XY plane. `el' is zero at the XY plane.

               The way elevation is measured depends on the value of
               the logical flag `elplsz'. See the description of the
               argument `elplsz' for details.

               `el' is output in radians. The range of `el' is [-pi/2, pi/2].

Parameters


   None.

Examples


   Any numerical results shown for these examples may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Create four tables showing a variety of rectangular
      coordinates and the corresponding range, azimuth and
      elevation, resulting from the different choices of the `azccw'
      and `elplsz' flags.

      Corresponding rectangular coordinates and azimuth, elevation
      and range are listed to three decimal places. Output angles
      are in degrees.


      Example code begins here.


      PRO recazl_ex1

         ;;
         ;; Local parameters.
         ;;
         NREC   =   11L

         SPICEFALSE = 0B
         SPICETRUE  = 1B

         ;;
         ;; Define the input rectangular coordinates and the
         ;; different choices of the `azccw' and `elplsz' flags.
         ;;
         rectan = [ [0.D0,0.D0,0.D0],  [1.D0,0.D0,0.D0],  [0.D0,1.D0,0.D0],  $
                    [0.D0,0.D0,1.D0],  [-1.D0,0.D0,0.D0], [0.D0,-1.D0,0.D0], $
                    [0.D0,0.D0,-1.D0], [1.D0,1.D0,0.D0],  [1.D0,0.D0,1.D0],  $
                    [0.D0,1.D0,1.D0],  [1.D0,1.D0,1.D0] ]

         azccw  = [SPICEFALSE,  SPICETRUE]
         elplsz = [SPICEFALSE,  SPICETRUE]

         ;;
         ;; Create a table for each combination of `azccw' and `elplsz'.
         ;;
         for i=0L, 1L do begin

            for j=0L, 1L do begin

               ;;
               ;; Display the flag settings.
               ;;
               msg = 'AZCCW = #; ELPLSZ = #'
               cspice_repml, msg, '#', azccw[i], 'C', msg
               cspice_repml, msg, '#', elplsz[j], 'C', msg

               print
               print, format='(A)', msg

               ;;
               ;; Print the banner.
               ;;
               print
               print, format='(A)', '  rect[0]  rect[1]  rect[2]  ' +        $
                                    ' range      az       el'
               print, format='(A)', '  -------  -------  ------- '  +        $
                                    ' -------  -------  -------'

               ;;
               ;; Do the conversion. Output angles in degrees.
               ;;
               for n=0L, NREC-1L do begin

                  cspice_recazl, rectan[*,n], azccw[i], elplsz[j],           $
                                 range,       az,       el

                  print, format='(6F9.3)', rectan[*,n], range,               $
                                           az * cspice_dpr(),                $
                                           el * cspice_dpr()

               endfor

            endfor

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      AZCCW = False; ELPLSZ = False

        rect[0]  rect[1]  rect[2]   range      az       el
        -------  -------  -------  -------  -------  -------
          0.000    0.000    0.000    0.000    0.000    0.000
          1.000    0.000    0.000    1.000    0.000    0.000
          0.000    1.000    0.000    1.000  270.000    0.000
          0.000    0.000    1.000    1.000    0.000  -90.000
         -1.000    0.000    0.000    1.000  180.000    0.000
          0.000   -1.000    0.000    1.000   90.000    0.000
          0.000    0.000   -1.000    1.000    0.000   90.000
          1.000    1.000    0.000    1.414  315.000    0.000
          1.000    0.000    1.000    1.414    0.000  -45.000
          0.000    1.000    1.000    1.414  270.000  -45.000
          1.000    1.000    1.000    1.732  315.000  -35.264

      AZCCW = False; ELPLSZ = True

        rect[0]  rect[1]  rect[2]   range      az       el
        -------  -------  -------  -------  -------  -------
          0.000    0.000    0.000    0.000    0.000    0.000
          1.000    0.000    0.000    1.000    0.000    0.000
          0.000    1.000    0.000    1.000  270.000    0.000
          0.000    0.000    1.000    1.000    0.000   90.000
         -1.000    0.000    0.000    1.000  180.000    0.000
          0.000   -1.000    0.000    1.000   90.000    0.000
          0.000    0.000   -1.000    1.000    0.000  -90.000
          1.000    1.000    0.000    1.414  315.000    0.000
          1.000    0.000    1.000    1.414    0.000   45.000
          0.000    1.000    1.000    1.414  270.000   45.000
          1.000    1.000    1.000    1.732  315.000   35.264

      AZCCW = True; ELPLSZ = False

        rect[0]  rect[1]  rect[2]   range      az       el
        -------  -------  -------  -------  -------  -------
          0.000    0.000    0.000    0.000    0.000    0.000
          1.000    0.000    0.000    1.000    0.000    0.000
          0.000    1.000    0.000    1.000   90.000    0.000
          0.000    0.000    1.000    1.000    0.000  -90.000
         -1.000    0.000    0.000    1.000  180.000    0.000
          0.000   -1.000    0.000    1.000  270.000    0.000
          0.000    0.000   -1.000    1.000    0.000   90.000
          1.000    1.000    0.000    1.414   45.000    0.000
          1.000    0.000    1.000    1.414    0.000  -45.000
          0.000    1.000    1.000    1.414   90.000  -45.000
          1.000    1.000    1.000    1.732   45.000  -35.264

      AZCCW = True; ELPLSZ = True

        rect[0]  rect[1]  rect[2]   range      az       el
        -------  -------  -------  -------  -------  -------
          0.000    0.000    0.000    0.000    0.000    0.000
          1.000    0.000    0.000    1.000    0.000    0.000
          0.000    1.000    0.000    1.000   90.000    0.000
          0.000    0.000    1.000    1.000    0.000   90.000
         -1.000    0.000    0.000    1.000  180.000    0.000
          0.000   -1.000    0.000    1.000  270.000    0.000
          0.000    0.000   -1.000    1.000    0.000  -90.000
          1.000    1.000    0.000    1.414   45.000    0.000
          1.000    0.000    1.000    1.414    0.000   45.000
          0.000    1.000    1.000    1.414   90.000   45.000
          1.000    1.000    1.000    1.732   45.000   35.264


   2) Compute the apparent azimuth and elevation of Venus as seen
      from the DSS-14 station.

      Task Description
      ================

      In this example, we will obtain the apparent position of
      Venus as seen from the DSS-14 station in the DSS-14 topocentric
      reference frame. We will use a station frames kernel and
      transform the resulting rectangular coordinates to azimuth,
      elevation and range using cspice_azlrec.

      In order to introduce the usage of the logical flags `azccw'
      and `elplsz', we will request the azimuth to be measured
      clockwise and the elevation positive towards the +Z
      axis of the DSS-14_TOPO reference frame.


      Kernels
      =======

      Use the meta-kernel shown below to load the required SPICE
      kernels.


         KPL/MK

         File name: recazl_ex2.tm

         This meta-kernel is intended to support operation of SPICE
         example programs. The kernels shown here should not be
         assumed to contain adequate or correct versions of data
         required by SPICE-based user applications.

         In order for an application to use this meta-kernel, the
         kernels referenced here must be present in the user's
         current working directory.

         The names and contents of the kernels referenced
         by this meta-kernel are as follows:

            File name                        Contents
            ---------                        --------
            de430.bsp                        Planetary ephemeris
            naif0011.tls                     Leapseconds
            earth_720101_070426.bpc          Earth historical
                                             binary PCK
            earthstns_itrf93_050714.bsp      DSN station SPK
            earth_topo_050714.tf             DSN station FK

         \begindata

         KERNELS_TO_LOAD = ( 'de430.bsp',
                             'naif0011.tls',
                             'earth_720101_070426.bpc',
                             'earthstns_itrf93_050714.bsp',
                             'earth_topo_050714.tf'         )

         \begintext

         End of meta-kernel.


      Example code begins here.


      PRO recazl_ex2

         ;;
         ;; Local parameters
         ;;
         FMT0       =   '(3F21.8)'
         FMT1       =   '(A,F20.8)'
         META       =   'recazl_ex2.tm'

         SPICEFALSE = 0B
         SPICETRUE  = 1B

         ;;
         ;; Load SPICE kernels.
         ;;
         cspice_furnsh, META

         ;;
         ;; Convert the observation time to seconds past J2000 TDB.
         ;;
         obstim = '2003 OCT 13 06:00:00.000000 UTC'

         cspice_str2et, obstim, et

         ;;
         ;; Set the target, observer, observer frame, and
         ;; aberration corrections.
         ;;
         target = 'VENUS'
         obs    = 'DSS-14'
         ref    = 'DSS-14_TOPO'
         abcorr = 'CN+S'

         ;;
         ;; Compute the observer-target position.
         ;;
         cspice_spkpos, target, et, ref, abcorr, obs, ptarg, ltime

         ;;
         ;; Compute azimuth, elevation and range of Venus
         ;; as seen from DSS-14, with azimuth increasing
         ;; clockwise and elevation positive towards +Z
         ;; axis of the DSS-14_TOPO reference frame
         ;;
         azccw  = SPICEFALSE
         elplsz = SPICETRUE

         cspice_recazl, ptarg, azccw, elplsz, r, az, el

         ;;
         ;; Express both angles in degrees.
         ;;
         el     =   el * cspice_dpr()
         az     =   az * cspice_dpr()

         ;;
         ;; Display the computed position, the range and
         ;; the angles.
         ;;
         print
         print, format='(2A)', 'Target:                ', target
         print, format='(2A)', 'Observation time:      ', obstim
         print, format='(2A)', 'Observer center:       ', obs
         print, format='(2A)', 'Observer frame:        ', ref
         print, format='(2A)', 'Aberration correction: ', abcorr
         print
         print, format='(A)', 'Observer-target position (km):'
         print, format=FMT0, ptarg
         print, format=FMT1, 'Light time (s):       ', ltime
         print
         print, format=FMT1, 'Target azimuth          (deg): ', az
         print, format=FMT1, 'Target elevation        (deg): ', el
         print, format=FMT1, 'Observer-target distance (km): ', r
         print

         ;;
         ;; It's always good form to unload kernels after use,
         ;; particularly in IDL due to data persistence.
         ;;
         cspice_kclear

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Target:                VENUS
      Observation time:      2003 OCT 13 06:00:00.000000 UTC
      Observer center:       DSS-14
      Observer frame:        DSS-14_TOPO
      Aberration correction: CN+S

      Observer-target position (km):
          66886767.37916669   146868551.77222887  -185296611.10841593
      Light time (s):               819.63862811

      Target azimuth          (deg):         294.48543372
      Target elevation        (deg):         -48.94609726
      Observer-target distance (km):   245721478.99272084


Particulars


   This routine returns the range, azimuth, and elevation of a point
   specified in rectangular coordinates.

   The output is defined by the distance from the center of the
   reference frame (range), the angle from a reference vector
   (azimuth), and the angle above the XY plane of the reference
   frame (elevation).

   The way azimuth and elevation are measured depends on the values
   given by the user to the `azccw' and `elplsz' logical flags. See the
   descriptions of these input arguments for details.

Exceptions


   1)  If the X and Y components of `rectan' are both zero, the
       azimuth is set to zero.

   2)  If `rectan' is the zero vector, azimuth and elevation
       are both set to zero.

   3)  If any of the input arguments, `rectan', `azccw' or `elplsz',
       is undefined, an error is signaled by the IDL error handling
       system.

   4)  If any of the input arguments, `rectan', `azccw' or `elplsz',
       is not of the expected type, or it does not have the expected
       dimensions and size, an error is signaled by the Icy
       interface.

   5)  If any of the output arguments, `range', `az' or `el', is not
       a named variable, an error is signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)

Version


   -Icy Version 1.0.0, 01-NOV-2021 (JDR)

Index_Entries


   rectangular coordinates to range, az and el
   rectangular to range, azimuth and elevation
   convert rectangular coordinates to range, az and el
   convert rectangular to range, azimuth and elevation



Fri Dec 31 18:43:06 2021