如何计算昼夜平分点/至日时刻?

时间:2009-04-01 04:49:37

标签: equinox astronomy

有哪些算法或公式可用于计算昼夜平分点和至日?几年前我找到了其中一个并实现了它,但精度并不高:一天的时间似乎假设在00:00,06:00,12:00和18:00 UTC,具体取决于哪个昼夜平分点或至日计算。维基百科给出了这些计算出的分钟,因此必须有更精确的东西。我最喜欢的编程语言的库也出现在那些硬编码时代,因此我假设它们使用的算法与我实现的算法相同或类似。

我曾经尝试过使用一个图书馆,它给了我太阳经度,并实现了一个搜索程序,将0,90,180和270度的精确时刻归零;这可以归结为第二个,但不同意维基百科的时代,所以我认为这种方法有问题。然而,我惊喜地发现迈蒙尼德(中世纪犹太学者)在千禧年之前使用完全相同的想法提出了一种算法。

4 个答案:

答案 0 :(得分:1)

我不确定这是否是一个足够准确的解决方案,但我发现NASA website有一些代码片段用于计算春分以及其他一些天文类型信息。我还发现了一本名为Astronomical Algorithms的书的引用,如果信息在某种程度上无法在线获取,那么你可能会得到所需的答案。

答案 1 :(得分:0)

我知道你正在寻找一些可以粘贴到答案中的东西,但是我必须提到SPICE,这是由NAIF在JPL制作的工具包,由NASA资助。对于Farmer的Almanac来说,它可能有些过分,但你提到了对精度的兴趣,这个工具包经常用于行星科学。

答案 2 :(得分:0)

使用PyMeeus和下面的代码,您可以获得例如答案

winter solstice for 2018 in Terrestrial Time is at:
 (2018, 12, 21, 22, 23, 52.493725419044495)
winter solstice for 2018 in UTC, if last leap second was (2016, 12):
 (2018, 12, 21, 22, 22, 43.30972542127711)
winter solstice for 2018 in local time, if last leap second was (2016, 12)
 and local time offset is -7.00 hours:
 (2018, 12, 21, 15, 22, 43.30973883232218)
i.e. 2018-12-21T15:22:43.309725-07:00

当然,答案并不是精确到微秒,但我还想展示如何使用arrow进行高精度转换。

代码:

from pymeeus.Sun import Sun
from pymeeus.Epoch import Epoch

year = 2018
target="winter"

# Get terrestrial time of given solstice for given year
solstice_epoch = Sun.get_equinox_solstice(year, target=target)

print("%s solstice for %d in Terrestrial Time is at:\n %s" %
      (target, year, solstice_epoch.get_full_date()))

print("%s solstice for %d in UTC, if last leap second was %s:\n %s" %
 (target, year, Epoch.get_last_leap_second()[:2], solstice_epoch.get_full_date(utc=True)))

solstice_local = (solstice_epoch + Epoch.utc2local()/(24*60*60))
print("%s solstice for %d in local time, if last leap second was %s\n"
 " and local time offset is %.2f hours:\n %s" %
 (target, year, Epoch.get_last_leap_second()[:2],
  Epoch.utc2local() / 3600., solstice_local.get_full_date(utc=True)))

使用非常酷的ISO和TZ感知模块Arrow: better dates and times for Python,可以更好地打印:

import arrow
import math

slutc = solstice_epoch.get_full_date(utc=True)
frac, whole = math.modf(slutc[5])

print("i.e. %s" % arrow.get(*slutc[:5], int(whole), round(frac * 1e6)).to('local'))

答案 3 :(得分:-1)

如果你有兴趣的话,我已经实现了Jean Meeus(上面提到的天文算法的作者)c和Java中的equinox和solstice算法。