I am trying to capture the historical distance between two satellites but having trouble writing the logic to update the observed TLE when an updated TLE is made available. For example if have the 4 TLEs listed below but as the distance iterates through the differnt times how can I update to use the most recent TLE if the there is an new observation :
I am trying to capture the historical distance between two satellites but having trouble writing the logic to update the observed TLE when an updated TLE is made available. For example if have the 4 TLEs listed below but as the distance iterates through the differnt times how can I update to use the most recent TLE if the there is an new observation :
################# SAT 1 sat1_initial = EarthSatellite( '1 50322U 21129B 22225.62649072 -.00000331 +00000+0 +00000+0 0 9999', '2 50322 0.1164 164.1148 0002656 102.9776 51.8190 01.00428106002426' ) sat1_update=EarthSatellite( '1 50322U 21129B 22226.61217274 -.00000326 +00000+0 +00000+0 0 99990', '2 50322 0.1173 162.8746 0002740 104.0896 48.3189 01.00427772002433' )
################# SAT 2 sat2_initial = EarthSatellite( '1 52940U 22073A 24074.90684682 -.00000373 +00000+0 +00000+0 0 99995', '2 52940 1.5815 89.4725 0002301 223.4944 305.7281 01.00274601006105' ) sat2_update=EarthSatellite( '1 52940U 22073A 24075.04354795 -.00000372 +00000+0 +00000+0 0 99999', '2 52940 1.5818 89.4689 0002312 223.3247 355.2499 01.00274549006094' )
import numpy as np import matplotlib.pyplot as plt from skyfield.api import Topos, Loader, EarthSatellite
ts = load.timescale() de421 = load('de421.bsp') earth = de421['earth']
datetime_sample = sat1_initial.epoch.utc_datetime() year = datetime_sample.year month = datetime_sample.month day=datetime_sample.day hour=datetime_sample.hour
hours = np.linspace(hour,hour+24, 25) times = ts.utc(year, month, day, hours, 0) times_lst = sorted(times.utc_strftime()) print(times_lst)
separation_lst = []
sat1_pos = sat1_initial.at(times).position.km sat2_pos = sat2_initial.at(times).position.km separation = np.sqrt(((sat1_pos-sat2_pos)*2).sum(axis=0))# kilometers separation_lst.append(separation) change = separation[1:]-separation[:-1] # kilometers per minute range_rate = change 1E+06 / 60 # millilmeters per second
print(len(separation_lst))