Ephemeris trail
Build VSOP87
Truncating VSOP87
Testing VSOP87
Class organization
Reference frames
Handling frames
Handling precision
Handling time
Putting all together
Swiss Ephemeris
Putting all together
In page "Class Organization", we saw the role of Body and AstroContext. Now we can see how frames, units and precision are taken into account.
Under construction ; does not contain reliable informations.

Class Body

Apart from its index, its coordinates and its coordinate expression, an object of class Body holds the units used to express its coordinates.
It is also used to store the ComputationException which may occur during the computation of its coordinates.

So here is how the Body class look lie :

The methods transforming cartesian to spherical coordinatesare handled by this class, as the result depends on units.

Class AstroContext

The signature of calcBodyCoords() is :
public void calcBodyCoords(int     frame, 
                           int     sphereCart, 
                           double  precision,
                           boolean velocities,
                           int[] units
                          ) throws JEphemException, AstroException
See the javadoc page for more details.

calcBodyCoord's job is :
  • for each of its bodies, call the right class to compute the coordinates for the given precision - order velocity computation if required.
  • Handle coordinate transformations to get to the required frame - transfom spherical / cartesian if necessary.
  • Order unit conversion before returning the results.
  • Class Ephemeris

    jephem.astro.tools.Ephemeris is in charge of producing an ephemeris table.
    It contains coordinates of several bodies, for several julian days.
    This is a higher level class, which can use astronomical classes, but don't perform any astro computations. The Ephemeris constructor will build one AstroContext per julian day, and call their calcBodyCoords method.
    To build an Ephemeris object, one must provide these informations :
    int[]      bodyIndexes, 
    double[]   JDs, 
    int[]      whichCoords,
    int[]      coordUnits,
    int        frame,
    int        sphereCart, 
    double     precision

    Exception Handling

    During computation, two kinds of exceptions can be found :

  • Computation exceptions, thrown by classes implementing PlanetaryTheory (VSOP87, Pluto99 ...), when a computation is asked for a date not handled by a theory, or for a precision that can't be reached. When this happens a jephem.astro.solarsystem.ComputationException is stored in the corresponding Body. Note that planetary theories never throw ComputationExceptions.

  • Other exceptions, like I/O errors. When this occurs, a jephem.astro.AstroException is thrown
  • Class diagram

    It is now possible complete the diagram presented in the page Class organization.