skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.39k stars 209 forks source link

error : AttributeError: 'Geoid' object has no attribute 'latlon_of' #731

Closed powersoft closed 2 years ago

powersoft commented 2 years ago

When I try this examples from "Earth Satelites" all was working well until I reach this part.

lat, lon = wgs84.latlon_of(geocentric) print('Latitude:', lat) print('Longitude:', lon)

Latitude: 50deg 14' 37.4" Longitude: -86deg 23' 23.3"

Got the error : AttributeError: 'Geoid' object has no attribute 'latlon_of' Ho can I convert the geocentric values to lat and lon?

Thanks for any help Jan Kromhout Hellevoetsluis-NL

brandon-rhodes commented 2 years ago

What version of Skyfield are you using?

powersoft commented 2 years ago

This is my version: Skyfield version: 1.39 jplephem version: 2.16 sgp4 version: 2.20 Built-in leap seconds table ends with leap second at: 2016-12-31 23:59:60 UTC Built-in ∆T table from finals2000A.all covers: 1973-01-01 to 2021-12-11

powersoft commented 2 years ago

When I installed with pip3 then I get the 1.39 version, how to update to the 1.42 version?

brandon-rhodes commented 2 years ago

Try pip install -U skyfield.

powersoft commented 2 years ago

Thank all is working fine now!

brandon-rhodes commented 2 years ago

Great, I'm glad we found the problem!

powersoft commented 2 years ago

Still found another thing.

When I use the code

#!/usr/bin/env python3

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

from skyfield.api import load, wgs84

stations_url = 'http://celestrak.com/NORAD/elements/stations.txt'
satellites = load.tle_file(stations_url)
print('Loaded', len(satellites), 'satellites')

by_number = {sat.model.satnum: sat for sat in satellites}
satellite = by_number[25544]
print(satellite)

get this answer: Loaded 66 satellites ISS (ZARYA) catalog #25544 epoch 2021-09-02 09:39:53 UTC

but the actual stations.txt say's

ISS (ZARYA)
1 25544U 98067A 22089.52009259 .00011727 00000+0 21569-3 0 9996 2 25544 51.6456 6.2189 0003938 325.9692 41.6994 15.49657097332985

What should I do to get the latest version of the TLE?

Have read into the documentation about Specify the argument reload=True, which asks Skyfield to always download new results even if there is already a file on disc.

But were to place this statement?

Thanks for any help.

brandon-rhodes commented 2 years ago

the argument reload=True

Pass it as a keyword argument, like .tle_file(stations_url, reload=True).