skyfielders / python-skyfield

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

Question about vector implementation of latlon_of() for replacement of deprecated subpoint() #690

Closed mworion closed 2 years ago

mworion commented 2 years ago

Hi, I currently replacing the deprecated functions of skyfield like subpoint(). From my point of view as I 'm looking for lat/lon the replacement would be latlon_of().

Currently I use for certain time period the expression:

    subpoints = wgs84.subpoint(self.satellite.at(vecT))

where vecT is a vector of different times. When use the replacement

    lat, lon = wgs84.latlon_of(self.satellite.at(vecT))

raises the type error:

    TypeError: cannot unpack non-iterable GeographicPosition object

If I use a single time value, no problem at all. Am I wrong or do I use this replacement incorrect? Any help appreciated!

Michel

brandon-rhodes commented 2 years ago

Whenever you get an unpacking error like that, try printing out the kind of thing you've gotten back:

something = wgs84.latlon_of(self.satellite.at(vecT))
print(something)

That should reveal what kind of object is coming back, that's not willing to split into a lat and a lon. Let me know what you find, and we should be able to get it fixed!

mworion commented 2 years ago

@brandon-rhodes: Many thanks for the hint. I have to apologize. This was a first order misunderstanding on my side. I did two steps in one. As simple as it could be: just replace subpoint() with subpoint_of() and everything is OK. Michel