module Ephemerides

export ephemerides, masses, G

#= 

This module exports ephemerides (position and velocity) and masses of 12 objects of 
the solar system. 

The ephemerides are for 2025-Jan-01, 00:00 UTC.
They are given in the form [x, y, z, ẋ, ẏ, ż]. 
Source: https://ssd.jpl.nasa.gov/horizons/app.html

It also exports the gravitational constant G using the same units. 

The objects are:
 - the Sun
 - the planets (but Earth replaced by the Earth-Moon barycenter, combining both masses)
 - 3 dwarf planets: Pluto, Makemake and Haumea 

units used
==========
  distance:  astronomical units (1au = 149 597 870.7km, the average Earth-Sun distance),
  time:      days (1d = 86400s) 
  velocity:  au/d
  mass:      solar mass

coordinate system
=================

The *International Celestial Reference System* ICRS works roughly as follows:

    - It is a cartesian coordinate system with  origin at the solar system barycenter.
    - The direction of the Z axis is given by Earth's axis of rotation, pointing northwards.
    - So, the XY plane is parallel to the equatorial plane of planet Earth. 
    - This plane intersects the ecliptic plane (the orbital plane of Earth's path around Sun). 
      The line of intersection defines the direction of the X axis, pointing to the spring equinox.  
    - The Y axis is orthogonal to the X and Z axes and oriented such that the system has positive 
      orientation.

Today this coordinate system is defined with highest precision by using a list of 
extragalactical radio sources (quasars) and fixing its orientation with respect to them. 

=#

const ephemerides = Dict(
    "sun" => [-0.005730606324378153, -0.004576752799791064, -0.001788610722936142, 
               7.160788611314778e-6, -3.317173169573392e-6, -1.566453436145336e-6], 
    "mercury" => [-0.3930336148500469, -0.1618293039446722, -0.04565186300870311, 
                   0.005031590985068973, -0.02171734134754302, -0.01212198504344544], 
    "venus" => [0.44768815914942, 0.5185819667939302, 0.204928485086883, 
               -0.01579911349143828, 0.01113451421915626, 0.006010096341482151],
    "earth moon barycenter" => [-0.1844016973553943, 0.8826079384695026, 0.3827946231514932, 
                                -0.01719103306114967, -0.002930561040926557, -0.001270382821422522], 
    "mars" => [-0.5274164728925163, 1.37699585736471, 0.645977319743246, 
               -0.01270467411479119, -0.003162816692234347, -0.001107852840109519], 
    "jupiter" => [1.050302939252324, 4.574254230574563, 1.935117161873011, -0.007469111612367896, 
                  0.001698996921183053, 0.0009100581185057272],
    "saturn" => [9.45533666517644, -1.485997374774791, -1.02104742877115, 
                 0.0007165415690664376, 0.005069006512179482, 0.002063236740923188], 
    "uranus" => [11.09789820880128, 14.79531570815821, 6.322978966253667, 
                 -0.003266567450208665, 0.001860835209455758, 0.0008612331109812846], 
    "neptune" => [29.87419674943718, -0.3177344749283765, -0.8738130525998591, 
                   4.657674111212642e-5, 0.002922684211413575, 0.001194671150177399], 
    "pluto" => [18.22308572034037, -26.71704267765936, -13.82813468743925, 
                 0.002766138643858243, 0.001217628461507286, -0.0004401769441580132], 
    "makemake" => [-46.05312892051246, -8.273489834228855, 24.25716281130756, 
                     0.0001608444844153338, -0.002147631289174078, -0.0003058115532461441], 
    "haumea" => [-37.52689197376713, -22.9699547517061, 23.59586606506359, 
                   0.001356288812883477, -0.001772782686675365, -0.0001141454118966552], 
)

const masses = Dict(
    "sun" => 1., 
    "mercury" => 1/6023682.155592, 
    "venus" => 1/408523.718658,
    "earth moon barycenter" => (1/332946.048834 + 1/27068703.241203),
    "mars" => 1/3098703.590291, 
    "jupiter" => 1/1047.348625, 
    "saturn" => 1/3497.901768,
    "uranus" => 1/22902.981613, 
    "neptune" => 1/19412.259776,
    "pluto" => 1/135836683.768617, 
    "makemake" => 3.1e21/1.988416e30, 
    "haumea" =>  4.006e21/1.988416e30 
)

const G = 2.95912208286e-4

end # module
