使用 PyEphem 将地心坐标(方位角、高程)转换为赤道坐标(RA、Dec)

发布于 2024-12-28 11:38:44 字数 539 浏览 5 评论 0原文

这看起来是一项非常基本的任务,但我无法解决。

PyEphem 文档:

http://rhodesmill.org/pyephem/radec.html

描述了如何执行反过来,从 BodyObserver 对象到视在地心位置,其中高度和方位角位于 .alt 中, .az 属性。

然而,我应该如何从仰角和方位角开始并获得 RA 和 Dec?

例如,这是一组坐标,我想在赤道参考系中获取赤道和赤道:

az = 3.30084818 #rad
el = 0.94610742 #rad
lat = 34.64 #deg
lon = -103.7 #deg
alt = 35800.26 #m
ut = 2455822.20000367 #julian date

谢谢!

This looks quite a basic task, but I cannot sort it out.

The PyEphem documentation:

http://rhodesmill.org/pyephem/radec.html

describes how to perform the conversion the other way around, from a Body and an Observer objects to Apparent Topocentric Position, with elevation and azimuth in the .alt and .az attributes.

However how should I, instead, start from Elevation and Azimuth and get RA and Dec?

For example here is one set of coordinates for which I'd like to get RA and Dec in Equatorial reference frame:

az = 3.30084818 #rad
el = 0.94610742 #rad
lat = 34.64 #deg
lon = -103.7 #deg
alt = 35800.26 #m
ut = 2455822.20000367 #julian date

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绝影如岚 2025-01-04 11:38:44

这里有两个微妙之处。首先,您碰巧使用“仰角”和“高度”来表示与 PyEphem 库中这两个术语的含义相反的含义 - 因此您将天空中的点称为“仰角/方位角”位置,而不是“高度”其次,PyEphem 似乎忘记提供一种简单的方法将日期从 Julian 转换为它自己的格式。 julian_date() 会走向另一个方向,我们必须自己做一些工作才能走向另一个方向,通过弄清楚 ephem 的名字是什么。

考虑到这些规定,我认为这个脚本可能会回答您的问题:

import ephem

az = 3.30084818 #rad
el = 0.94610742 #rad
lat = 34.64 #deg
lon = -103.7 #deg
alt = 35800.26 #m
ut = 2455822.20000367 #julian date

# Which Julian Date does Ephem start its own count at?
J0 = ephem.julian_date(0)

observer = ephem.Observer()
observer.lon = str(lon)  # str() forces deg -> rad conversion
observer.lat = str(lat)  # deg -> rad
observer.elevation = alt
observer.date = ut - J0

print observer.date
print observer.radec_of(az, el)

对于这个特定的观察,它产生的答案看起来正确吗?这是脚本为我打印的内容:

2011/9/17 16:48:00
(9:16:24.95, -0:45:56.8)

让我知道这对于这个特定的观察是否具有物理意义,或者如果其中一个数字错误并且仍然需要调整了!

There are two subtleties here. First, you have happened to use “elevation” and “altitude” to mean the opposite of what the two terms mean in the PyEphem library — so you are calling the spot in the sky its “elevation / azimuth" position instead of its “altitude / azimuth” position. Second, it appears that PyEphem has forgotten to provide an easy way to convert dates from Julian to its own format. While there is a function julian_date() that will go the other direction, we will have to do a bit of work ourselves to go the other direction by figuring out what ephem's name is for.

With those stipulations in mind, I think this script might answer your question:

import ephem

az = 3.30084818 #rad
el = 0.94610742 #rad
lat = 34.64 #deg
lon = -103.7 #deg
alt = 35800.26 #m
ut = 2455822.20000367 #julian date

# Which Julian Date does Ephem start its own count at?
J0 = ephem.julian_date(0)

observer = ephem.Observer()
observer.lon = str(lon)  # str() forces deg -> rad conversion
observer.lat = str(lat)  # deg -> rad
observer.elevation = alt
observer.date = ut - J0

print observer.date
print observer.radec_of(az, el)

Does the answer it produces look correct for this particular observation? Here is what the script prints for me:

2011/9/17 16:48:00
(9:16:24.95, -0:45:56.8)

Let me know if that makes physical sense for this particular observation, or if one of the numbers is wrong here and still needs to be tweaked!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文