1

I'm calculating the position of satellities using mi location (in latitude-longitude), I want to know what satellities can I see (my receptor) from my position. For this I'm using the help of this blog, I'm using Pyphem, the library for python, and using the information of the TLE files. With this I can know the position but maximum the range of data that I can get with the file, the files are in this site. e.g. The file get info from 12-01-2017 1:00 to 13-01-2017 23:59, I want to know the position for 14-01-2017 13:05 The Question is Can I get a TLE file for tomorrow? or just I can get the file for the day of today?

UPDATE 1.

my code in python is this:

TimeNow = datetime.datetime.now() #"10/01/2017"
Longitude = -73.1198 
Latitude = 7.11392
print TimeNow

sat_alt, sat_az, sat_name = [], [], []

observer = ephem.Observer()
observer.long = '-73.1224429' # '-37.799423'
observer.lat = '7.1388027' # '144.999979'
observer.date = datetime.datetime.now()

GPS_list = 'https://celestrak.org/NORAD/elements/gps-ops.txt'
GPS2_list = 'http://www.tle.info/data/gps-ops.txt'
GLONASS_list = 'https://celestrak.org/NORAD/elements/glo-ops.txt'
GLONASS2_list = 'http://www.tle.info/data/glo-ops.txt'
#'http://www.amsat.org/amsat/ftp/keps/current/nasabare.txt').readlines()


tles = urllib2.urlopen(GPS_list).readlines() 

tles = [item.strip() for item in tles]
tles = [(tles[i],tles[i+1],tles[i+2]) for i in xrange(0,len(tles)-2,3)]

for tle in tles:

    try:
        sat = ephem.readtle(tle[0], tle[1], tle[2])
        rt, ra, tt, ta, st, sa = observer.next_pass(sat)

        if rt is not None and st is not None:
            #observer.date = rt
            sat.compute(observer)
            
            #if 'PRN 26' in tle[0]:
                #print "TRUE"
            if TimeNow <= ephem.localtime(st) and TimeNow >= ephem.localtime(rt):
                text = tle[0]
                sat_alt.append(np.rad2deg(sat.alt))
                sat_az.append(np.rad2deg(sat.az))
                
                text2 = text.rsplit(')', 1)[0]
                text3 = text2.rsplit('(', 1)[1]
                sat_name.append(text3)
                print text3, np.rad2deg(ra),np.rad2deg(sa)
    except ValueError as e:
        print e

Results:

PRN 19 228.755917041 148.703886987
PRN 02 221.648736379 143.285115427
PRN 17 221.556446863 146.188232693
PRN 30 322.13237575 60.4800956664
PRN 06 211.849518618 131.038791151

In this exaple I have the information of today (28/02/2017) I in the link I have the TLE file of today, but if I want the information of tomorrow?

thank you

UPDATE 2:

You can change the variable TimeNow for another date (for example now + 2 hours), but I do not find how is the error if with the TLE file of today I try to calculate the position (elevation / azimuth) of tomorrow, or past tomorrow, the error will be too big? how much? (i'm reading this trying to find the answer) I hope someone knows it. Thanks.

Community
  • 1
  • 1
mikesneider
  • 772
  • 2
  • 10
  • 28
  • Where, specifically, are you getting the values 12-01-2017 1:00 to 13-01-2017 23:59? I do not see those in the file you link to — could you show the code you are using to get those specific dates and times? Thanks! – Brandon Rhodes Feb 27 '17 at 03:18
  • Thanks Brandon, I updated the question; with the link, I have the information of today, but if I wanna know the position of the satellites of tomorrow? How can I get that file? thanks. – mikesneider Feb 28 '17 at 16:23

1 Answers1

0

If I understand your problem, you want to get a satellite's position from its TLE in a period of time, well you can get cartesian coordinates of a satellite's TLE by using the sgp4 library : pip install sgp4

from sgp4.api import Satrec

from sgp4.api import jday

Then you put the first TLE line in the variable s, and the second in the variable t like this :

s = '1 25544U 98067A   21035.51324206  .00001077  00000-0  27754-4 0  9998'

t = '2 25544  51.6455 278.9410 0002184 336.6191  80.6984 15.48940116268036'

satellite = Satrec.twoline2rv(s, t)

Then you pick the date you want, (year, month, day, hours, minutes, seconds) like this :

jd, fr = jday(2021, 2, 4, 18, 5, 0) 

e, r, v = satellite.sgp4(jd, fr)

And you've got the error e, position vector r, speed vector v in Cartesian coordinates.

https://josephinepicot.medium.com/get-the-cartesian-position-velocity-vectors-of-a-satellite-at-a-given-time-from-a-tle-60d29e31c422

Now, if your satellite is geostationary, it's easy to know what its position will be the next day, but if not, you might be able to plot a time series with the previous position vectors...

Hope it helped!

BTables
  • 4,413
  • 2
  • 11
  • 30
Chaussette
  • 56
  • 5