计算从地面看去的卫星的天顶角和仰角

时间:2018-08-02 14:56:54

标签: python astropy pyephem satellite pyproj

我有卫星和地面观测者的纬度,经度和高度。我正在尝试计算从地面看卫星的卫星天顶角和卫星方位角。

我目前正在尝试使用astropy解决此问题。 describes文档介绍了如何计算太阳的天顶角和方位角。

我试图将卫星垂直放置在观察者上方,以使天顶角应为0°(或仰角为90°)。

In [41]: ground = astropy.coordinates.EarthLocation(lat=3*u.deg, lon=5*u.deg)

In [42]: sat = astropy.coordinates.EarthLocation.from_geodetic(3*u.deg, 5*u.deg, 700*u.km)

但是,显然.transform_to(AltAz(...))并不代表我的意思,因为答案不是我想要的:

In [43]: print(sat.get_itrs().transform_to(AltAz(location=ground)))
<AltAz Coordinate (obstime=None, location=(6345216.684243768, 555134.5274868822, 331574.3153428908) m, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0, obswl=1.0 micron): (az, alt, distance) in (deg, deg, m)
    (314.96287134, 63.2970069, 773970.24385554)>

我希望仰角接近90°,而不是63°。

pyorbital中也有一些例程,但是似乎没有包含我要查找的例程。

我相信使用pyephem也应该可行,只是这似乎希望我从目录中获得卫星信息。我已经有了纬度,经度和纬度。

我也看过pyproj,但我认为这仅适用于大地水准面上的物体。

如何计算从地面观察到的卫星的高度和方位角?

2 个答案:

答案 0 :(得分:1)

稍微整理一下输入内容:

from astropy import units as u
from astropy.coordinates import AltAz, EarthLocation

ground = EarthLocation.from_geodetic(lat=3*u.deg, lon=5*u.deg, height=0*u.km)
sat    = EarthLocation.from_geodetic(lat=3*u.deg, lon=5*u.deg, height=700*u.km)

result = sat.get_itrs().transform_to(AltAz(location=ground))
print(result)

哪个会产生预期的90度:

<AltAz Coordinate (obstime=None, location=(6345.21668424, 555.13452749, 331.57431534) km, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0.0, obswl=1.0 micron): (az, alt, distance) in (deg, deg, km)
    (89.99999672, 89.99991123, 700.)>

答案 1 :(得分:0)

您可以从pyorbital获得此信息。相关功能为get_observer_look。由于某种原因,它需要时间,并且显然需要所有输入都是ndarray对象。当方位角定义不正确时(例如,天顶角为零时),它会发出警告。但这确实有效:

In [50]: import pyorbital.orbital

In [51]: print(pyorbital.orbital.get_observer_look(atleast_1d(1), atleast_1d(1), atleast_1d(700), datetime.datetime.now(), atleast_1d(1), atleast_1d(1), atleast_1d(1)))
(array([261.11934085]), array([89.99999915]))

In [53]: print(pyorbital.orbital.get_observer_look(atleast_1d(10), atleast_1d(0), atleast_1d(700), datetime.datetime.now(), atleast_1d(0), atleast_1d(0), atleast_1d(0.1)))
/home/zmaw/u237009/.conda/envs/FCDR37a/lib/python3.7/site-packages/pyorbital/orbital.py:112: RuntimeWarning: divide by zero encountered in true_divide
  az_ = np.arctan(-top_e / top_s)
(array([270.]), array([25.73173269]))

In [54]: print(pyorbital.orbital.get_observer_look(atleast_1d(10), atleast_1d(0), atleast_1d(700), datetime.datetime.now(), atleast_1d(0.1), atleast_1d(0.1), atleast_1d(0.1)))
(array([90.56944651]), array([26.03504444]))