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

How can I use skyfied to convert SGP4 TEME coordinate to ECEF?

我想在地图上绘制卫星跟踪。所以我将 SGP4 1.4 与 python 一起使用。输入 TLE 数据,但输出数据不是我想要的。所以想把输出数据转换成ECEF数据,得到经纬度。

我知道 skyfied 可以将 TEME 转换为 ECEF,但我不知道如何使用它。

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

而我使用skyfield遇到了错误:

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

错误是:

File "D:\Anaconda2\lib\site-packages\skyfield\iokit.py", line 213, in timescale
    data = self('deltat.data')

File "D:\Anaconda2\lib\site-packages\skyfield\iokit.py", line 166, in __call__
    download(url, path, self.verbose)

File "D:\Anaconda2\lib\site-packages\skyfield\iokit.py", line 329, in download
    raise IOError('cannot get {0} because {1}'.format(url, e))

IOError: cannot get http://maia.usno.navy.mil/ser7/deltat.data because <urlopen error [Errno 10060] >

我已经通过添加一些代码解决了它。 在 iokit.py '函数 download() 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))

在下面link中,您可以使用SGP4 Python版本,returns卫星在三个坐标系即TEME、ECEF和ECI中的状态向量。 https://www.researchgate.net/publication/358351066_SGP4_Python_code