Python中的SGP4轨道预报库

1、示例代码

啥也不说,上代码:

python 复制代码
from sgp4.api import Satrec, jday
from datetime import datetime, timedelta

tle_line1 = "1 25544U 98067A   25341.89741187  .00012051  00000-0  22339-3 0  9991"
tle_line2 = "2 25544  51.6302 166.4547 0003425 217.7386 142.3363 15.49404055542101"
satellite = Satrec.twoline2rv(tle_line1, tle_line2)
start_time = datetime(2026, 1, 1, 0, 0, 0)
current_time = start_time

for i in range(10):
    ct = current_time
    jd, fr = jday(ct.year, ct.month, ct.day, ct.hour, ct.minute, ct.second)
    error_code, position, velocity = satellite.sgp4(jd, fr)
    print('time:{}  position:{}   \t  velocity:{}'.format(ct, position, velocity))
    current_time += timedelta(minutes=1)

2、示例代码运行输出

python 复制代码
"""
time:2026-01-01 00:00:00  position:(3557.505395677643, -2340.06227431844, -5298.492077837364)             velocity:(4.823148764333874, 5.908439644923949, 0.6309358604623102)
time:2026-01-01 00:01:00  position:(3838.573464005631, -1980.4981617480425, -5248.565995442477)           velocity:(4.542257798330435, 6.072527161590608, 1.0326449724035105)
time:2026-01-01 00:02:00  position:(4102.159747012399, -1611.9144283119851, -5174.6681489860375)          velocity:(4.2406387321105905, 6.208980228158124, 1.4296945045524865)
time:2026-01-01 00:03:00  position:(4347.060798346567, -1235.9885147900966, -5077.132252476716)           velocity:(3.919647778086715, 6.317173372296311, 1.820283655057285)
time:2026-01-01 00:04:00  position:(4572.15720118123, -854.4316503055824, -4956.399297408656)             velocity:(3.5807287979421307, 6.396606237937008, 2.2026385643292348)
time:2026-01-01 00:05:00  position:(4776.41865336864, -468.9812678004915, -4813.015707254993)             velocity:(3.2254074557428676, 6.446906101376844, 2.5750199466295802)
time:2026-01-01 00:06:00  position:(4958.908690881453, -81.39328180782391, -4647.631035427532)            velocity:(2.85528500572703, 6.467829940814719, 2.9357306736178326)
time:2026-01-01 00:07:00  position:(5118.789027633144, 306.5657439950259, -4460.995210155783)             velocity:(2.472031715242578, 6.459266036234478, 3.2831232891991395)
time:2026-01-01 00:08:00  position:(5255.323489857555, 693.1265104870682, -4253.955331120812)             velocity:(2.077379925686228, 6.421235074011268, 3.6156074305928354)
time:2026-01-01 00:09:00  position:(5367.881523520457, 1076.5249475860442, -4027.4520242833205)           velocity:(1.6731167576197556, 6.353890728898872, 3.9316571259616397)
"""

3、补充说明

​(1)输出为TEME坐标系。

(2)TEME坐标系:真地球平赤道坐标系‌(True Earth Mean Equator Coordinate System)。它是一种以地球质心为原点、坐标轴指向特定时刻空间固定方向的惯性坐标系,常用于描述卫星在不受地球自转等局部因素干扰下的运动状态。

(3) sgp4安装:pip install sgp4

(4)python sgp4库介绍: https://pypi.org/project/sgp4/

相关推荐
用户83562907805114 小时前
Python 实现 PDF 文件加密与解密方法
后端·python
用户83562907805114 小时前
使用 Python 冻结与拆分 Excel 窗格教程
后端·python
你好潘先生1 天前
别再记命令了,用 yeero do 说句人话就能跑脚本,而且不烧 token
服务器·python·命令行
Agent_大师1 天前
WebSocket 行情重连成功,K线缺口不会自动消失
python
荣码1 天前
LLM结构化输出:让AI返回JSON而不是废话,我踩了4个坑
java·python
copyer_xyf1 天前
FastAPI 如何连接 MySQL
后端·python
apocelipes1 天前
常用编程语言和库的正则表达式性能对比
c语言·c++·python·性能优化·golang·开发工具和环境
用户8356290780512 天前
使用 Python 在 PDF 中创建与管理书签
后端·python
MeixianAgent2 天前
Python 回测数据入口怎么验?历史 K 线入库前先做 5 个检查
后端·python
咕白m6252 天前
用 Python 实现一键批量查找与替换 Excel 数据
后端·python