# How can I convert HGI coordinates to J2000 coordinates?

I am looking at old mission data such at this one from Vega 1. The coordinate system provided is HGI. Most of the data I have is in ICRF/J2000.0, as JPL Horizons provides. How can I convert between these two systems?

Ultimately this will probably be done in a Python script, so pointing me to a way to do this with Python would be sufficient, but I don't mind programming the formulas myself, if I can get sufficient understanding. There is a paper that seems to offer a way to do this, but I can't understand enough of the math to really understand what it is doing.

• This is really interesting! Footnote 17 below Table 7 links to here space-plasma.qmul.ac.uk/heliocoords which if you click on "For the current, corrected and up to date version of the information please visit: Heliospheric Coordinate Systems" takes you to a place where all the necessary software to do these transformations and work the specific examples in the paper can be downloaded as a zip and opened in any text editor: See "Subfolder containing IDL software implementing the transformations." – uhoh Jan 13 '19 at 22:57
• I don't know IDL but it looks to be quite easily to read and transcribe into python, or even to use natively. Easy does not mean quick though. Maybe there are Python equivalents to these somewhere out there. update: a search of "IDL to python translator" turns up tons of intriguing results; this looks fun! – uhoh Jan 13 '19 at 23:04
• IDL code is something I can translate to Python, that's not that big of a deal. The trick is to get the right set of formulas. I'm getting closer, but not quite there... – PearsonArtPhoto Jan 14 '19 at 1:07

It turns out this isn't actually that complex. The trick is to use a rotation matrix. The rotation matrix is described here in the paper cited:

The correct transform for the ICRF/J2000.0 is known in the paper as the $$GEI_{J2000}$$. There are actually two transforms that are required.

1. Transform from HGI to $$HAE_{J2000}$$. The values are $$E(\Omega (T_0=0),i,0)$$. The values for these (In degrees) are $$\Omega = 75.75 +1.397 T_9$$, $$i=7.25$$. The transform matrix is given as from $$HAE_{J2000}$$ to HGI, so it must be inverted.
2. Transform from $$HAE_{J2000}$$ to $$GEI_{J2000}$$. In this instance, $$E(0,\omega_0,0)$$, where $$\omega_0=23.4392911$$.
3. The direction is actually inverted, multiply by -1. At least this happens for the data I have tested so far.
4. There might be a difference between SSB and Sun Centered in the two systems. It should be corrected at this point if required.

To transform, take the dot product of the matrix times the vector of the data.

A few test cases, taken where the probe was close to or at Earth, are shown below. The first value the test, next is the calculated value after performing the transforms, and the final is the value as shown by Horizons.

What I think is happening with these is the time isn't precise, nor is the data. It should be sufficient for my purposes, however. The Z value in particular is quite poor, for reasons I am not entirely certain of.

[1.510E+08,3.062E+06,-3.896E+05]
[3.41517588e+07 1.34979645e+08 5.85207686e+07]
[36877374.63162155, 147274725.4229837, 5376.354403272271]

[1.114E+08,1.033E+08,-1.314E+07]
[-7.35301481e+07  1.22567719e+08  5.31411447e+07]
[-69247628.37274936, 135327422.876961, 9620.119567714632]

[-1.385E+08,5.174E+07,-6.582E+06]
[-7.35301481e+07  1.22567719e+08  5.31411447e+07]
[-138500000.0, 51740000.0, -6582000.0]


My code is as follows:

from numpy import sin, cos, pi, deg2rad
import numpy as np
from numpy.linalg import inv, norm

def ConvertHGIToJ2000(vect):
return rot2.dot(rot.dot(vect))

def EulerRotation(o,t,p):
return np.array([
[ cos(p)*cos(o)-sin(p)*sin(o)*cos(t), cos(p)*sin(o)+sin(p)*cos(o)*cos(t),sin(p)*sin(t)],
[-sin(p)*cos(o)-cos(p)*sin(o)*cos(t),-sin(p)*sin(o)+cos(p)*cos(o)*cos(t),cos(p)*sin(t)],
[ sin(o)*sin(t),-cos(o)*sin(t),cos(t)]])