首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >来自pyephem的太阳经度?

来自pyephem的太阳经度?
EN

Stack Overflow用户
提问于 2014-08-28 08:21:29
回答 1查看 551关注 0票数 2

我正在试图确定火星上季节的开始和结束时间。该点位于0度、90度、180度和270度Ls (日光经度)。

PyEphem提供日心经度和纬度。如何将其与此处显示的太阳经度相关联:

http://www.planetary.org/explore/space-topics/mars/mars-calendar.html

EN

回答 1

Stack Overflow用户

发布于 2015-01-23 02:27:49

我认为这两个量是相同的角度,但从不同的起点测量。使用这个假设,你可以使用PyEphem来预测火星季节在两到三天内-但我真的会期待更好,并且不确定为什么协议不是更接近!

但这至少会让你开始。如果您发现这些预测与您链接的站点的预测略有不同,请让我们知道!在某种程度上,我们应该将它们与美国国家航空航天局地平线项目和我正在建造的改进的PyEphem的天地项目的输出进行比较。

在任何情况下,都可以使用一些代码来计算L并使用它来查找火星季节:

代码语言:javascript
复制
# The angle that we call "the longitude of the Sun, as
# seen from Mars" should grow at the same rate as the
# "longitude of Mars as seen from the Sun" (since the
# two are the same line but viewed in opposite
# directions).
#
# The only problem is knowing what point to name "zero",
# so we have to learn what .hlon was when the first
# Martian year started:

from ephem import Mars, Date, degrees, newton
m = Mars()
m.compute('1955/4/11 23:00')
Ls0 = m.hlon

def Ls(date):
    m.compute(date)
    return degrees(m.hlon - Ls0).norm

# There!  Ls() should give Martian solar latitude.
# So the first round of seasons listed at the page
# http://www.planetary.org/explore/space-topics/mars/mars-calendar.html
# should give 90 degrees, 180 degrees, and 270 degrees:

for date in '1955/10/27', '1956/4/27', '1956/9/21':
    print Ls(date)

# The output is close to what we would expect:
#
# 90:11:58.3
# 179:57:32.2
# 270:13:22.6
#
# Great!  So what if we want to know, say, the date
# of the upcoming Spring Equinox or Summer Solstice?
# We need functions that are smooth, well-behaved,
# and cross zero at those two times, so that we can
# unleash Newton's Method upon them:

def spring_equinox(date):
    return Ls(date).znorm

def summer_solstice(date):
    return Ls(date) - degrees('90:00:00')

def find_spring_equinox(start_date):
    start_date = Date(start_date)
    y0 = Ls(start_date)
    y1 = Ls(start_date + 1)
    rate = y1 - y0
    angle_to_go = degrees(0.0 - y0).norm
    closer_date = start_date + angle_to_go / rate
    d = newton(spring_equinox, closer_date, closer_date + 1)
    return Date(d)

def find_summer_solstice(start_date):
    start_date = Date(start_date)
    y0 = Ls(start_date)
    y1 = Ls(start_date + 1)
    rate = y1 - y0
    angle_to_go = degrees(degrees('90:00:00') - y0).norm
    closer_date = start_date + angle_to_go / rate
    d = newton(summer_solstice, closer_date, closer_date + 1)
    return Date(d)

d = find_spring_equinox('2015/1/22')
print d, Ls(d)

d = find_summer_solstice('2015/1/22')
print d, Ls(d)

# Output:
# 2015/6/16 15:03:15 0:00:00.0
# 2015/12/31 21:12:07 90:00:00.0
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25538926

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档