【问题标题】:PyEphem reporting different latitude and longitude than input valuesPyEphem 报告与输入值不同的纬度和经度
【发布时间】:2015-09-14 05:32:57
【问题描述】:

我已经使用 Pyephem 来计算太阳的纬度和经度,给定日期、海平面上观察者的纬度和经度。 我得到我不明白的结果。我运行的代码如下(在 Windows 7 中的 Ipython 笔记本上):

import ephem
date = '2015-04-17 12:30:00'

Amundsen = ephem.Observer()
Amundsen.lat = '46.8'
Amundsen.lon = '-71.2'
Amundsen.date = date

sun = ephem.Sun(Amundsen)
sun.compute(Amundsen)

print Amundsen
print "sun latitude: {0}, sun longitude: {1}".format(sun.hlat,sun.hlon)

我得到的结果如下:

<ephem.Observer date='2015/4/17 12:30:00' epoch='2000/1/1 12:00:00'lon='-71:12:00.0' lat='46:48:00.0' elevation=0.0m horizon=0:00:00.0 temp=15.0C pressure=1010.0mBar>
sun latitude: -0:00:00.1, sun longitude: 207:11:10.2

如您所见,在打印输入数据时,我的obesrver的经纬度已经从46.8和-71.2变为46.48到-71.12。这可能是一个基本事实,但为什么会发生这种情况?以及如何纠正?

提前致谢,

格雷戈里

【问题讨论】:

    标签: latitude-longitude sun pyephem


    【解决方案1】:

    令人高兴的是,价值观没有改变。您已将它们作为小数输入,小数点 . 将每个度数分成十分之一,但这不是传统上表示经度和纬度的方式 - 它们通常写成整数,然后是六十分,称为“分钟”,然后是六十分-of-sixtieths 称为“秒”,PyEphem 用 : 字符分隔。

    所以46:48 的意思是“46 度 48 分纬度”,因为 48/60 = 0.8。

    libsastro 使用 : 是对 ASCII 限制的妥协。传统上,度分和秒会用度数符号、素数和双素数来分隔,现在这在 Unicode 中是可行的,但在编程语言中并不普遍:

    46°48′00″

    我注意到,在 Bernard R. Goldstein 的学术论文中,关于中世纪晚期和文艺复兴时期的天文学,使用了使用分号作为小数点并在分钟和秒之间使用逗号的学术符号,即看起来像:

    46;48,00°

    【讨论】:

    • 你好,布兰登,好的,谢谢你的帮助。那时一切都很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-11
    • 1970-01-01
    • 1970-01-01
    • 2021-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多