Find the distance of the satellite from the moon SkyField #941
Unanswered
MiliPopsZHuZHu
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given an assignment to find the distance from the satellite to the moon using the Skyfield library. I figured out how to write TLE strings. But the adaptation of the first code, which is encountered when studying the documentation, did not work. Can you tell me what is the error and how the code should look correctly?
from skyfield.api import load, EarthSatellite
ts = load.timescale()
t = ts.now()
planets = load('de421.bsp')
moon = planets['moon']
line1 = "1 54153U 22139D 23047.11803063 .00000034 00000+0 00000+0 0 9998"
line2 = "2 54153 90.0048 0.0000 0006614 0.0000 166.8485 5.00439483 3220"
satellite = EarthSatellite(line1, line2, "new_ISS", ts)
geocentric = satellite.at(t)
astrometric = geocentric.observe(moon)
distance = astrometric.distance().km
print(f"Расстояние между спутником и Луной: {distance} км")
Beta Was this translation helpful? Give feedback.
All reactions