Commenting
This commit is contained in:
parent
771738842b
commit
885c5835a0
12
get_tle.py
12
get_tle.py
@ -2,15 +2,11 @@ import requests
|
|||||||
import json
|
import json
|
||||||
import array
|
import array
|
||||||
import sys
|
import sys
|
||||||
|
#Where we pull the data from.
|
||||||
web_tle = [ 'http://www.celestrak.com/NORAD/elements/weather.txt', 'https://www.celestrak.com/NORAD/elements/stations.txt' ]
|
web_tle = [ 'http://www.celestrak.com/NORAD/elements/weather.txt', 'https://www.celestrak.com/NORAD/elements/stations.txt' ]
|
||||||
|
|
||||||
|
#celestrak uses a different key value than I do, find all instances of their keys and replace with mine.
|
||||||
sats_of_interest = { 'NOAA-15':'NOAA 15', 'NOAA-18':'NOAA 18', 'NOAA-19':'NOAA 19', 'METEOR-M1':'METEOR-M 1', 'METEOR-M2':'METEOR-M 2', 'ISS':'ISS (ZARYA)' }
|
sats_of_interest = { 'NOAA-15':'NOAA 15', 'NOAA-18':'NOAA 18', 'NOAA-19':'NOAA 19', 'METEOR-M1':'METEOR-M 1', 'METEOR-M2':'METEOR-M 2', 'ISS':'ISS (ZARYA)' }
|
||||||
#sats_of_interest = { 'NOAA-15':'NOAA 15' }
|
|
||||||
|
|
||||||
|
|
||||||
#page = urllib2.urlopen(web_noaa_tle)
|
|
||||||
#page = requests.get(web_noaa_tle, stream=True)
|
|
||||||
|
|
||||||
#NOAA 15 [B]
|
#NOAA 15 [B]
|
||||||
#1 25338U 98030A 16173.50363904 .00000079 00000-0 52195-4 0 9991
|
#1 25338U 98030A 16173.50363904 .00000079 00000-0 52195-4 0 9991
|
||||||
@ -21,6 +17,7 @@ line_num = 0
|
|||||||
cur_sat_line = -1
|
cur_sat_line = -1
|
||||||
cur_sat = ""
|
cur_sat = ""
|
||||||
|
|
||||||
|
#This was originally intended to check that the data I was receiving was legitimate, very half-assed.
|
||||||
def check_line1(str):
|
def check_line1(str):
|
||||||
if( len(str) == 69 ):
|
if( len(str) == 69 ):
|
||||||
fields = {}
|
fields = {}
|
||||||
@ -63,12 +60,13 @@ def check_line2(str):
|
|||||||
for tle in web_tle:
|
for tle in web_tle:
|
||||||
page = requests.get(tle, stream=True)
|
page = requests.get(tle, stream=True)
|
||||||
for line in page.iter_lines():
|
for line in page.iter_lines():
|
||||||
#print '>>', line
|
#I don't actually remember why I made this var 'hsat'
|
||||||
for hsat, sat in sats_of_interest.iteritems():
|
for hsat, sat in sats_of_interest.iteritems():
|
||||||
if( line.startswith(sat) ):
|
if( line.startswith(sat) ):
|
||||||
cur_sat_line = line_num
|
cur_sat_line = line_num
|
||||||
cur_sat = hsat
|
cur_sat = hsat
|
||||||
|
|
||||||
|
#Enable this for data integrity check if you want.
|
||||||
if( line_num == cur_sat_line + 1 and cur_sat_line >= 0 ):
|
if( line_num == cur_sat_line + 1 and cur_sat_line >= 0 ):
|
||||||
if( check_line1(line) ):
|
if( check_line1(line) ):
|
||||||
data[cur_sat] = line
|
data[cur_sat] = line
|
||||||
|
Loading…
Reference in New Issue
Block a user