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_dpgrdr

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


Abstract


   CSPICE_DPGRDR computes the Jacobian matrix of the transformation
   from rectangular to planetographic coordinates.

I/O


   Given:

      body     the scalar string name of the body with which the planetographic
               coordinate system is associated.

               help, body
                  STRING = Scalar

               `body' is used by this routine to look up from the
               kernel pool the prime meridian rate coefficient giving
               the body's spin sense.

      x,
      y,
      z        scalar double precision describing the rectangular coordinates
               of the point at which the Jacobian of the map from rectangular
               to planetographic coordinates is desired.

               help, x
                  DOUBLE = Scalar
               help, y
                  DOUBLE = Scalar
               help, z
                  DOUBLE = Scalar

      re       scalar double precision describing the equatorial radius of a
               reference spheroid.

               help, re
                  DOUBLE = Scalar

               This spheroid is a volume of revolution: its horizontal cross
               sections are circular. The shape of the spheroid is defined by
               an equatorial radius `re' and a polar radius `rp'.

      f        scalar double precision describing the flattening coefficient

                  f = (re-rp) / re

               where rp is the polar radius of the spheroid.

               help, f
                  DOUBLE = Scalar

               (More importantly rp = re*(1-f).)

   the call:

      cspice_dpgrdr, body, x, y, z, re, f, jacobi

   returns:

      jacobi   double precision 3x3 matrix describing the matrix of partial
               derivatives of the conversion from rectangular to planetographic
               coordinates.

               help, jacobi
                  DOUBLE = Array[3,3]

               It has the form

                  .-                               -.
                  |  dlon/dx    dlon/dy   dlon/dz   |
                  |                                 |
                  |  dlat/dx    dlat/dy   dlat/dz   |
                  |                                 |
                  |  dalt/dx    dalt/dy   dalt/dz   |
                  `-                               -'

               evaluated at the input values of `x', `y', and `z'.

Parameters


   None.

Examples


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

   1) Find the planetographic state of the earth as seen from
      Mars in the J2000 reference frame at January 1, 2005 TDB.
      Map this state back to rectangular coordinates as a check.

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


         KPL/MK

         File name: dpgrdr_ex1.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
            ---------                     --------
            de421.bsp                     Planetary ephemeris
            pck00008.tpc                  Planet orientation and
                                          radii
            naif0009.tls                  Leapseconds


         \begindata

            KERNELS_TO_LOAD = ( 'de421.bsp',
                                'pck00008.tpc',
                                'naif0009.tls'  )

         \begintext

         End of meta-kernel


      Example code begins here.


      PRO dpgrdr_ex1

         ;;
         ;; Load SPK, PCK, and LSK kernels, use a meta kernel for
         ;; convenience.
         ;;
         cspice_furnsh, 'dpgrdr_ex1.tm'

         ;;
         ;; Look up the radii for Mars.  Although we
         ;; omit it here, we could first call cspice_badkpv
         ;; to make sure the variable BODY499_RADII
         ;; has three elements and numeric data type.
         ;; If the variable is not present in the kernel
         ;; pool, cspice_bodvrd will signal an error.
         ;;
         cspice_bodvrd, 'MARS', 'RADII', 3, radii

         ;;
         ;; Compute flattening coefficient.
         ;;
         re  =  radii[0]
         rp  =  radii[2]
         f   =  ( re - rp ) / re

         ;;
         ;; Look up the geometric state of earth as seen from Mars at
         ;; January 1, 2005 TDB, relative to the J2000 reference
         ;; frame.
         ;;
         cspice_str2et, 'January 1, 2005 TDB', et

         cspice_spkezr, 'Earth', et, 'J2000', 'LT+S', 'Mars',       $
                         state,  ltime

         ;;
         ;; Convert position to planetographic coordinates.
         ;;
         cspice_recpgr, 'MARS', state[0:2], re, f, lon, lat, alt

         ;;
         ;; Convert velocity to planetographic coordinates.
         ;;

         cspice_dpgrdr, 'MARS', state[0], state[1], state[2], re, f, $
                        jacobi

         cspice_mxv, jacobi, state[3:5], pgrvel

         ;;
         ;; As a check, convert the planetographic state back to
         ;; rectangular coordinates.
         ;;
         cspice_pgrrec, 'MARS', lon, lat, alt, re, f, rectan

         cspice_drdpgr, 'MARS', lon, lat, alt, re, f, jacobi

         cspice_mxv, jacobi, pgrvel, drectn

         print, ' '
         print, 'Rectangular coordinates:'
         print, ' '
         print, '  X (km)                 = ', state[0]
         print, '  Y (km)                 = ', state[1]
         print, '  Z (km)                 = ', state[2]
         print, ' '
         print, 'Rectangular velocity:'
         print, ' '
         print, '  dX/dt (km/s)           = ', state[3]
         print, '  dY/dt (km/s)           = ', state[4]
         print, '  dZ/dt (km/s)           = ', state[5]
         print, ' '
         print, 'Ellipsoid shape parameters: '
         print, ' '
         print, '  Equatorial radius (km) = ', re
         print, '  Polar radius      (km) = ', rp
         print, '  Flattening coefficient = ', f
         print, ' '
         print, 'Planetographic coordinates:'
         print, ' '
         print, '  Longitude (deg)        = ', lon / cspice_rpd( )
         print, '  Latitude  (deg)        = ', lat / cspice_rpd( )
         print, '  Altitude  (km)         = ', alt
         print, ' '
         print, 'Planetographic velocity:'
         print, ' '
         print, '  d Longitude/dt (deg/s) = ', pgrvel[0]/cspice_rpd( )
         print, '  d Latitude/dt  (deg/s) = ', pgrvel[1]/cspice_rpd( )
         print, '  d Altitude/dt  (km/s)  = ', pgrvel[2]
         print, ' '
         print, 'Rectangular coordinates from inverse mapping:'
         print, ' '
         print, '  X (km)                 = ', rectan[0]
         print, '  Y (km)                 = ', rectan[1]
         print, '  Z (km)                 = ', rectan[2]
         print, ' '
         print, 'Rectangular velocity from inverse mapping:'
         print, ' '
         print, '  dX/dt (km/s)           = ', drectn[0]
         print, '  dY/dt (km/s)           = ', drectn[1]
         print, '  dZ/dt (km/s)           = ', drectn[2]
         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:


      Rectangular coordinates:

        X (km)                 =    1.4603973e+08
        Y (km)                 =    2.7854661e+08
        Z (km)                 =    1.1975032e+08

      Rectangular velocity:

        dX/dt (km/s)           =       -47.043272
        dY/dt (km/s)           =        9.0732615
        dZ/dt (km/s)           =        4.7579169

      Ellipsoid shape parameters:

        Equatorial radius (km) =        3396.1900
        Polar radius      (km) =        3376.2000
        Flattening coefficient =     0.0058860076

      Planetographic coordinates:

        Longitude (deg)        =        297.66766
        Latitude  (deg)        =        20.844504
        Altitude  (km)         =    3.3653183e+08

      Planetographic velocity:

        d Longitude/dt (deg/s) =   -8.3577067e-06
        d Latitude/dt  (deg/s) =    1.5935567e-06
        d Altitude/dt  (km/s)  =       -11.211601

      Rectangular coordinates from inverse mapping:

        X (km)                 =    1.4603973e+08
        Y (km)                 =    2.7854661e+08
        Z (km)                 =    1.1975032e+08

      Rectangular velocity from inverse mapping:

        dX/dt (km/s)           =       -47.043272
        dY/dt (km/s)           =        9.0732615
        dZ/dt (km/s)           =        4.7579169


Particulars


   When performing vector calculations with velocities it is usually
   most convenient to work in rectangular coordinates. However, once
   the vector manipulations have been performed, it is often
   desirable to convert the rectangular representations into
   planetographic coordinates to gain insights about phenomena in
   this coordinate frame.

   To transform rectangular velocities to derivatives of coordinates
   in a planetographic system, one uses the Jacobian of the
   transformation between the two systems.

   Given a state in rectangular coordinates

      ( x, y, z, dx, dy, dz )

   the velocity in planetographic coordinates is given by the matrix
   equation:
                        t          |                     t
      (dlon, dlat, dalt)   = jacobi|       * (dx, dy, dz)
                                   |(x,y,z)

   This routine computes the matrix

            |
      jacobi|
            |(x, y, z)


   The planetographic definition of latitude is identical to the
   planetodetic (also called "geodetic" in SPICE documentation)
   definition. In the planetographic coordinate system, latitude is
   defined using a reference spheroid. The spheroid is
   characterized by an equatorial radius and a polar radius. For a
   point P on the spheroid, latitude is defined as the angle between
   the X-Y plane and the outward surface normal at P. For a point P
   off the spheroid, latitude is defined as the latitude of the
   nearest point to P on the spheroid. Note if P is an interior
   point, for example, if P is at the center of the spheroid, there
   may not be a unique nearest point to P.

   In the planetographic coordinate system, longitude is defined
   using the spin sense of the body. Longitude is positive to the
   west if the spin is prograde and positive to the east if the spin
   is retrograde. The spin sense is given by the sign of the first
   degree term of the time-dependent polynomial for the body's prime
   meridian Euler angle "W":  the spin is retrograde if this term is
   negative and prograde otherwise. For the sun, planets, most
   natural satellites, and selected asteroids, the polynomial
   expression for W may be found in a SPICE PCK kernel.

   The earth, moon, and sun are exceptions: planetographic longitude
   is measured positive east for these bodies.

   If you wish to override the default sense of positive longitude
   for a particular body, you can do so by defining the kernel
   variable

      BODY<body ID>_PGR_POSITIVE_LON

   where <body ID> represents the NAIF ID code of the body. This
   variable may be assigned either of the values

      'WEST'
      'EAST'

   For example, you can have this routine treat the longitude
   of the earth as increasing to the west using the kernel
   variable assignment

      BODY399_PGR_POSITIVE_LON = 'WEST'

   Normally such assignments are made by placing them in a text
   kernel and loading that kernel via cspice_furnsh.

   The definition of this kernel variable controls the behavior of
   the CSPICE planetographic routines

      cspice_pgrrec
      cspice_recpgr
      cspice_dpgrdr
      cspice_drdpgr

   It does not affect the other CSPICE coordinate conversion
   routines.

Exceptions


   1)  If the body name `body' cannot be mapped to a NAIF ID code, and
       if `body' is not a string representation of an integer, the
       error SPICE(IDCODENOTFOUND) is signaled by a routine in the
       call tree of this routine.

   2)  If the kernel variable

          BODY<ID code>_PGR_POSITIVE_LON

       is present in the kernel pool but has a value other
       than one of

           'EAST'
           'WEST'

       the error SPICE(INVALIDOPTION) is signaled by a routine in the
       call tree of this routine. Case and blanks are ignored when
       these values are interpreted.

   3)  If polynomial coefficients for the prime meridian of `body' are
       not available in the kernel pool, and if the kernel variable
       BODY<ID code>_PGR_POSITIVE_LON is not present in the kernel
       pool, the error SPICE(MISSINGDATA) is signaled by a routine in
       the call tree of this routine.

   4)  If the equatorial radius is non-positive, the error
       SPICE(VALUEOUTOFRANGE) is signaled by a routine in the call
       tree of this routine.

   5)  If the flattening coefficient is greater than or equal to one,
       the error SPICE(VALUEOUTOFRANGE) is signaled by a routine in
       the call tree of this routine.

   6)  If the input point is on the z-axis (x = 0 and y = 0), the
       Jacobian matrix is undefined, an error is signaled by a
       routine in the call tree of this routine.

   7)  If any of the input arguments, `body', `x', `y', `z', `re' or
       `f', is undefined, an error is signaled by the IDL error
       handling system.

   8)  If any of the input arguments, `body', `x', `y', `z', `re' or
       `f', is not of the expected type, or it does not have the
       expected dimensions and size, an error is signaled by the Icy
       interface.

   9)  If the output argument `jacobi' is not a named variable, an
       error is signaled by the Icy interface.

Files


   This routine expects a kernel variable giving BODY's prime
   meridian angle as a function of time to be available in the
   kernel pool. Normally this item is provided by loading a PCK
   file. The required kernel variable is named

      BODY<body ID>_PM

   where <body ID> represents a string containing the NAIF integer
   ID code for `body'. For example, if `body' is 'JUPITER', then
   the name of the kernel variable containing the prime meridian
   angle coefficients is

      BODY599_PM

   See the PCK Required Reading for details concerning the prime
   meridian kernel variable.

   The optional kernel variable

      BODY<body ID>_PGR_POSITIVE_LON

   also is normally defined via loading a text kernel. When this
   variable is present in the kernel pool, the prime meridian
   coefficients for `body' are not required by this routine. See the
   -Particulars section for details.

Restrictions


   None.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.1, 10-AUG-2021 (JDR)

       Updated header to comply with NAIF standard. Added -Examples and
       -Parameters sections.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.0, 11-NOV-2013 (EDW)

Index_Entries


   Jacobian of planetographic  w.r.t. rectangular coordinates



Fri Dec 31 18:43:03 2021