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
lspcn

Table of contents
Procedure
Abstract
Required_Reading
Keywords
Declarations
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version

Procedure

     LSPCN  ( Longitude of the sun, planetocentric )

     DOUBLE PRECISION FUNCTION LSPCN ( BODY, ET, ABCORR )

Abstract

     Compute L_s, the planetocentric longitude of the sun, as seen
     from a specified body.

Required_Reading

     NAIF_IDS
     PCK
     TIME
     SPK

Keywords

     GEOMETRY
     TIME

Declarations

     IMPLICIT NONE

     INCLUDE               'zzctr.inc'

     CHARACTER*(*)         BODY
     DOUBLE PRECISION      ET
     CHARACTER*(*)         ABCORR

Brief_I/O

     VARIABLE  I/O  DESCRIPTION
     --------  ---  --------------------------------------------------
     BODY       I   Name of central body.
     ET         I   Epoch in seconds past J2000 TDB.
     ABCORR     I   Aberration correction.

     The function returns the value of L_s for the specified body
     at the specified time.

Detailed_Input

     BODY     is the name of the central body, typically a planet.

     ET       is the epoch at which the longitude of the sun (L_s)
              is to be computed. ET is expressed as seconds past
              J2000 TDB (Barycentric Dynamical Time).

     ABCORR   indicates the aberration corrections to be applied
              when computing the longitude of the sun. ABCORR may
              be any of the following.

                 'NONE'     Apply no correction.

                 'LT'       Correct the position of the sun,
                            relative to the central body, for
                            planetary (light time) aberration.

                 'LT+S'     Correct the position of the sun,
                            relative to the central body, for
                            planetary and stellar aberrations.

Detailed_Output

     The function returns the planetocentric longitude of the Sun,
     often called "L_s," for the specified body at the specified time.
     This is the longitude of the body-Sun vector in a right-handed
     frame whose basis vectors are defined as follows:

     -  The positive Z direction is given by the instantaneous
        angular velocity vector of the orbit of the body about
        the Sun.

     -  The positive X direction is that of the cross product of the
        instantaneous north spin axis of the body with the positive
        Z direction.

     -  The positive Y direction is Z x X.

     Units are radians; the range is 0 to 2*pi. Longitudes are
     positive to the east.

Parameters

     None.

Exceptions

     1)  If the input body name cannot be translated to an ID code,
         and if the name is not a string representation of an integer
         (for example, '399'), the error SPICE(NOTRANSLATION) is
         signaled.

     2)  If no SPK (ephemeris) file has been loaded prior to calling
         this routine, or if the SPK data has insufficient coverage, an
         error is signaled by a routine in the call
         tree of this routine.

     3)  If a PCK file containing rotational elements for the central
         body has not been loaded prior to calling this routine, an
         error is signaled by a routine in the call tree of this
         routine.

     4)  If the instantaneous angular velocity and spin axis of BODY
         are parallel, an error is signaled by a
         routine in the call tree of this routine.

Files

     Appropriate SPICE kernels must be loaded by the calling program
     before this routine is called.

     The following data are required:

     -  An SPK file (or files) containing ephemeris data sufficient to
        compute the geometric state of the central body relative to
        the sun at ET must be loaded before this routine is called. If
        light time correction is used, data must be available that
        enable computation of the state the sun relative to the solar
        system barycenter at the light-time corrected epoch. If
        stellar aberration correction is used, data must be available
        that enable computation of the state the central body relative
        to the solar system barycenter at ET.

     -  A PCK file containing rotational elements for the central body
        must be loaded before this routine is called.

Particulars

     The direction of the vernal equinox for the central body is
     determined from the instantaneous equatorial and orbital planes
     of the central body. This equinox definition is specified in
     reference [1]. The "instantaneous orbital plane" is interpreted
     in this routine as the plane normal to the cross product of the
     position and velocity of the central body relative to the sun.
     The geometric state of the central body relative to the sun is
     used for this normal vector computation. The "instantaneous
     equatorial plane" is normal to the central body's north pole
     at the requested epoch. The pole direction is determined from
     rotational elements loaded via a PCK file.

     The result returned by this routine will depend on the
     ephemeris data and rotational elements used. The result may
     differ from that given in any particular version of the
     Astronomical Almanac, due to differences in these input data,
     and due to differences in precision of the computations.

Examples

     The numerical results shown for this example may differ across
     platforms. The results depend on the SPICE kernels used as
     input, the compiler and supporting libraries, and the machine
     specific arithmetic implementation.

     1) A simple program that computes L_s for a body and time
        supplied interactively. The geometric state of the Sun is
        used.

        Example code begins here.


              PROGRAM LSPCN_EX1
              IMPLICIT NONE

              DOUBLE PRECISION      DPR
              DOUBLE PRECISION      LSPCN

              CHARACTER*(*)         ABCORR
              PARAMETER           ( ABCORR = 'NONE' )

              INTEGER               FILSIZ
              PARAMETER           ( FILSIZ = 255 )

              INTEGER               NAMLEN
              PARAMETER           ( NAMLEN = 36 )

              INTEGER               TIMLEN
              PARAMETER           ( TIMLEN = 40 )

              CHARACTER*(NAMLEN)    BODY
              CHARACTER*(FILSIZ)    LSK
              CHARACTER*(FILSIZ)    PCK
              CHARACTER*(FILSIZ)    SPK
              CHARACTER*(TIMLEN)    TIMSTR

              DOUBLE PRECISION      ET
              DOUBLE PRECISION      LON


              CALL PROMPT ( 'Enter name of LSK file > ', LSK )
              CALL PROMPT ( 'Enter name of PCK file > ', PCK )
              CALL PROMPT ( 'Enter name of SPK file > ', SPK )

              CALL FURNSH ( LSK )
              CALL FURNSH ( PCK )
              CALL FURNSH ( SPK )

              WRITE (*,*) ' '
              WRITE (*,*) 'Kernels have been loaded.'
              WRITE (*,*) ' '

              CALL PROMPT ( 'Enter name of central body       > ',
             .               BODY                                  )
              CALL PROMPT ( 'Enter calendar, JD, or DOY time  > ',
             .               TIMSTR                                )

              CALL STR2ET ( TIMSTR, ET )

        C
        C     Convert longitude to degrees.
        C
              LON = DPR() * LSPCN ( BODY, ET, ABCORR )

              WRITE (*,*) ' '
              WRITE (*,*) 'Central body              = ',  BODY
              WRITE (*,*) 'Time                      = ',  TIMSTR
              WRITE (*,*) 'Planetocentric L_s (deg.) = ',  LON
              WRITE (*,*) ' '

              END


        When this program was executed on a Mac/Intel/gfortran/64-bit
        platform, using the LSK file named naif0012.tls, the PCK file
        named pck00010.tpc, the SPK file named de421.bsp; the 'EARTH'
        as central body and the time string '2018 Mar 8  17:59 UTC',
        the output was:


        Enter name of LSK file > naif0012.tls
        Enter name of PCK file > pck00010.tpc
        Enter name of SPK file > de421.bsp

         Kernels have been loaded.

        Enter name of central body       > EARTH
        Enter calendar, JD, or DOY time  > 2018 Mar 8  17:59 UTC

         Central body              = EARTH
         Time                      = 2018 Mar 8  17:59 UTC
         Planetocentric L_s (deg.) =    348.11593978317080

Restrictions

     None.

Literature_References

     [1]  "The Astronomical Almanac for the Year 2005," page L9,
          United States Naval Observatory, U.S. Government Printing
          Office, Washington, D.C., 2004.

Author_and_Institution

     N.J. Bachman       (JPL)
     J. Diaz del Rio    (ODC Space)
     B.V. Semenov       (JPL)

Version

    SPICELIB Version 1.1.1, 25-AUG-2021 (JDR)

        Edited the header to comply with NAIF standard. Removed WHILE
        loop from example code, and added solution.

    SPICELIB Version 1.1.0, 19-SEP-2013 (BVS)

        Updated to save the input body name and ZZBODTRN state
        counter and to do name-ID conversion only if the counter
        has changed.

    SPICELIB Version 1.0.0, 07-JAN-2005 (NJB)
Fri Dec 31 18:36:32 2021