如何使用PyEphem计算给定银河坐标(GLON,GLAT)的(alt,az)? [英] How to compute (alt, az) for given Galactic coordinate (GLON, GLAT) with PyEphem?
问题描述
对于给定的地球上的观测者(lon,lat,time)和给定的银河系坐标(GLON,GLAT),我该如何使用PyEphem计算天空中对应的(alt,az)点?
For a given observer (lon, lat, time) on Earth and a given Galactic coordinate (GLON, GLAT), how can I compute the corresponding (alt, az) point in the sky with PyEphem?
推荐答案
鉴于PyEphem当前的工作方式,回答问题有两个步骤.首先,您必须将一对银河坐标转换为赤道RA/dec坐标对.
Given the way that PyEphem currently works, there are two steps to answering your question. First, you have to convert a pair of galactic coordinates into an equatorial RA/dec pair of coordinates instead.
import ephem
# Convert a Galactic coordinate to RA and dec
galactic_center = ephem.Galactic(0, 0)
eq = ephem.Equatorial(galactic_center)
print 'RA:', eq.ra, 'dec:', eq.dec
→ RA: 17:45:37.20 dec: -28:56:10.2
这些坐标与Wikipedia给出的银河系中心的坐标非常接近.
Those coordinates are pretty close to the ones that the Wikipedia gives for the galactic center.
现在我们有了一个正常的RA/dec坐标,我们只需要弄清楚它现在在天空中的位置.由于PyEphem是建立在仅了解恒星和行星等天体物体"的图书馆之上的,因此我们只需要在该位置创建一个假恒星"并询问其方位角和高度即可.
Now that we have a normal RA/dec coordinate, we just need to figure out where it is in the sky right now. Since PyEphem is built atop a library that knows only about celestial "bodies" like stars and planets, we simply need to create a fake "star" at that location and ask its azimuth and altitude.
# So where is that RA and dec above Boston?
# Pretend that a star or other fixed body is there.
body = ephem.FixedBody()
body._ra = eq.ra
body._dec = eq.dec
body._epoch = eq.epoch
obs = ephem.city('Boston')
obs.date = '2012/6/24 02:00' # 10pm EDT
body.compute(obs)
print 'Az:', body.az, 'Alt:', body.alt
→ Az: 149:07:25.6 Alt: 11:48:43.0
我们可以通过查看当晚傍晚波士顿的天空图表来确定该答案是否合理:射手座-银河中心的位置-刚升起在天空的东南边缘,这完全感觉到了东南方位角为149°,而目前仍为低海拔,如11°.
And we can check that this answer is reasonable by looking at a sky chart for Boston late that evening: Sagittarius — the location of the Galactic Center — is just rising over the southeastern rim of the sky, which makes perfect sense of a southeast azimuth like 149°, and for an as-yet low altitude like 11°.
这篇关于如何使用PyEphem计算给定银河坐标(GLON,GLAT)的(alt,az)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!