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.
This commit is contained in:
Brandon Rhodes 2020-07-16 16:31:02 -04:00
parent d5736b1832
commit 3c5b869131
1 changed files with 8 additions and 7 deletions

View File

@ -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