From 3c5b8691319000b09a5a51e3d2126c82ed314c4d Mon Sep 17 00:00:00 2001 From: Brandon Rhodes Date: Thu, 16 Jul 2020 16:31:02 -0400 Subject: [PATCH] Fix order of operations in ITRF_to_GCRS2() Because two components of the position vector are used to finish building the velocity vector, it was a mistake to rotate the position vector using the M matrix until after the velocity vector has also been built. This increases by almost two magnitudes the agreement between Earth satellite reported velocities and the actual difference between their successive positions. --- skyfield/positionlib.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/skyfield/positionlib.py b/skyfield/positionlib.py index ed112da..fbf3023 100644 --- a/skyfield/positionlib.py +++ b/skyfield/positionlib.py @@ -748,17 +748,18 @@ def ITRF_to_GCRS(t, rITRF): return mxv(t.MT, position) def ITRF_to_GCRS2(t, rITRF, vITRF): + # TODO: wobble - # Todo: wobble - - spin = rot_z(t.gast * tau / 24.0) - + spin = rot_z(t.gast / 24.0 * tau) position = mxv(spin, array(rITRF)) - position = mxv(t.MT, position) - velocity = mxv(spin, array(vITRF)) - velocity = mxv(t.MT, velocity) + + # TODO: Would it increase accuracy to use the actual rate of spin + # for this date, instead of the average ANGVEL? velocity[0] += DAY_S * ANGVEL * - position[1] velocity[1] += DAY_S * ANGVEL * position[0] + position = mxv(t.MT, position) + velocity = mxv(t.MT, velocity) + return position, velocity