Python astropy:将速度从ECEF坐标系转换为J2000坐标系

3
我已经编写了一段代码,使用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)

如何对速度进行转换?
1个回答

6
我认为您可以尝试以下操作:

认为您可以尝试以下操作:

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)

但是,我不完全确定它是否符合您的要求。或者,在astropy v. 3.0.1中,ITRS类似乎能够接受速度值,因此您可以使用它。

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)

两个版本得出的答案相同,但第二个版本更加简洁。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接