Homepage Research OfficeCam AstronomyRefs FriendsPages

Heliocentric Julian date (HJD) calculation

I have yet to find a page on the web which explains how you calculate the Julian date in a heliocentric reference frame. So I wrote a C-programme and web page to do it.

The Heliocentric Julian date (HJD from now on) takes into account the light travel time between the Earth and a celestial source on a sphere 1 AU in diameter, as positioned on the Sun; hence the term Heliocentric. The difference between this date and a normal Julian date is therefore different by at most 2 * 8 minutes when the Earth and the source are opposite each other when viewed from the Sun.

Of course this is how I imagine it from various bits of source code I have managed to find. I have written some C code to calculate the Julian date, Modified Julian date, and Heliocentric Julian dates for a general Gregorian time (22/2/2002 13:05:00 UT for example), given a source position.

This is how I did it:

  1. Calculated the Julian date from the Gregorian time and calculated a modified Julian date (look at the code if you are interested).
  2. Calculated the Right Ascension and Declination of the Sun at this particular MJD.
  3. Converted the Sun's RA and Dec to the RA and Dec of the Earth as seen from the Sun.
  4. Inputs the Sources RA and Dec.
  5. Converts the Earth's RA and Dec, and the source's RA and Dec to X,Y and Z co-ordinates centred on the Sun (Heliocentric Cartesian).
  6. Calculates the difference between the Earth and the source position vectors.
  7. Calculates the light travel time between these two vectors.
  8. Adds this adjustment to the MJD.
  9. Converts it back to JD, and outputs the result.

I have used the MJD in all calculations because of the added accuracy involved in the code. It is also easier to debug code if you are looking at numbers with 51324.4 instead of 2451324.9, but that is a matter of style.

The code to calculate the Sun's RA and Dec is of low-precision rather than high because it doesn't take into account perturbations on the Earth from the other planets in the solar system. The Starlink heliocentric and barycentric position and velocity routines (taken from the FORTRAN code from Stumpff P., 1980, A&AS, 41, 1), which are used sometimes in the astrophysics community, but I had great difficulty in porting the FORTRAN to C accurately given the tendency of FORTRAN writers to use a very limited and convoluted naming convention in their variables. And not to document the code at all. My code uses a simple approximation to the solar system as detailed in Practical astronomy with your calculator, Peter Duffett-Smith, CUP, Cambridge. The accuracy of these routines is easily within 10s arcsec and so is sufficient for anything but high-precision calculations.

hjd-0.1 is the C code to do this calculation. I cannot guarantee it is perfect and of course comes with no warranty, but is there for reference, and as is with all of my programmes is well documented enough that you can see what the programme is doing.

Valid HTML 4.01 Last Updated: 14 March 2002. Richard Ogley
Valid CSS
html 3.2