Discrepancy between Skyfield and manually calculated Orbital Parameters
See original GitHub issueHi there,
I am calculating semi-major axis, perigee and apogee altitude values for certain LEO satellites and came across a discrepancy between my theoretically calculated values and Skyfield provided values. To reproduce I am providing the following script:
# https://orbit.ing-now.com/satellite/39444/2013-066ae/funcube-1/
# Orbit : #704394.00 @ 577 x 658 km x 97.6 deg
# Spacecraft Age : 8 years, 10 months
# Distance Travelled : ≈2.1 billion km
from skyfield.api import EarthSatellite, load, utc, wgs84
import numpy as np
mu = 3.986004418 * 1e14 # gravitational parameter of Earth (m^3s^−2)
fun = """\
1 39444U 13066AE 22257.61551127 .00002978 00000+0 35585-3 0 9990
2 39444 97.6337 227.5603 0057973 99.5629 261.2143 14.83718775474743
"""
# satrec = Satrec.twoline2rv(*fun.splitlines(), WGS84)
# sat = EarthSatellite.from_satrec(satrec, ts)
sat = EarthSatellite(*fun.splitlines())
r_e = sat.model.radiusearthkm
print(f'Skyfield mu value: {sat.model.mu} vs theory: {mu/1e9}')
print(f'Skyfield results -- Axis: {sat.model.a * r_e}, Perigee: {sat.model.altp * r_e}, Apogee: {sat.model.alta * r_e}')
# theoretical computation
T = 2 * np.pi / sat.model.no_kozai * 60
semi_major = (T**2 * mu / (4 * np.pi**2))**(1/3) / 1e3
print(f'''
Theoretical results --
Axis: {semi_major},
Perigee: {semi_major*(1+sat.model.ecco) - sat.model.radiusearthkm},
Apogee: {semi_major*(1-sat.model.ecco) - sat.model.radiusearthkm}''')
The results of the above script are:
Skyfield mu value: 398600.8 vs theory: 398600.4418
Skyfield results -- Axis: 6992.769095396103, Perigee: 574.0949151193616,
Apogee: 655.1732756728427
Theoretical results --
Axis: 6995.747293563754,
Perigee: 658.1687393487309,
Apogee: 577.0558477787772
Please note that the values (577 x 658 km) I have manually computed seems to be in agreement with the values in the website.
I have tried changing the ellipsoid from WGS72 to WGS84 using from_satrec
but that didn’t really change much. There is also some difference in the gravitational constant but that doesn’t seem to really explain the discrepancy either. I have also tested a lower inclination starlink satellite, and in that case the difference seems negligible.
Can you please advise? Best regards
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Thank you for tracking that down!
Alas, I’m not free to alter that line of code—that’s an official line of C++ code from the SGP4 implementation:
https://github.com/brandon-rhodes/python-sgp4/blob/fca7e90de2467308e7cb62ac2d019f383011dbc8/extension/SGP4.cpp#L1476
(Why does it appear twice, you might ask? The code appears in both
propagation.py
(which I do control) and in the C++ code becausepropagation.py
is a slow Python implementation of SGP4 that’s used as a fallback on platforms that can’t compile the C++.)Here’s the source of the official code that the
sgp4
module bundles:https://celestrak.org/publications/AIAA/2006-6753/
If you have found libraries that use alternative math for the semi-major axis, then it may be those libraries that need to be updated—they might not have updated their code to match the latest official code from Vallado, Crawford, Hujsak, and Kelso?
In any case, I can’t, alas, alter that code without breaking the promise that I made in the docs that the
sgp4
library uses a verbatim copy of the official SGP4 algorithm. You maybe could contact one of the authors to ask about why they use the formula they do to compute the semi-major axis? If you do, feel free to comment here on what you learn, since I’m also curious about their choice of formula.It’s possible that the SGP4-computed properties like
alta
are for some special purpose that we don’t know about, and that a straight re-computation of the apogee and perigee per Kepler’s formulae are better for display to users? Let me know if you run into further information clarifying things!I suppose if one of us had time, we could run a loop with that satellite to find out its actual in-practice apogee and perigee, and see if those numbers are closer to your Kepler-computed one, or the one that SGP4 computes. But it could be that it varies from one satellite to another, whether their real apogee/perigee are close to the SGP4 or Kepler numbers, so one satellite’s result wouldn’t necessarily generalize to all.
Again, good job tracking down the exact difference in formulae!