Reputation: 107
While playing a bit with pyorbital
I noticed that the function get_lonlatalt()
does not seem to return a correct longitude value to me. So I have compared the returned Lon/Lat/Alt to other tracking software:
The returned Altitude and Latitude are spot on but the Longitude seems to be off (using the below code example the function returns about 15deg less than what the real position of the ISS is right now).
The below code prints the Lat/Lon/Alt of the ISS once per second to the console and can be used to compare the position to e.g. http://www.n2yo.com/?s=25544
Does anyone have any suggestions how to fix this/why this is happening ?
P.S. Unfortunately stackoverflow doesnt allow me to create the Tag "pyorbital"
before 1500 reputation..
from pyorbital.orbital import Orbital
from datetime import datetime
import time
tle_object_name = "ISS (ZARYA)"
sat = Orbital(tle_object_name) #Fetches TLE from the internet by itself
while True:
now = datetime.utcnow()
lon, lat, alt = sat.get_lonlatalt(now)
print "{} UTC at {}E, {}N, {}km".format(now, round(lon, 3), round(lat, 3), round(alt, 3))
time.sleep(1)
Upvotes: 2
Views: 618
Reputation: 3729
I just tried it, and it seems to work perfectly. Are you sure you're looking at the satellite location on the website you provided, and not your own location? I made the same mistake at first.
EDIT:
so I dove into the source code a bit to try to find why only lon is showing this behavior.
In orbital.py, the function astronomy.gmst()
is used ONLY to calculate the lon. In astronomy.py, gmst()
calls jdays2000()
where we see this line of code: np.datetime64('2000-01-01T12:00')
. Checking the docs of numpy.datetime (https://docs.scipy.org/doc/numpy-1.14.0/reference/arrays.datetime.html), we see that the way this function works (timezone wise) was changed numpy 1.11 (2016), and pyorbital also took this change into account some time later (https://github.com/pytroll/pyorbital/commit/08bb5be87c65412af5d7293c00fa2680b068d150).
So my guess is going to be either your pyorbital package is not up to date, or your numpy is not up to date.
My versions (numpy==1.14.2, pyorbital==1.3.1)
Upvotes: 3