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/

相关推荐
xurileidian17 小时前
第 24 篇 · 边玩边学Python · while 与死循环怎么退
服务器·前端·python
有个傻瓜17 小时前
工具调用参数每次都差一截:finish_reason=length 输出预算截断的排错复盘与四种分诊实测
python·故障排查·ai agent·大模型应用开发·function calling
zhanghongyi_cpp18 小时前
第5章 学习自测
python·学习
打工仔折腾 AI19 小时前
L3 静态源码取证|工程评测:python-oracledb 驱动评估中的样本偏差陷阱
开发语言·人工智能·后端·python·性能优化
IvanCodes19 小时前
LangChain(15):LangSmith 应用评估与回归测试
python·langchain·agent
炸薯条!20 小时前
Python基础学习:文件操作详解(打开、读取、写入与路径)
java·服务器·python
jason_renyu21 小时前
Playwright 入门与实操:从安装、定位、断言到自动发博客,把浏览器自动化讲明白
运维·python·自动化·前端开发·浏览器自动化·playwright·e2e测试
维克兜率天1 天前
【维克】布林带:通道类指标的“量化基石“
人工智能·python·算法
向科→向总工→空间动态计系统1 天前
机器人大脑系统
开发语言·人工智能·python·机器人
染指11101 天前
194.DeepAgents-在DeepAgents中使用自定义沙盒环境OpenSandBox
网络·人工智能·python·langchain·deepagents