coordinate-transformation - Python astropy : convert velocities from ECEF to J2000 coordinate system

标签 coordinate-transformation astropy

我编写了一个代码,使用 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)

如何对速度进行转换?

最佳答案

认为您可以执行以下操作:

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)

两个版本给出了相同的答案,但第二个版本更简洁一些。

关于coordinate-transformation - Python astropy : convert velocities from ECEF to J2000 coordinate system,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49214220/

相关文章:

python - 如何读取 IRAF 多规范光谱?

python - 随时间传播卫星目录的有效方法

python - PyEphem 能否用于计算任何对象的设置和上升时间?

opencv - 使用opencv计算外部矩阵

python - 使用 src/target 坐标使用 Python PIL 进行透视变换

c# - 将一个矩形的坐标转换为另一个矩形

coordinate-transformation - 打印出屏幕任意位置的字母

svg - 如何在 SVG 中设置变换原点

python - 在 python 中打开适合没有 SIMPLE 关键字的文件

python - 使用导数确定二维数组中局部最大值的坐标