New Lunar Kernels based on DE421
--------------------------------
For scientists and engineers interested in the moon there are several new generic kernels now available.
The ephemeris and lunar frames orientation information used to construct the SPICE kernels mentioned here
are produced and provided by William Folkner of JPL's Solar System Dynamics Group and James Williams of
JPL's Geodynamics and Space Geodesy Group.

 - DE421 is the latest planet and lunar ephemeris (SPK).
     ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets   de421.bsp

 - A new binary Planetary Constants Kernel (PCK) for the moon, based on libration data obtained from
DE421, is now available. This offers the current best available JPL lunar orientation information.
     ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck   moon_pa_de421_1900-2050.bpc

 - To make use of the new lunar PCK mentioned above NAIF provides a new lunar frames kernel (FK). This
file gives SPICE users easy access to the two popular, high-accuracy lunar body-fixed reference frames:
the Principal Axes (PA) frame, and the Mean Earth/Polar Axis (ME) frame.
     ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/fk/satellites  moon_080317.tf

Included inside this frames kernel (a simple text file) is a good deal of descriptive information about
how the PA and ME frames compare, and the differences between the PA and ME frames as realized using the
DE421 products versus as realized using the predecessor DE418 products.

 - Also part of this new complement of lunar oriented products are versions of the two so-called "moon
association" kernels (FK). These make either the PA frame or the ME frame to be used by a small set of
SPICE modules (APIs) that assume use of a default reference frame. (Any versions of these "association
kernels" may be used indefinitely--they need not be updated when NAIF makes new versions. The only reason
NAIF updates them is to update the example meta-kernel contained in the comments.)
    ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/fk/satellites   moon_assoc_pa.tf
    ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/fk/satellites   moon_assoc_me.tf

 - As has always been the case, the size/shape of the moon (IAU values) must be obtained from the 
traditional text-format generic PCK. The current version of this kernel is named pck00008.tpc. (Note 
that text PCKs also contain lunar orientation information, for the frame named "IAU_MOON". But the presence 
of this information will not be a problem since you will be using either the "MOON_PA" or the MOON_ME" 
frame instead.)

The above mentioned kernels are available from the NAIF server in the normal location under "generic_kernels":
  http://naif.jpl.nasa.gov/naif/data.html
  ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels

A tutorial describing these special products is available from the NAIF server. The tutorial is named 
"25_lunar-earth_pck-fk." Pages 10-26 cover the moon.
  http://naif.jpl.nasa.gov/naif/tutorials.html
The easiest way to use SPICE kernels in a program is to create a so-called "furnsh kernel" and load that 
into your program. (In NAIF lingo we sometimes refer to a furnsh kernel as a meta-kernel.) By loading 
the furnish kernel, all the kernels named inside of it will be loaded into your program. This makes it 
easy to change the names and numbers of kernels to be loaded into your program during different runs. 
An example of a furnsh kernel that deals with the generic lunar kernels mentioned above is provided 
here. In most practical cases you would need to add some additional kernels, such as a spacecraft 
ephemeris kernel, and perhaps still others.


              ------------- begin example FURNSH kernel ------------------

KPL/MK

       This is a sample FURNSH kernel for use on a lunar mission. Note that it
       contains ONLY the generic kernels needed; a number of mission-specific kernels
       would also be needed for most tasks.

       In this example we've assumed the customer wishes to use the "MOON_ME" frame
       as the default frame in those SPICE APIs that make use of a default frame.
       (If you wanted to instead use the PA frame as the default frame within SPICE,
       you would change the name of the Frame Association kernel to "moon_assoc_pa.tf"
       in the KERNELS_TO_LOAD assignment below.)
       
       In this example FURNSH kernel we assume all the needed kernels are in the user's
       current working directory. Such is often not the case. If some or all of the
       kernels are located elsewhere, the appropriate path specifications must also
       be provided. Examples of doing this are available in the SPICE tutorial named
       "08_intro_to_kernels".

       The "KPL/MK" token at the top of this example is a necessary part of the kernel,
       as is the <backslash>begindata token and everything that follows it up until the
       <backslash>begintext token. Everything else is explanatory comments that could be
       removed (although NAIF suggests you leave them in for future reference). A
       description of text kernels is found in the tutorial named "08_intro_to_kernels".

       Be careful: any text kernel such as this FURNSH kernel must have end-of-line
       terminators appropriate for the machine being used. This includes the final line
       of the kernel!  If you cut/paste this example into a new file on the machine on
       which it will be used you'll be ok. But if you move that new file to a different
       kind of machine there is a chance of a problem. Text-compatible machines are
       identified on page 6 of the tutorial named "09_porting_kernels." Page 5 of that
       tutorial provides instructions for fixing a non-compatible text kernel.

       
         Kernels to load are:

                Lunar kernels
                -------------
                Binary lunar PCK:          moon_pa_de421_1900-2050.bpc
                Lunar FK:                  moon_080317.tf
                Frame association kernel:  moon_assoc_me.tf


                Additional kernels to support sub-point and other popular computations
                ----------------------------------------------------------------------
                Text PCK for lunar radii:  pck00008.tpc

                Leapseconds kernel (for
                time conversion):          naif0008.tls

                Planetary ephemeris (for
                sub-Earth computation):    de421.bsp


    \begindata

         KERNELS_TO_LOAD = ( 'moon_pa_de421_1900-2050.bpc'
                             'moon_080317.tf'
                             'moon_assoc_me.tf'
                             'pck00008.tpc'
                             'naif0008.tls'
                             'de421.bsp' )

    \begintext

       End of example furnsh kernel.


              ------------- end example FURNSH kernel ------------------


New APIs of Possible Interest
-----------------------------
In March 2008 NAIF released a new version of the SPICE Toolkit: Version N62. While the addition of a 
MATLAB interface to SPICE (named "Mice") was the primary driver for providing this new version, a number 
of other new and improved capabilities were also added. Amongst those new capabilities is a set of new 
high-level APIs (subroutines) that are nearly identical to previous routines except for the way the 
name of a body-fixed reference frame ("coordinate system") is provided to the calculations done inside 
the routine.

In the old style routines a default body-fixed frame is assumed: the user does not need to provide 
the name of that frame. The assumed frame is normally one of the SPICE built-in frames with a name 
style of "IAU_<body name>".  Examples of these frame names are "IAU_MOON" and "IAU_MARS." The data 
needed to determine the orientation of these frames are taken from the generic text Planetary Constants 
Kernel (PCK), which is based on orientation data approved by the "IAU Working Group on cartographic and 
rotational elements" and published in the journal Celestial Mechanics and Dynamical Astronomy.

One can override this default body-fixed reference frame assignment using a relatively obscure SPICE 
capability--adding the following assignment in any loaded text kernel:

  OBJECT_<body name>_FRAME = '<frame name>'

For example, to use the "MOON_PA" frame mentioned above instead of the default "IAU_MOON" frame, one 
would need this assignment

  OBJECT_MOON_FRAME =  'MOON_PA'

in any text kernel that is loaded into one's program.  The "moon association kernels" mentioned at the 
top of this note do just that, substituting either MOON_PA or MOON_ME as the default lunar frame in place 
of the rather imprecise IAU_MOON frame.

This default frame architecture seemed like a good idea in the early days of SPICE, before it was realized 
that other, much better body-fixed frames would become available for use in some cases (the moon being the 
best example). Now, allowing a default frame to be used unknowingly by many SPICE users seems quite dangerous.

As a consequence of this new wisdom, NAIF has made new versions of the several high-level APIs that made use 
of a default body-fixed reference frame. In these new versions of those routines the user must supply as 
an input argument the name of the body-fixed frame to be used. NAIF encourages new SPICE users to use the 
new routines, and suggests those who are already using the old versions consider switching to the new 
versions as soon as convenient. (But the old versions will not be deleted in future Toolkit releases.)

The old and new routines are listed here.

  OLD           NEW                  Brief Abstract
------        ------     ----------------------------------------------------------------------
ILLUM         ILUMIN     Find the illumination angles (phase, solar incidence, and emission) at 
                         a specified surface point of a target body.

SRFXPT        SINCPT     Given an observer and a direction vector defining a ray, compute the 
                         surface intercept of the ray on a target body at a specified epoch, 
                         optionally corrected for light time and stellar aberration.

SUBPT         SUBPNT     Compute the rectangular coordinates of the sub-observer point on a 
                         target body at a specified epoch, optionally corrected for light time
                         and stellar aberration.

SUBSOL        SUBSLR     Compute the rectangular coordinates of the sub-solar point on a 
                         target body at a specified epoch, optionally corrected for light time
                         and stellar aberration.


The "new" routines use improved aberration correction algorithms, so output values obtained from these 
routines will be slightly different from those obtained from their deprecated counterparts. See the in-line 
"header" documentation in the C or Fortran versions of the routines for details.