Created
January 1, 2018 04:33
-
-
Save wgaylord/b04fa9ebabc5ce3ad89cd8196e813c0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pylab as plt | |
import ephem | |
import datetime | |
# Setup lat long of telescope | |
oxford = ephem.Observer() | |
oxford.lat =41.840 | |
oxford.long = -87.640 | |
oxford.date = datetime.datetime.now() | |
# Load Satellite TLE data. | |
l1 = 'NOAA 15' | |
l2 = '1 25338U 98030A 17365.61696846 +.00000044 +00000-0 +37566-4 0 9998' | |
l3 = '2 25338 098.7770 016.8714 0010501 359.5344 000.5824 14.25833252020880' | |
biif1 = ephem.readtle(l1,l2,l3) | |
# Make some datetimes | |
midnight = datetime.datetime(2018,01,01,11,33) | |
dt = [midnight + datetime.timedelta(minutes=x) for x in range(0, 20)] | |
# Compute satellite locations at each datetime | |
sat_alt, sat_az = [], [] | |
for date in dt: | |
oxford.date = date | |
biif1.compute(oxford) | |
sat_alt.append(biif1.alt) | |
sat_az.append(np.rad2deg(biif1.az)) | |
# Plot satellite tracks | |
plt.subplot(211) | |
plt.plot(dt, sat_alt) | |
plt.ylabel("Altitude (deg)") | |
plt.xticks(rotation=25) | |
plt.subplot(212) | |
plt.plot(dt, sat_az) | |
plt.ylabel("Azimuth (deg)") | |
plt.xticks(rotation=25) | |
plt.show() | |
# Plot satellite track in polar coordinates | |
plt.polar(np.deg2rad(sat_az), 90-np.array(sat_alt)) | |
plt.ylim(0,90) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment