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/

相关推荐
孟健5 小时前
Karpathy 用 200 行纯 Python 从零实现 GPT:代码逐行解析
python
码路飞7 小时前
写了个 AI 聊天页面,被 5 种流式格式折腾了一整天 😭
javascript·python
曲幽10 小时前
FastAPI压力测试实战:Locust模拟真实用户并发及优化建议
python·fastapi·web·locust·asyncio·test·uvicorn·workers
敏编程14 小时前
一天一个Python库:jsonschema - JSON 数据验证利器
python
前端付豪14 小时前
LangChain记忆:通过Memory记住上次的对话细节
人工智能·python·langchain
databook14 小时前
ManimCE v0.20.1 发布:LaTeX 渲染修复与动画稳定性提升
python·动效
花酒锄作田1 天前
使用 pkgutil 实现动态插件系统
python
前端付豪1 天前
LangChain链 写一篇完美推文?用SequencialChain链接不同的组件
人工智能·python·langchain
曲幽1 天前
FastAPI实战:打造本地文生图接口,ollama+diffusers让AI绘画更听话
python·fastapi·web·cors·diffusers·lcm·ollama·dreamshaper8·txt2img
老赵全栈实战1 天前
Pydantic配置管理最佳实践(一)
python