如何使用skyfied将SGP4 TEME坐标转换为ECEF?

2024-06-13 22:35:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在地图上画出卫星的轨迹。所以我在python中使用sgp41.4,输入TLE数据,但是outdata不是我想要的。所以我想把输出数据转换成ECEF数据,得到经度和纬度。在

我知道skyfied可以把TEME转换成ECEF,但我不知道如何使用它。在

https://github.com/skyfielders/python-skyfield/blob/master/skyfield/sgp4lib.py

我用天田遇到了错误:

from skyfield.api import load
ts=load.timescale()

错误是:

^{pr2}$

Tags: 数据httpsgithub轨迹错误地图loadskyfield
1条回答
网友
1楼 · 发布于 2024-06-13 22:35:48

我通过添加一些代码解决了这个问题。 在iokit.py'函数下载()335行

 try:
    print (url)  #original

    try:
        connection = urlopen(url)
    except:
       import urllib2
       user_agent ='"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36"' #cxh
       headers = { 'User-Agent' : user_agent }
       proxy = urllib2.ProxyHandler({}) 
       opener = urllib2.build_opener(proxy) 
       urllib2.install_opener(opener) 
       req ,= urllib2.Request(url, headers = headers) 
       response = urllib2.urlopen(url) 
       connection= response
       print ('get data successfully')

except Exception as e:
    raise IOError('cannot get {0} because {1}'.format(url, e))

相关问题 更多 >