skyfielders / python-skyfield

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

How to observe EarthSatellite? #832

Closed AlfredXiaSF closed 1 year ago

AlfredXiaSF commented 1 year ago

I want to observe an Earth satellite from a ground station or a space station and calculate its apparent RA/Dec. I loaded a TLE to create an Earth satellite and specified the ground station location with latitude and longitude. However, when I attempt to observe the satellite, I encounter an error.

ValueError: you can only observe() a body whose vector center is the Solar System Barycenter, but this vector has the center 399 EARTH

here is my code:

from skyfield.api import load, wgs84, N, E, EarthSatellite

eph = load('de421.bsp')
earth = eph['earth']

ts = load.timescale()
t0 = ts.utc(2014, 1, 21)

wuhan = earth + wgs84.latlon(30.5833*N, 114.2667*E)

line1 = '1 25544U 98067A   14020.93268519  .00009878  00000-0  18200-3 0  5082'
line2 = '2 25544  51.6498 109.4756 0003572  55.9686 274.8005 15.49815350868473'
satellite = EarthSatellite(line1, line2, 'ISS (ZARYA)', ts)

ra, dec, _ = wuhan.at(t0).observe(satellite).apparent().radec(t0)
print(ra.dms(Warning=False))
print(dec.dms())

My question is as follows:

Please forgive my poor English.

brandon-rhodes commented 1 year ago

The documentation includes guidance about how to avoid using the .observe() method, by doing a direct vector subtraction:

https://rhodesmill.org/skyfield/earth-satellites.html#avoid-calling-the-observe-method

And the technique is illustrated earlier on the same page. See if that technique works for you.

AlfredXiaSF commented 1 year ago

Thank you for your reply. I have read this: https://rhodesmill.org/skyfield/earth-satellites.html#avoid-calling-the-observe-method Yes, it works for me. But I still have some questions.


First, in the section,

https://rhodesmill.org/skyfield/earth-satellites.html#avoid-calling-the-observe-method

subtract two topocentric positions to see the difference, the first is

difference = satellite - bluffton
topocentric = difference.at(t)

the second is,

t = ts.utc(2014, 1, 23, 11, 18, 7)
ssb_bluffton = earth + bluffton
ssb_satellite = earth + satellite
topocentric2 = ssb_bluffton.at(t).observe(ssb_satellite).apparent()

the difference is,

Difference between the two positions:
0.087 km
Angle between the two positions in the sky:
00deg 00' 04.6"

I see in the second position, it call apparent() to get apparent position. I think this positon apply three factors: light-time, aberration and defelcetion, not just light-time. If we compare wiht this:

topocentric2 = ssb_bluffton.at(t).observe(ssb_satellite)

the difference is,

Difference between the two positions:
0.130 km
Angle between the two positions in the sky:
00deg 00' 17.8"

much larger than the previous one.


The second question is about aberration. I know we have to use observer velocity to calculate aberration. For a distant star, the velocity is observer's velocity in BCRS, the position of star in BCRS not change. But for a Earth satellite, it has two motions, Earth satellite orbits around the sun together with the Earth, and Earth satellite orbits around the Earth. When we observe an Earth satellite from ground station, why use the velocity of station relative to barycenter of solar system, not the center of Earth , or Earth satellite?

brandon-rhodes commented 1 year ago

to get apparent position. I think this positon apply three factors: light-time, aberration and defelcetion, not just light-time. If we compare wiht this: … the difference is … much larger than the previous one.

It looks like it's just a coincidence that, in that particular case, applying apparent() happens to move the satellite farther away from the geometric position. If you will try some other times of day, you should find that sometimes apparent() moves them farther away instead. The adjustment that aberration makes depends on which way the Earth is facing, which helps some satellite positions but hurts others.

When we observe an Earth satellite from ground station, why use the velocity of station relative to barycenter of solar system, not the center of Earth , or Earth satellite?

The reason that I recommend doing vector subtraction with satellites is for this very reason: I suspect that satellite coordinates are not un-adjusted for aberration, like star coordinates are, and so I don't think they need aberration re-applied to move them back into the correct position relative to an observer.

(I am going to go ahead and close this issue as I don't think we've found here a bug in Skyfield or its documentation, but please feel free to keep commenting, and we can re-open it later if we do find something that Skyfield needs to change.)