ground_track: Add timestamp label, default to datetime.now(), various
parent
00e061f2f8
commit
f530bd4607
|
@ -15,19 +15,8 @@ import matplotlib.pyplot as plt
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from beyond.io.tle import Tle
|
|
||||||
from beyond.dates import Date, timedelta
|
from beyond.dates import Date, timedelta
|
||||||
|
from utils import tle_from_file
|
||||||
|
|
||||||
def tle_from_file(filename):
|
|
||||||
'''
|
|
||||||
Returns: TLE:Tle, Object name:str
|
|
||||||
'''
|
|
||||||
|
|
||||||
with open(filename, 'r') as f:
|
|
||||||
lines = f.readlines()
|
|
||||||
|
|
||||||
return Tle(''.join(lines)), lines[0].strip()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -49,8 +38,9 @@ if __name__ == "__main__":
|
||||||
prev_lon, prev_lat = None, None
|
prev_lon, prev_lat = None, None
|
||||||
|
|
||||||
period = orb.infos.period
|
period = orb.infos.period
|
||||||
start = orb.date - period
|
# start = orb.date - period
|
||||||
stop = 2 * period
|
start = Date.now()
|
||||||
|
stop = period
|
||||||
step = period / 100
|
step = period / 100
|
||||||
|
|
||||||
for point in orb.ephemeris(start=start, stop=stop, step=step):
|
for point in orb.ephemeris(start=start, stop=stop, step=step):
|
||||||
|
@ -95,7 +85,7 @@ if __name__ == "__main__":
|
||||||
fig = plt.figure(figsize=(15.2, 8.2))
|
fig = plt.figure(figsize=(15.2, 8.2))
|
||||||
ax = fig.add_subplot(111)
|
ax = fig.add_subplot(111)
|
||||||
|
|
||||||
ax.set_title(name)
|
ax.set_title(start.datetime.strftime('%Y-%m-%dT%H:%M:%SZ'))
|
||||||
|
|
||||||
# Plot earth
|
# Plot earth
|
||||||
img = Path(__file__).parent / "earth.png"
|
img = Path(__file__).parent / "earth.png"
|
||||||
|
@ -106,9 +96,12 @@ if __name__ == "__main__":
|
||||||
for lons, lats in zip(longitudes, latitudes):
|
for lons, lats in zip(longitudes, latitudes):
|
||||||
ax.plot(lons, lats, 'r-')
|
ax.plot(lons, lats, 'r-')
|
||||||
|
|
||||||
# Plot location at epoch time
|
# Plot current location
|
||||||
lon, lat = np.degrees(orb.copy(frame='ITRF', form='spherical')[1:3])
|
ax.plot(lons[0], lats[0], 'bo')
|
||||||
ax.plot([lon], [lat], 'bo')
|
|
||||||
|
# Plot location at epoch
|
||||||
|
# lon, lat = np.degrees(orb.copy(frame='ITRF', form='spherical')[1:3])
|
||||||
|
# ax.plot([lon], [lat], 'bo')
|
||||||
|
|
||||||
ax.set_xlim([-180, 180])
|
ax.set_xlim([-180, 180])
|
||||||
ax.set_ylim([-90, 90])
|
ax.set_ylim([-90, 90])
|
||||||
|
|
Loading…
Reference in New Issue