# SGP4 TEME frame to J2000 conversion

I've got familiar with the SGP4 model. The problem which I faced is that, the results are in TEME frame.

How to convert the TEME to J2000?

Would be glad also, if you suggest a method in python or julia.

• OK, I give up. What's the TEME frame? Googling didn't help. – user7073 Mar 13 '18 at 19:36

The problem is solved using the Skyfield and Astropy packages in python.

import skyfield.sgp4lib as sgp4lib
from astropy import coordinates as coord, units as u
from astropy.time import Time

# time- J2000 date
# p,v- vectors, result of SGP4 in TEME frame
date= datetime.datetime(2000, 1, 1, 12, 0) + datetime.timedelta(days=time - 2451545)

# Conversion from TEME to ITRS
p,v= sgp4lib.TEME_to_ITRF(time,np.asarray(p),np.asarray(v)*86400)
v=v/86400

# Conversion from ITRS to J2000
now = Time(date)
itrs = coord.ITRS(p[0]*u.km, p[1]*u.km, p[2]*u.km, v[0]*u.km/u.s, v[1]*u.km/u.s, v[2]*u.km/u.s, obstime=now)
gcrs = itrs.transform_to(coord.GCRS(obstime=now))
p,v=gcrs.cartesian.xyz.value,gcrs.velocity.d_xyz.value

• can you please explain the days=time - 2451545 part? I don't really understand what's happening here. Is time the datetime at which you want to convert from TEME to J2000? Is it supposed to be expressed in days? – Raksha Jul 16 '19 at 15:38
• Hi the python code that is shown above using skyfield and astropy does not work because I guess it has been written in a previous version of python. Since I am totally greenhorn on python I need some help. How must this code be modified in order to be able to use it correctly with python 3.9.2. I posted the code again here bellow, because I tried already to get it run, and I think there where some bugs present in the original code (time must be Time and import datetime was missing) Thank you very much! PS: I am still not able to write comments, so I put my questions into answers, unfortunately – Sacha Tholl Apr 18 at 16:31
• ...... Sacha Here's the code: pastebin.com/4e87Qj94 – Sacha Tholl Apr 18 at 16:31

I have published a julia package called SatelliteToolbox.jl that has all the conversions related to IAU-76/FK5 model (ITRF, MOD, TOD, GCRF, PEF, etc.) and now I also added the support for TEME. However, you need to use the master branch because it is not released yet.

To install the package from master, you can do this:

Pkg.add("SatelliteToolbox")
Pkg.checkout("SatelliteToolbox")


If you have a vector represented in TEME r_teme, you can convert it to J2000 using:

D_J2000_TEME = rTEMEtoGCRF(JD_TT)
r_j2000 = D_J2000_TEME*r_teme


where JD_TT is the Julian Day in Terrestrial Time. If you only have the Julian Day in UTC, you can use JD_TT = JD_UTCtoTT(JD_UTC).

This package also have a native implementation of SGP4 (without SDP4 bits yet). The computed vectors from the orbit propagator (position and velocity) are represented in TEME and can be converted to J2000 using the procedure above.

Notice that the definition of TEME in this package is the same as the one used by Vallado, since we do not have an "official" TEME definition. Moreover, all those transformations functions were heavily tested against the examples in the Vallado's book (as you can see in ./test/) folder.

# UPDATE

With the newest commit, it is even easier:

using SatelliteToolbox

# Julian day at 2018-Feb-12 15:35:22 UTC
JD_UTC = DatetoJD(2018,2,12,15,35,22)

# DCM that rotates the TEME frame of Date JD_UTC into J2000.
D_J2000_TEME = rECItoECI(TEME(), J2000(), JD_UTC)

# Quaternion that rotates the TEME frame of Date JD_UTC into J2000.
q_J2000_TEME = rECItoECI(Quaternion, TEME(), J2000(), JD_UTC)

• I do not think so, this was posted this year: asked 2 months ago – Ronan Arraes Jardim Chagas May 26 '18 at 23:20
• quite right @RonanArraesJardimChagas. American date format is confusing – user20636 May 27 '18 at 6:59

Tarlan is spot on with his answer but I wanted to tag along for those not using python or using some other software not being discussed here.

The general consensus is that converting directly between inertial frames gets messy and non-trivial. As a result it would be best to get TEME into a fixed/pseudo-fixed frame before converting it to your inertial frame of choice.

This works not only for J2000, but for any frame. TEME to ECF coordinate transforms are fairly common, especially with telecom companies who want to know what sort of coverage their satellites will be providing. From there going to ECF to whatever inertial frame you are working in will be trivial if you understand the relationship between your fixed and inertial coordinate systems.

• A very late comment, but isn't the transformation from EC(E)F to another ECI frame non-trivial if factors like precession, nutation and polar motion are taken into account? – jos Apr 14 '20 at 5:28

How to convert the TEME to J2000? [using Python]

See: "astropysics/astropysics/coords/coordsys.py", which is from the Astrophysics package.