skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.4k stars 211 forks source link

no difference in results calculated by the method 'latlon_of', 'subpoint_of', and 'geographic_position_of' #716

Closed lcx366 closed 2 years ago

lcx366 commented 2 years ago

I originally wanted to calculate the satellite's sub-point coordinates, but the following code shows that there is no difference in the results calculated by the method latlon_of, subpoint_of, and geographic_position_of.

from skyfield.api import load,wgs84,EarthSatellite

ts = load.timescale()

# load tle
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'
sat = EarthSatellite(line1, line2, 'ISS (ZARYA)', ts)

# calculate the position of ISS in GCRF
geocentric = sat.at(sat.epoch)

# for method 'subpoint_of'
s1 = wgs84.subpoint_of(geocentric)
print(s1.latitude.degrees,s1.longitude.degrees)

# for method 'geographic_position_of'
s2 = wgs84.geographic_position_of(geocentric)
print(s2.latitude.degrees,s2.longitude.degrees,s2.elevation.m)

# for mathod 'latlon_of'
s3 = wgs84.latlon_of(geocentric)
print(s3[0].degrees,s3[1].degrees)

The results are

-22.735939707790127 -5.755799182558828
-22.735939707790124 -5.755799182558828 423375.8450751068
-22.735939707790124 -5.755799182558828

It stands to reason that these three methods should have different results. For example, method latlon_of calculates the geocentric latitude and longitude, subpoint_of calculates the geodesic latitude and longitude, and geographic_position_of adds the elevation on the basis of subpoint_of.

brandon-rhodes commented 2 years ago

I would expect the three methods to calculate the same results — where in the documentation did you find the suggestion that one of them would return geocentric coordinates? If you'll let me know, then I'll get it fixed.

lcx366 commented 2 years ago

I see, all these three methods actually calculate the geocentric latitude, and is it possible to add other methods to calculate the geodesic latitude?

brandon-rhodes commented 2 years ago

All three methods compute “geodetic” coordinates. I'll try to update the documentation so that all of those routines mention the word "geodetic" explicitly.

brandon-rhodes commented 2 years ago

There — I have improved the documentation in 61aa8e8c2d642a39ccadc02caa233c5c2b04fa79 to hopefully make it less confusing. The new documentation will appear on the website with the next release of Skyfield!