Skip to content

Instantly share code, notes, and snippets.

@kvsankar
Created March 10, 2018 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
@kvsankar
Copy link
Author

kvsankar commented Mar 10, 2018

This study was done to analyze the ISS orbit and explain the behavior of the altitude plot. Posted below is a graph plotting roughly three orbits of the ISS: The blue sinusoidal curve is the latitude - it varies from about 50S to 50N crossing through equatorial latitudes. The orange curve is relative distance to the ISS from the center of the Earth. I have used the term relative just to indicate that I have subtracted an offset of 6768.1 km to fit it in the same graph. The grey curve is the relative altitude. It's pretty clear that the peaks in the altitude correspond to extreme North/South latitudes and troughs correspond to equatorial latitudes. Further, two consecutive peaks are of different altitude because of the eccentricity of the orbit. The same case for two consecutive troughs as well.

iss-orbit-v01

@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