0

我需要把这个公式翻译成 Python:

δs = arcsin {0.42565 sin Ls)} + 0.25° sin Ls

请记住 Ls 值为 122.985º(以度为单位)

我正在使用的代码是:

Ls = 122.985
Ds = math.asin(math.radians(0.42565 * math.sin(math.radians(Ls)))) + 0.25 * math.sin(math.radians(Ls))

Ds 的结果约为 0.2159º... 而它应该约为 21,128º。

我究竟做错了什么?

4

1 回答 1

1

请注意,该公式在第二项上有学位标记。意思是“取0.42565乘以正弦(Ls)的反正弦。这是一个角度,可以用度数表示。在它上面加上0.25度乘以正弦(Ls)”。

angle1 = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls))))
correction = 0.25 * math.sin(math.radians(Ls)) # this is a value in degrees
Ds = angle1 + correction

或者合并成一个公式,为了清楚起见,我在上面把它分解了

Ds = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls)))) + 0.25 * math.sin(math.radians(Ls))

工作你的例子:

>>> Ls = 122.985
>>> angle1 = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls))))
>>> angle1
20.918572663722518
>>> correction = 0.25 * math.sin(math.radians(Ls))
>>> correction
0.20970328134223665
>>> angle1 + correction
21.128275945064754

不要过分强调我将第二个术语标记为更正,我从http://www.oregonl5.org/mist/docs/Mars24J/help/notes.html的讨论中得到了这一点,特别是:

为了准确计算相对于局部平坦表面的太阳照度,太阳赤纬可以通过适用于扁球上所谓的行星纬度测量的微小差异进行校正,就像在 Mars24 sunclock 中一样.

但我可能会误解那是什么意思。我确定的主要事情是这些值经过测试并且单位可以合理地进行。

于 2018-01-31T18:00:51.233 回答