I’ve noticed differences between position in TEME as reported by (github):
shashwatak/satellite-js
brandon-rhodes/python-sgp4
and Orekit
and put results and codes used in repo:
While satellite.js and python-sgp4 differ by more than 1m for couple of sats, Orekit and python-sgp4 differ by more than 100m for only couple of sats while almoast all sats differ by more than 1 m.
My conclusion is I have something wrong in my code, probably related to parsing datetimes (i’ve used one datetime for all sats and libraries 2022-10-19T00:00:00Z). Could you help me where I’m wrong? My expectation was that different SGP4 implementations should yield very similar results for the same inputs (TLE and datetimes).
It could be a copy/paste of your Orekit program in the current forum thread in order to see if there is something wrong.
Because without seeing your code, it is difficult to find possible mistakes.
Code is fortunately short generate a list of SGP4 propagated positions in TEME in Skyfield/satellite.js and then for the same timestamp and TLE i generate the TLE positions in Orekit and I get a lot of >100 m differences for the same TLEs-timestamp pairs. Orekit code:
var s = new TLE(tle.get(0).toString(), tle.get(1).toString());
var propagator = TLEPropagator.selectExtrapolator(s);
var utc = TimeScalesFactory.getUTC();
var coords = propagator.getPVCoordinates(new AbsoluteDate(time, utc));
var orekit_x = coords.getPosition().getX()/1000;
var orekit_y = coords.getPosition().getY()/1000;
var orekit_z = coords.getPosition().getZ()/1000;
And for reference satellite.js code:
var satrec = satellite.twoline2satrec(sat.tle[0], sat.tle[1])
var positionAndVelocity = satellite.propagate(satrec, new Date(sat.time));
var sat_x = positionAndVelocity.position[0];
var sat_y = positionAndVelocity.position[1];
var sat_z = positionAndVelocity.position[2];
I think that skyfield returns positions in GCRF, not TEME.
So try outputting with orekit in the former (you can specify it in getpvcoordinates) and compare again.
Sorry my bad here, I’ve written Skyfield but it was python implementation of sgp4 by the same dev (Brandon Rhodes) hence the mistake - in Python I used:
sorry for the delay, but have you tried checking the difference without parsing the date explicitly so by calling sgp4_tsince(0.) on the one hand and getPVCoordinates() on the other hand?