skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.38k stars 208 forks source link

Satellite trajectory has errors. #969

Closed yangyang-studio closed 1 month ago

yangyang-studio commented 1 month ago

import ephem import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap from datetime import datetime, timedelta

tle_start_link="""CSS
1 48274U 21035A 24119.20746383 .00055703 00000-0 60539-3 0 9992 2 48274 41.4693 28.4046 0003840 264.5634 95.4767 15.62582751171271"""

year, doy = 2022, 92.64473324

doy = 8/24

dt0 = datetime(year, 1, 1) + timedelta(days=doy)

dt0 = datetime(2024, 5, 20,14,46)

dt0 = datetime.now()

dt0 = datetime.now()+ timedelta(days=doy) time_list = [(dt0 + timedelta(hours=i/60)) for i in range(0,60*2)]

m = Basemap() m.drawcoastlines()

tle0, tle1, tle2 = tle_start_link.split("\n") satellite = ephem.readtle(tle0, tle1, tle2) for dt in time_list: item = dt.strftime("%Y/%m/%d %H:%M:%S") satellite.compute(f'{item}') latitude = satellite.sublat / ephem.degree longitude = satellite.sublong / ephem.degree x1,y1 = m(longitude, latitude) m.plot(x1, y1, "r.", markersize=1)

plt.savefig('out.png',dpi=500) plt.show()

The generated satellite trajectory is quite different from the facts. How to adjust it? mmexport1716187953789

Software diagram: Screenshot_2024-05-20-14-51-19-23_7e775883f61c9a1dada066700d5a3400

look forward toLooking forward to your reply, thank you!

brandon-rhodes commented 1 month ago

It looks like you accidentally opened this issue in the wrong repository, since I don't see Skyfield among your imports? Please re-open it over in the ephem repository. Here's the link:

https://github.com/brandon-rhodes/pyephem/issues

Also, if you use three back-ticks around your code, the GitHub will format it correctly, so that folks who want to help with your issue can read the code:

https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code

(I would move it myself, but GitHub doesn't allow issues to be moved between organizations. Thanks!)