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.
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.
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
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
time is used but never never defined. The imports are wrong. This wouldn't have worked in python 2.7, let alone python 3.
– David Hammen
Jun 19 '22 at 12:40
skyfield API says that the used method (TEME_to_ITRF()) is marked as deprecated: """Deprecated: use the TEME and ITRS frame objects instead."""
– astrosnapper
Jan 11 '23 at 18:23
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.
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)
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.
How to convert the TEME to J2000? [using Python]
See: "astropysics/astropysics/coords/coordsys.py", which is from the Astrophysics package.
See also:
"Tracking satellite footprints on Earth’s surface" or
"Revisiting Spacetrack Report #3: Rev 2", Appendix C - TEME Coordinate System.
Source code (C++, FORTRAN, Java, MATLAB, Pascal. Total: 1,229,282 bytes, .ZIP File).