儒略日相关换算 Python实现
作者:互联网
数学公式
函数
import time
def YMD_to_MJD(gmt_time):
moudle0 = int((gmt_time.tm_mon-14)/12)
module1 = int((1461/4)*(gmt_time.tm_year + 4800 + moudle0))
moudle2 = int((367/12)*(gmt_time.tm_mon - 2 - 12*moudle0))
moudle3 = int((3/4)*int((gmt_time.tm_year + 4900 + moudle0) / 100 ))
all = 24 * 60 * 60 #一个太阳日包含的秒数
now = gmt_time.tm_hour * 60 * 60 + gmt_time.tm_min * 60 + gmt_time.tm_sec
JD = gmt_time.tm_mday - 32075 + module1 + moudle2 - moudle3 - 0.5
MJD = JD - 2400000.5
return MJD + now / all
print(YMD_to_MJD(time.gmtime()))
模块
使用julian
模块
# 年月日转儒略日
from datetime import datetime
import julian
JD = julian.to_jd(datetime.utcnow(),fmt="mjd")
print(JD)
参考内容
- 王大轶著. 航天器多源信息融合自主导航技术[M]. 北京:北京理工大学出版社, 2018.03
- https://pypi.org/project/julian/
标签:Python,julian,60,儒略,int,tm,time,换算,gmt 来源: https://www.cnblogs.com/WWIandMC/p/16459247.html