如何计算春分/夏至时刻?
有哪些算法或公式可用于计算春分和至日? 几年前我发现了其中一个并实现了它,但精度不是很好:一天中的时间似乎假定为 00:00、06:00、12:00 和 18:00 UTC,具体取决于哪个春分点或计算至日。 维基百科给出了这些计算结果,所以更精确的东西一定是可能的。 我最喜欢的编程语言的库也出现在那些硬编码时代,所以我假设它们使用与我实现的算法相同或相似的算法。
我也曾经尝试使用一个为我提供太阳经度的库,并在 0、90、180 和 270 度的精确时刻执行搜索程序以将其归零; 这有效到了第二个,但与维基百科中的时代不一致,所以我认为这种方法有问题。 然而,我惊喜地发现迈蒙尼德(中世纪犹太学者)在千年前提出了一种使用完全相同想法的算法。
What algorithms or formulas are available for computing the equinoxes and solstices? I found one of these a few years ago and implemented it, but the precision was not great: the time of day seemed to be assumed at 00:00, 06:00, 12:00, and 18:00 UTC depending on which equinox or solstice was computed. Wikipedia gives these computed out to the minute, so something more exact must be possible. Libraries for my favorite programming language also come out to those hardcoded times, so I assume they are using the same or a similar algorithm as the one I implemented.
I also once tried using a library that gave me the solar longitude and implementing a search routine to zero in on the exact moments of 0, 90, 180, and 270 degrees; this worked down to the second but did not agree with the times in Wikipedia, so I assume there was something wrong with this approach. I am, however, pleasantly surprised to discover that Maimonides (medieval Jewish scholar) proposed an algorithm using the exact same idea a millenium ago.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
(复杂!)底层公式和算法的一个重要来源是天文算法让·梅厄斯着。
使用这些算法的 PyMeeus 实现以及下面的代码,您可以得到以下是 2018 年冬至的值(其中“冬天”指的是北半球)。
当然,答案并不精确到微秒,但我也想展示如何使用
arrow
进行高精度转换。代码:
使用非常酷的ISO和TZ感知模块箭头:更好的日期以及 Python 的时间,可以打印得更好:
A great source for the (complex!) underlying formulas and algorithms is Astronomical Algorithms by Jean Meeus.
Using the PyMeeus implementation of those algorithms, and the code below, you can get the following values for the 2018 winter solstice (where "winter" refers to the northern hemisphere).
Of course, the answer is not accurate down to microseconds, but I also wanted to show how to do high-precision conversions with
arrow
.Code:
Using the very cool more ISO and TZ aware module Arrow: better dates and times for Python, that can be printed more nicely:
我不确定这对您来说是否是一个足够准确的解决方案,但我找到了一个 NASA 网站< /a> 其中有一些用于计算春分的代码片段以及一些其他天文类型的信息。 我还发现了一些对一本名为 天文算法 的书的引用,其中可能有如果无法在线获取信息,您需要的答案。
I'm not sure if this is an accurate enough solution for you, but I found a NASA website that has some code snippets for calculating the vernal equinox as well as some other astronomical-type information. I've also found some references to a book called Astronomical Algorithms which may have the answers you need if the info somehow isn't available online.
我知道您正在寻找可以粘贴到此处答案的内容,但我必须提及 SPICE ,由 NAIF 在 JPL 制作、由 NASA 资助的工具包。 对于农夫年鉴的东西来说,这可能有点过分了,但你提到了对精度的兴趣,而且这个工具包通常用于行星科学。
I know you're looking for something that'll paste into an answer here, but I have to mention SPICE, a toolkit produced by NAIF at JPL, funded by NASA. It might be overkill for Farmer's Almanac stuff, but you mentioned interest in precision and this toolkit is routinely used in planetary science.
如果您有兴趣,我已经用 C 和 Java 实现了 Jean Meeus(上面提到的天文算法的作者)的春分和至日算法。
I have implemented Jean Meeus' (the author of the Astronomical Algorithms referenced above) equinox and solstice algorithm in C and Java, if you're interested.