Skip to content

Instantly share code, notes, and snippets.

@kvsankar
Created March 10, 2018 16:25
Show Gist options
  • Save kvsankar/a84046e5c85897477dbfca0523d93b97 to your computer and use it in GitHub Desktop.
Save kvsankar/a84046e5c85897477dbfca0523d93b97 to your computer and use it in GitHub Desktop.
Python script to dump some ISS orbit data
#!/bin/python
import math
from pyorbital.orbital import Orbital
from pyorbital import tlefile
from datetime import datetime
from datetime import timedelta
tle = tlefile.read('ISS (Zarya)', 'C:\sankar\personal\iss-tle.txt')
orb = Orbital('ISS (Zarya)')
year = 2018
month = 3
day = 9
hour = 0
minute = 0
time = datetime(year, month, day, hour, minute)
delta = timedelta(seconds = 60)
for i in range(300):
(x, y, z) = orb.get_position(time)[0]
r = math.sqrt(x*x + y*y + z*z) * 6378.1
longlatalt = orb.get_lonlatalt(time)
print time, ',', longlatalt[0], ',', longlatalt[1], ',', longlatalt[2], ',', r
time += delta
@Tsunamimor
Copy link

Hi Sankaranarayanan,
Would it be possible to show (or attach) your sample TLE (iss-tle.txt) file format?

Is it something like this:
[http://www.celestrak.com/NORAD/elements/gp.php?CATNR=25544](url)
or it's got multiple entries for different timestamps in the same file?

Thanks,
Paddy

@kvsankar
Copy link
Author

Hi, Paddy -

It's exactly like the example you have quoted. PyOrbital doc is here - https://pyorbital.readthedocs.io/en/latest/

Sankar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment