我试图使用AstroPy将卫星的坐标从ECI转换到给定时间的纬度、经度和高度。但是,我无法获得使用AstroPy obstime的时间部分。我不确定这是UTC时间的语法错误还是其他原因。
'New Method #1: ECI --> Lat, Lon, Alt'
from astropy import coordinates as coord
from astropy import units as u
from astropy import time
from astropy.time import Time
xyz = (orbitPineapple.r.x, orbitPineapple.r.y, orbitPineapple.r.z) #position of satellite in GCRS or J2000 ECI
now = time.Time('2017-09-28 16:53:40') #Time in UTC for xyz
cartrep = coord.CartesianRepresentation(*xyz, unit=u.m) #adding units of [m] to xyz
gcrs = coord.GCRS(cartrep, obstime=now)
itrs = gcrs.transform_to(coord.ITRS, obstime=now)
loc = coord.EarthLocation(*itrs.cartesian.xyz)
print(orbitPineapple.r)
print('')
print(loc.lat, loc.lon, loc.height)输入:(位置(x=-2686197.0596728502,y=-6402017.6107924329,z=10956.564679617248))
发布于 2017-10-02 00:13:12
该解决方案类似于您先前问题How to convert Earth Centered Inertial (ECI) coordinates to Earth Centered Earth Fixed (ECEF) AstroPy? Other?的答案。
需要将obstime传递给ITRS()类:
itrs = gcrs.transform_to(coord.ITRS(obstime=now))所以,完整地(我从您的问题中复制了xyz坐标,因为我没有看到orbitPineapple的定义)
from astropy import coordinates as coord
from astropy import units as u
from astropy import time
from astropy.time import Time
xyz = [-2686197.0596728502, -6402017.6107924329, 10956.564679617248]
now = time.Time('2017-09-28 16:53:40') #Time in UTC for xyz
cartrep = coord.CartesianRepresentation(*xyz, unit=u.m) #adding units of [m] to xyz
gcrs = coord.GCRS(cartrep, obstime=now)
itrs = gcrs.transform_to(coord.ITRS(obstime=now))
loc = coord.EarthLocation(*itrs.cartesian.xyz)
print('')
print(loc.lat, loc.lon, loc.height)https://stackoverflow.com/questions/46494755
复制相似问题