JNISpice
version 2.0.0

spice.basic
Class SubSolarRecord

java.lang.Object
  extended by spice.basic.Vector3
      extended by spice.basic.SubSolarRecord

public class SubSolarRecord
extends Vector3

Class SubSolarRecord supports sub-solar point computations.

A SubSolarRecord instance consists of

The principal method for computing sub-illumination source points is the constructor SubSolarRecord(String,Body,Time,ReferenceFrame, AberrationCorrection,Body). See documentation of this constructor for code examples.

Files

Appropriate SPICE kernels must be loaded by the calling program before methods of this class are called.

The following data are required:

The following data may be required:

Kernel data are normally loaded once per program run, NOT every time a method of this class is called.

Class SubSolarRecord Particulars

Using DSK data

DSK loading and unloading

DSK files providing data used by this class are loaded by calling KernelDatabase.load(java.lang.String) and can be unloaded by calling KernelDatabase.unload(java.lang.String) or KernelDatabase.clear(). See the documentation of KernelDatabase.load(java.lang.String) for limits on numbers of loaded DSK files. For run-time efficiency, it's desirable to avoid frequent loading and unloading of DSK files. When there is a reason to use multiple versions of data for a given target body---for example, if topographic data at varying resolutions are to be used---the surface list can be used to select DSK data to be used for a given computation. It is not necessary to unload the data that are not to be used. This recommendation presumes that DSKs containing different versions of surface data for a given body have different surface ID codes.

DSK data priority

A DSK coverage overlap occurs when two segments in loaded DSK files cover part or all of the same domain---for example, a given longitude-latitude rectangle---and when the time intervals of the segments overlap as well.

When DSK data selection is prioritized, in case of a coverage overlap, if the two competing segments are in different DSK files, the segment in the DSK file loaded last takes precedence. If the two segments are in the same file, the segment located closer to the end of the file takes precedence.

When DSK data selection is unprioritized, data from competing segments are combined. For example, if two competing segments both represent a surface as a set of triangular plates, the union of those sets of plates is considered to represent the surface.

Currently only unprioritized data selection is supported. Because prioritized data selection may be the default behavior in a later version of the routine, the UNPRIORITIZED keyword is required in the constructors' `method' arguments.

Version and Date

Version 2.0 10-JAN-2017 (NJB)

This class now supports DSK-based target body surface representations.

This class is now derived from class Vector3.

Changed name of constructor input argument from `solar' to `obsrvr'.

Version 1.0.0 14-JUL-2009 (NJB)


Field Summary
static java.lang.String INTERCEPT_ELLIPSOID
           
static java.lang.String NEAR_POINT_ELLIPSOID
           
 
Constructor Summary
SubSolarRecord()
          No-arguments constructor.
SubSolarRecord(java.lang.String method, Body target, Time t, ReferenceFrame fixref, AberrationCorrection abcorr, Body obsrvr)
          Find a specified sub-solar point; create a record containing the result.
SubSolarRecord(SubSolarRecord ssr)
          Copy constructor.
 
Method Summary
 Vector3 getSubPoint()
          Return the sub-solar point.
 Vector3 getSurfaceVector()
          Return the observer to sub-solar point vector.
 TDBTime getTargetEpoch()
          Return the target epoch.
 
Methods inherited from class spice.basic.Vector3
add, assign, cross, dist, dot, getElt, hat, isZero, lcom, lcom, negate, norm, perp, proj, rotate, rotate, scale, sep, sub, toArray, toString, ucross
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NEAR_POINT_ELLIPSOID

public static final java.lang.String NEAR_POINT_ELLIPSOID
See Also:
Constant Field Values

INTERCEPT_ELLIPSOID

public static final java.lang.String INTERCEPT_ELLIPSOID
See Also:
Constant Field Values
Constructor Detail

SubSolarRecord

public SubSolarRecord()
No-arguments constructor.


SubSolarRecord

public SubSolarRecord(SubSolarRecord ssr)
               throws SpiceException
Copy constructor. This method creates a deep copy.

Throws:
SpiceException

SubSolarRecord

public SubSolarRecord(java.lang.String method,
                      Body target,
                      Time t,
                      ReferenceFrame fixref,
                      AberrationCorrection abcorr,
                      Body obsrvr)
               throws SpiceException
Find a specified sub-solar point; create a record containing the result.

Code Examples

The numerical results shown for these examples 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. Find the sub-solar point on Mars as seen from the Earth for a specified time.

    Compute the sub-solar point using both triaxial ellipsoid and topographic surface models. Topography data are provided by a DSK file. For the ellipsoid model, use both the "intercept" and "near point" sub-observer point definitions; for the DSK case, use both the "intercept" and "nadir" definitions.

    Display the locations of both the sun and the sub-solar point relative to the center of Mars, in the IAU_MARS body-fixed reference frame, using both planetocentric and planetographic coordinates.

    The topographic model is based on data from the MGS MOLA DEM megr90n000cb, which has a resolution of 4 pixels/degree. A triangular plate model was produced by computing a 720 x 1440 grid of interpolated heights from this DEM, then tessellating the height grid. The plate model is stored in a type 2 segment in the referenced DSK file.

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

    
    KPL/MK 
    
    File: SubSolarRecordEx1.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 
       mar097.bsp                       Mars satellite ephemeris 
       pck00010.tpc                     Planet orientation and 
                                        radii 
       naif0012.tls                     Leapseconds 
       megr90n000cb_plate.bds           Plate model based on 
                                        MEGDR DEM, resolution 
                                        4 pixels/degree. 
    
    \begindata 
    
       KERNELS_TO_LOAD = ( 'de430.bsp', 
                           'mar097.bsp', 
                           'pck00010.tpc', 
                           'naif0012.tls', 
                           'megr90n000cb_plate.bds' ) 
    \begintext 
    
    
    

    Example code begins here.

    //
    // Program SubSolarRecordEx1
    //
    
    import spice.basic.*;
    import static spice.basic.AngularUnits.*;
    
    //
    // Find the sub-solar point on Mars as seen from the Earth for a 
    // specified time.  
    //
    public class SubSolarRecordEx1
    {
       //
       // Load SPICE shared library.
       //
       static{ System.loadLibrary( "JNISpice" ); }
    
    
       public static void main( String[] args )
    
          throws SpiceException
       {
          //
          // Local constants
          //
          final String                      META   = "SubSolarRecordEx1.tm";
          final int                         NMETH  = 4;
    
          //
          // Local variables
          //
          AberrationCorrection              abcorr = 
                                               new AberrationCorrection( "CN+S" );
    
          Body                              Sun    = new Body( "Sun"   );
          Body                              obsrvr = new Body( "Earth" );
          Body                              target = new Body( "Mars"  );
    
          LatitudinalCoordinates            latCoordsObs;
          LatitudinalCoordinates            latCoordsSub;
    
          PlanetographicCoordinates         pgrCoordsObs;
          PlanetographicCoordinates         pgrCoordsSub;
    
          ReferenceFrame                    fixref =
                                               new ReferenceFrame( "IAU_MARS" );
    
          StateVector                       sunst;
    
          String                            refloc = "OBSERVER";
    
          String[]                          submth =  
                                            {
                                               "Intercept/ellipsoid",
                                               "Near point/ellipsoid",
                                               "Intercept/DSK/Unprioritized",
                                               "Nadir/DSK/Unprioritized"
                                            };
    
          String                            tdbstr = "2008 AUG 11 00:00:00 UTC";
    
          SubSolarRecord                    subrec;
    
          TDBTime                           et;
          TDBTime                           trgepc;
    
          Vector3                           srfvec;
          Vector3                           sunpos;
    
          double                            dist;  
          double                            f;
          double                            opclat;
          double                            opclon;
          double                            opgalt;
          double                            opglat;
          double                            opglon;
          double[]                          radii;
          double                            re;
          double                            rp;
          double                            spclat;
          double                            spclon;
          double                            spgalt;
          double                            spglat;
          double                            spglon;
          double                            sunlt;
          double                            supcln;
          double                            supclt;
          double                            supgal;
          double                            supgln;
          double                            supglt;
    
          int                               i;
          int                               n;
    
    
          try
          {
             //
             // Load kernels.
             //
             KernelDatabase.load( META );
    
             //
             // Convert the UTC request time string to seconds past
             // J2000, TDB, represented by a TDBTime instance.
             //
             et = new TDBTime( tdbstr );
    
             //
             // Look up the target body's radii. We'll use these to
             // convert Cartesian to planetographic coordinates. Use
             // the radii to compute the flattening coefficient of
             // the reference ellipsoid.
             //
             radii = target.getValues( "RADII" );
    
             //
             // Let `re and `rp' be, respectively, the equatorial and
             // polar radii of the target.
             //
             re = radii[0];
             rp = radii[2];
    
             f  = ( re - rp ) / re;
    
             //
             // Compute the sub-solar point using light time and stellar
             // aberration corrections. Use both ellipsoid and DSK 
             // shape models, and use all of the "near point," 
             // "intercept," and "nadir" sub-observer point definitions. 
             //
             for ( i = 0;  i < NMETH;  i++ )
             {
                System.out.format ( "%nSub-solar point computation " +
                                    "method = %s%n",  submth[i]           );
    
                subrec = new SubSolarRecord ( submth[i], target, et, 
                                              fixref,    abcorr, obsrvr ); 
    
                trgepc = subrec.getTargetEpoch();
    
                //
                // Convert the sub-solar point's rectangular coordinates to
                // planetographic longitude, latitude and altitude. 
                // Convert radians to degrees.
                //
                pgrCoordsSub = 
    
                   new PlanetographicCoordinates( target, subrec, re, f );
    
                spgalt = pgrCoordsSub.getAltitude();
                spglon = pgrCoordsSub.getLongitude() * DPR;
                spglat = pgrCoordsSub.getLatitude()  * DPR;
    
    
                //
                // Convert the sub-solar point's rectangular coordinates to
                // planetocentric latitude and longitude. Convert radians to 
                // degrees.
                //
                latCoordsSub = new LatitudinalCoordinates( subrec );
    
                spclon    = latCoordsSub.getLongitude() * DPR; 
                spclat    = latCoordsSub.getLatitude()  * DPR; 
    
                //
                // Compute the Sun's apparent position relative to the 
                // sub-solar point at `trgepc'. Add the position of the
                // sub-solar point relative to the target's center to
                // obtain the position of the sun relative to the target's
                // center. Express the latter position in planetographic 
                // coordinates.
                //
    
                sunst  = new StateVector( Sun,    trgepc, fixref, refloc,
                                          abcorr, subrec, target, fixref );
    
                sunpos = (sunst.getPosition()).add( subrec );
    
                pgrCoordsObs = 
    
                   new PlanetographicCoordinates( target, sunpos, re, f );
    
                supgln = pgrCoordsObs.getLongitude() * DPR;
                supglt = pgrCoordsObs.getLatitude()  * DPR;
    
    
                //
                // Convert the sun's rectangular coordinates to
                // planetocentric radius, longitude, and latitude.
                // Convert radians to degrees.
                //
                latCoordsObs = new LatitudinalCoordinates( sunpos );
    
                supcln    = latCoordsObs.getLongitude() * DPR; 
                supclt    = latCoordsObs.getLatitude()  * DPR; 
    
                //
                // Write the results.
                // 
                System.out.format( 
                    "%n"                                                    +
                    " Computation method = %s%n%n"                          +
                    "  Sub-solar point altitude            (km) = %21.9f\n" +
                    "  Sub-solar planetographic longitude (deg) = %21.9f\n" +
                    "  Sun's planetographic longitude     (deg) = %21.9f\n" +
                    "  Sub-solar planetographic latitude  (deg) = %21.9f\n" +
                    "  Sun's planetographic latitude      (deg) = %21.9f\n" +
                    "  Sub-solar planetocentric longitude (deg) = %21.9f\n" +
                    "  Sun's planetocentric longitude     (deg) = %21.9f\n" +
                    "  Sub-solar planetocentric latitude  (deg) = %21.9f\n" +
                    "  Sun's planetocentric latitude      (deg) = %21.9f\n" +
                    "%n",
                    submth[i], 
                    spgalt,
                    spglon,
                    supgln, 
                    spglat,
                    supglt, 
                    spclon, 
                    supcln,
                    spclat,
                    supclt      );
    
    
             } // End of method loop
    
          } // End of try block
    
          catch ( SpiceException exc )
          {
             exc.printStackTrace();
          }
    
       } // End of main method 
    
    }
    
    

    When this program was executed on a PC/Linux/gcc/64-bit/java 1.5 platform, the output was:

    
    Sub-solar point computation method = Intercept/ellipsoid
    
     Computation method = Intercept/ellipsoid
    
      Sub-solar point altitude            (km) =           0.000000000
      Sub-solar planetographic longitude (deg) =         175.810675508
      Sun's planetographic longitude     (deg) =         175.810675508
      Sub-solar planetographic latitude  (deg) =          23.668550281
      Sun's planetographic latitude      (deg) =          23.420823362
      Sub-solar planetocentric longitude (deg) =        -175.810675508
      Sun's planetocentric longitude     (deg) =        -175.810675508
      Sub-solar planetocentric latitude  (deg) =          23.420819936
      Sun's planetocentric latitude      (deg) =          23.420819936
    
    
    Sub-solar point computation method = Near point/ellipsoid
    
     Computation method = Near point/ellipsoid
    
      Sub-solar point altitude            (km) =           0.000000000
      Sub-solar planetographic longitude (deg) =         175.810675408
      Sun's planetographic longitude     (deg) =         175.810675408
      Sub-solar planetographic latitude  (deg) =          23.420823362
      Sun's planetographic latitude      (deg) =          23.420823362
      Sub-solar planetocentric longitude (deg) =        -175.810675408
      Sun's planetocentric longitude     (deg) =        -175.810675408
      Sub-solar planetocentric latitude  (deg) =          23.175085578
      Sun's planetocentric latitude      (deg) =          23.420819936
    
    
    Sub-solar point computation method = Intercept/DSK/Unprioritized
    
     Computation method = Intercept/DSK/Unprioritized
    
      Sub-solar point altitude            (km) =          -4.052254284
      Sub-solar planetographic longitude (deg) =         175.810675512
      Sun's planetographic longitude     (deg) =         175.810675512
      Sub-solar planetographic latitude  (deg) =          23.668848891
      Sun's planetographic latitude      (deg) =          23.420823362
      Sub-solar planetocentric longitude (deg) =        -175.810675512
      Sun's planetocentric longitude     (deg) =        -175.810675512
      Sub-solar planetocentric latitude  (deg) =          23.420819936
      Sun's planetocentric latitude      (deg) =          23.420819936
    
    
    Sub-solar point computation method = Nadir/DSK/Unprioritized
    
     Computation method = Nadir/DSK/Unprioritized
    
      Sub-solar point altitude            (km) =          -4.022302438
      Sub-solar planetographic longitude (deg) =         175.810675412
      Sun's planetographic longitude     (deg) =         175.810675412
      Sub-solar planetographic latitude  (deg) =          23.420823362
      Sun's planetographic latitude      (deg) =          23.420823362
      Sub-solar planetocentric longitude (deg) =        -175.810675412
      Sun's planetocentric longitude     (deg) =        -175.810675412
      Sub-solar planetocentric latitude  (deg) =          23.174793924
      Sun's planetocentric latitude      (deg) =          23.420819936
    
    
    
  2. Throws:
    SpiceException
Method Detail

getSubPoint

public Vector3 getSubPoint()
Return the sub-solar point.


getTargetEpoch

public TDBTime getTargetEpoch()
Return the target epoch.


getSurfaceVector

public Vector3 getSurfaceVector()
Return the observer to sub-solar point vector.


JNISpice
version 2.0.0

JNISpice Alpha Test Version 2.0.0 28-JAN-2017 (NJB)