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/

相关推荐
IT知识分享1 小时前
从零开发在线简繁转换工具:OpenCC 实战、避坑经验与方案选型
javascript·python
lunzi_08261 小时前
【学习笔记】《Python编程 从入门到实践》第8章:函数定义、参数传递与模块导入
笔记·python·学习
杨运交1 小时前
[030][Web模块]Spring Boot 验证与 OpenAPI 集成实战:从校验规则到文档生成
前端·spring boot·python
培培说证1 小时前
2026财务岗位如何快速提升自身能力
python
努力攻坚操作系统1 小时前
编程语言编译运行机制对比:C / Java / Python
java·c语言·python
godspeed_lucip2 小时前
LLM和Agent——专题6:Multi Agent 入门(5)
人工智能·python
Metaphor6923 小时前
使用 Python 给 PDF 设置背景色或背景图
数据库·python·pdf
郝亚军3 小时前
如何让pycharm-2026.1.2顶部菜单栏固定显示在最上端
python
怪兽学LLM3 小时前
LeetCode 438 找到字符串中所有字母异位词(Python 固定滑动窗口+字符计数解法)
python·算法·leetcode