2

I want to see "in my sky" how many satellites I can see. I'm using this code:

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

observer = ephem.Observer()
observer.long = Longitude
observer.lat = Latitude
observer.date = TimeNow

HowMany = 0

print "TIME: ", TimeNow
print
GPS_list = 'http://www.celestrak.com/NORAD/elements/gps-ops.txt'
GPS2_list = 'http://www.tle.info/data/gps-ops.txt'
GLONASS_list = 'http://www.celestrak.com/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:
            sat.compute(observer)

            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]
                NamePRN = text2.rsplit('(', 1)[1]
                sat_name.append(NamePRN)

                #I wanna Try just with the PRN 1
                if 1 == 1: # NamePRN = 'PRN 01':
                    print NamePRN
                    print "Elev:" , np.rad2deg(sat.alt), "Azimuth: ",np.rad2deg(sat.az) #sat.alt / ephem.degree
                    print "original rise time: ",rt
                    print 'rise time: ', ephem.localtime(rt)
                    print 'set time: ',  ephem.localtime(st) 
                    print
                    print 'Time until rise: ', ephem.localtime(rt) - TimeNow
                    print 'Time until set: ',ephem.localtime(st) - TimeNow
                    timeuntilrise = ephem.localtime(rt)-TimeNow
                    HowMany += 1
                    minutesaway = timeuntilrise.seconds/60.0

                    if sys.platform == 'darwin':
                        say = 'say "%s WILL BE MAKING A PASS IN %d MINUTES."' % (NamePRN,minutesaway)
                        os.system(say)
                    else:
                        print "Minutes Away: ",minutesaway


            #print ' Rise Azimuth: ', ra
            #print ' Transit Time: ', tt
            #print ' Transit Altitude: ', ta
            #print ' Set Time: ', st
            #print ' Set Azimuth: ', sa
            #print 'rise time: ', ephem.localtime(rt)
            #print 'set time: ',  ephem.localtime(st)
            #print
    except ValueError as e:
        print e
print
print "How Many: ", HowMany

The results are:

TIME:  2017-03-23 09:32:30.445831

PRN 14
Elev: 23.5719168541 Azimuth:  186.783257119
original rise time:  2017/3/23 18:15:23
rise time:  2017-03-23 13:15:23.000003
set time:  2017-03-23 05:56:40.000003

Time until rise:  3:42:52.554172
Time until set:  -1 day, 20:24:09.554172
Minutes Away:  222.866666667
PRN 22
Elev: 27.8617383982 Azimuth:  135.529777134
original rise time:  2017/3/23 18:59:39
rise time:  2017-03-23 13:59:38.000003
set time:  2017-03-23 05:52:54.000003

Time until rise:  4:27:07.554172
Time until set:  -1 day, 20:20:23.554172
Minutes Away:  267.116666667
PRN 19
Elev: 63.2536032619 Azimuth:  23.0164551349
original rise time:  2017/3/23 19:01:01
rise time:  2017-03-23 14:01:00.000003
set time:  2017-03-23 07:01:07.000003

Time until rise:  4:28:29.554172
Time until set:  -1 day, 21:28:36.554172
Minutes Away:  268.483333333
PRN 23
Elev: 2.50815303871 Azimuth:  88.104092255
original rise time:  2017/3/23 21:33:06
rise time:  2017-03-23 16:33:06.000003
set time:  2017-03-23 08:35:45.000003

Time until rise:  7:00:35.554172
Time until set:  -1 day, 23:03:14.554172
Minutes Away:  420.583333333
PRN 17
Elev: 43.5586196015 Azimuth:  52.03302655
original rise time:  2017/3/23 18:27:16
rise time:  2017-03-23 13:27:15.000003
set time:  2017-03-23 06:12:30.000003

Time until rise:  3:54:44.554172
Time until set:  -1 day, 20:39:59.554172
Minutes Away:  234.733333333
PRN 31
Elev: 7.61244305169 Azimuth:  168.667710308
original rise time:  2017/3/23 19:47:23
rise time:  2017-03-23 14:47:23.000003
set time:  2017-03-23 08:03:23.000003

Time until rise:  5:14:52.554172
Time until set:  -1 day, 22:30:52.554172
Minutes Away:  314.866666667
PRN 12
Elev: 48.18881167 Azimuth:  258.782917613
original rise time:  2017/3/23 18:42:38
rise time:  2017-03-23 13:42:38.000003
set time:  2017-03-23 07:35:56.000003

Time until rise:  4:10:07.554172
Time until set:  -1 day, 22:03:25.554172
Minutes Away:  250.116666667
PRN 25
Elev: 18.8269690697 Azimuth:  222.58247788
original rise time:  2017/3/23 19:39:10
rise time:  2017-03-23 14:39:09.000003
set time:  2017-03-23 08:34:40.000003

Time until rise:  5:06:38.554172
Time until set:  -1 day, 23:02:09.554172
Minutes Away:  306.633333333
PRN 01
Elev: 9.20983988345 Azimuth:  117.518172142
original rise time:  2017/3/23 17:53:54
rise time:  2017-03-23 12:53:54.000003
set time:  2017-03-23 04:56:06.000003

Time until rise:  3:21:23.554172
Time until set:  -1 day, 19:23:35.554172
Minutes Away:  201.383333333
PRN 24
Elev: 15.4381621753 Azimuth:  284.908746358
original rise time:  2017/3/23 16:23:16
rise time:  2017-03-23 11:23:16.000003
set time:  2017-03-23 05:14:38.000003

Time until rise:  1:50:45.554172
Time until set:  -1 day, 19:42:07.554172
Minutes Away:  110.75
PRN 06
Elev: 49.0638613556 Azimuth:  345.92883678
original rise time:  2017/3/23 20:57:05
rise time:  2017-03-23 15:57:04.000003
set time:  2017-03-23 08:25:55.000003

Time until rise:  6:24:33.554172
Time until set:  -1 day, 22:53:24.554172
Minutes Away:  384.55
PRN 03
Elev: 41.016662249 Azimuth:  109.881781593
original rise time:  2017/3/23 19:45:53
rise time:  2017-03-23 14:45:53.000003
set time:  2017-03-23 06:43:35.000003

Time until rise:  5:13:22.554172
Time until set:  -1 day, 21:11:04.554172
Minutes Away:  313.366666667
PRN 32
Elev: 13.6017761707 Azimuth:  207.711749038
original rise time:  2017/3/23 17:23:22
rise time:  2017-03-23 12:23:22.000003
set time:  2017-03-23 05:14:55.000003

Time until rise:  2:50:51.554172
Time until set:  -1 day, 19:42:24.554172
Minutes Away:  170.85

How Many:  13

I'm checking the page "http://www.n2yo.com/" in the menu "Satellites in Orbit"->"GPS satellites" But How can I see if I'm right or not? another web page? Thanks.

mikesneider
  • 772
  • 2
  • 10
  • 28

2 Answers2

1

Calsky and n2yo works to see the azimuth and elevation from some location. in Calsky show for default, the satellites above 25ยบ

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
mikesneider
  • 772
  • 2
  • 10
  • 28
0

For on-line tools, I really find in-the-sky.org useful and helpful. It's quite new, modern, and well-maintained by an active space expert and web developer. See this and this.

Another python check can be done with Skyfield. It is maintained by the same person who maintains PyEphem, but again is much newer and modernized. Skyfield is quite different than PyEphem on the inside, and they have different sets of capabilities. See all of these in stackoverflow, and then all of these in Space Exploration SE, and then all of these in Astronomy SE!

Community
  • 1
  • 1
uhoh
  • 3,713
  • 6
  • 42
  • 95