问题
I've written a code to transform the coordinates from Earth fixed system to inertial frame using astropy:
from astropy import coordinates as coord
from astropy import units as u
from astropy.time import Time
from astropy import time
now = Time('2018-03-14 23:48:00')
# position of satellite in GCRS or J20000 ECI:
xyz=[-6340.40130292,3070.61774516,684.52263588]
cartrep = coord.CartesianRepresentation(*xyz, unit=u.km)
gcrs = coord.ITRS(cartrep, obstime=now)
itrs = gcrs.transform_to(coord.GCRS(obstime=now))
loc= coord.EarthLocation(*itrs.cartesian.xyz)
print(loc)
How to make transformation also for velocities?
回答1:
I think you can do something like the following:
from astropy import coordinates as coord
from astropy import units as u
from astropy.time import Time
now = Time('2018-03-14 23:48:00')
xyz = [-6340.40130292, 3070.61774516, 684.52263588]
vxvyvz = [-10.90, 56.4, -74.6]
# put velocities into cartesian differential
cartdiff = coord.CartesianDifferential(*vxvyvz, unit='km/s')
cartrep = coord.CartesianRepresentation(*xyz, unit=u.km, differentials=cartdiff)
gcrs = coord.ITRS(cartrep, obstime=now)
itrs = gcrs.transform_to(coord.GCRS(obstime=now))
# print position
print(itrs.cartesian.xyz)
# print velocity
print(itrs.cartesian.differentials)
But, I'm not entirely sure it does what you require or not. Alternatively, in astropy v. 3.0.1 the ITRS class seems to be able to take velocity values, so you could use
now = Time('2018-03-14 23:48:00')
pos = [-6340.40130292, 3070.61774516, 684.52263588]*u.km
vel = [-10.90, 56.4, -74.6]*u.km/u.s
gcrs = coord.ITRS(x=pos[0], y=pos[1], z=pos[2], v_x=vel[0], v_y=vel[1], v_z=vel[2], representation_type='cartesian', differential_type='cartesian', obstime=now)
itrs = gcrs.transform_to(coord.GCRS(obstime=now))
# print position
print(itrs.cartesian.xyz)
# print velocity
print(itrs.cartesian.differentials)
Both versions give the same answer, but the second one is a bit neater.
来源:https://stackoverflow.com/questions/49214220/python-astropy-convert-velocities-from-ecef-to-j2000-coordinate-system