def satload(satname): satellites = load.tle(stations_url) satellite = satellites[satname] days = t - satellite.epoch if abs(days) > 1: satellites = load.tle(stations_url, reload=True) satellite = satellites[satname] print('{:.3f} days away from epoch'.format(days)) print(satellite)
def start(self): """ Dev: K4YT3X IZAYOI Date Created: Jan 15, 2018 Last Modified: Jan 16, 2018 Dev: Reimannsum Last Modified: Aug 27, 2019 This method is the main ISS pointer controller it runs infinitively until Ctrl^C is pressed. """ ts = load.timescale() stations_url = 'http://celestrak.com/NORAD/elements/stations.txt' satellites = load.tle(stations_url) satellite = satellites['ISS (ZARYA)'] observer = Topos('42.5337N', '83.7384W') while True: t = ts.now() days = t - satellite.epoch if abs(days) > 14: satellites = load.tle(stations_url, reload=True) satellite = satellites['ISS (ZARYA)'] self.pointer.check_gravity() difference = satellite - observer topocentric = difference.at(t) alt, az, distance = topocentric.altaz() self.pointer.elevation_set(alt.degrees) self.pointer.azimuth_set(az.degrees) self.display.set_pointing(az.degrees, alt.degrees) self.display.set_north(self.pointer.declination) g = self.pointer.compass.gravity self.display.set_gravity(g[0], g[1], g[2]) Avalon.info("ISS Position Update:") #print(self.pointer.azimuth) #print(self.pointer) print( 'Elevation :{0:6.3f}\tAzimuth :{1:6.3f}\nArm Correction:{3:6.3f}\tBase Correction:{2:6.3f}' .format(alt.degrees, az.degrees, float(self.pointer.base_correction), float(self.pointer.arm_correction))) print("Elev: {1:6.3f}\tAz: {0:6.3f}".format( float(self.pointer.azimuth), float(self.pointer.elevation))) print(self.pointer.compass) self.motor_base.set_azimuth(float(self.pointer.azimuth)) self.motor_arm.set_azimuth(float(self.pointer.elevation)) time.sleep(2.5)
def readTLE(fileName='./india_tle.dat'): # tle referesh days refresh_days = 14 # current date and time ts = load.timescale(builtin=True) t = ts.now() days = 1 old_date = 0 if not os.path.exists(fileName): # call create local tle function print("Creating new tle file") dict = getISROSatelliteList() saveTLE(dict, fileName) # load the new one satellites = load.tle(fileName) else: # load the local file satellites = load.tle(fileName) # get the first in the dictionary sat_id = list(satellites.keys())[0] satellite = satellites[sat_id] days = t - satellite.epoch old_date = satellite.epoch.utc_strftime('-%Y-%m-%d-%H-%M-%S') # if older than refresh_days create new local tle and load new one if abs(days) > refresh_days: # call create local tle function print("Creating new tle file") # backup old tle backupFilename = Path(fileName).stem + old_date + '.dat' os.rename(fileName, backupFilename) # get the new one dict = getISROSatelliteList() saveTLE(dict, fileName) # load the new one satellites = load.tle(fileName) # sats dictionary for easy search sats = {} for item in [satellites]: names = [key for key in item.keys()] for satname in names: sat = item[satname] satid = sat.model.satnum sats[satid] = sat sats[satname] = sat # return dictionary return sats
def run_program(): # TODO: Put in storage that is more permanent? satellites_url = 'http://celestrak.com/NORAD/elements/resource.txt' satellites = load.tle(satellites_url) # get Teleos 1 satellite, which resides in a LEO satellite = satellites['TELEOS 1'] ts = load.timescale() time_step = 60 # in seconds field_of_regard = 536000 * math.tan(math.radians(40)) # 449757.402311 field_of_view = 40250 # assume diameter = 80500m * 80500m start_time = ts.from_datetime(datetime.utcfromtimestamp(int(sys.argv[1]) / 1000).replace(tzinfo=utc)) end_time = ts.from_datetime(datetime.utcfromtimestamp(int(sys.argv[2]) / 1000).replace(tzinfo=utc)) center_x, center_y = float(sys.argv[3]), float(sys.argv[4]) center_topos = Topos(longitude_degrees=center_x, latitude_degrees=center_y) query = SatelliteQuery(satellite, center_topos) min_times, min_dist = find_minima(start_time, end_time, query.distance) output = {'range': {"start": convert_datetime_to_str(start_time), "end": convert_datetime_to_str(end_time)}, 'error': "", 'events': []} radius = float(sys.argv[5]) if radius > field_of_view: output['error'] = "Area of Interest exceeds Field of View." else: # populate event list # TODO: add lon/lat of subpoint event_list = [] for t, d in zip(min_times, min_dist): # if d < field_of_regard - radius: event_list.append({ "time": convert_datetime_to_str(t), "distance": d }) output['events'] = event_list print(json.dumps(output)) sys.stdout.flush()
def show_simple_position(stations_url, sat_name, times, description): # TO DO: FIND METHOD FOR HANDLING sexagesimal <=> decimal units conversion from skyfield.api import Topos, load # %matplotlib inline import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap satellites = load.tle(stations_url, reload=True) satellite = satellites[sat_name] t = times fig = plt.figure(figsize=(8, 8)) m = Basemap( projection='lcc', resolution=None, width=35E6, height=35E6, lat_0=1, lon_0=1, ) m.etopo(scale=0.5, alpha=0.5) geocentric = satellite.at(t) subpoint = geocentric.subpoint() sign1, d1, m1, s1 = subpoint.latitude.signed_dms() lat = sign1 * (d1 + m1 / 60 + s1 / 3600) sign2, d2, m2, s2 = subpoint.longitude.signed_dms() lon = sign2 * (d2 + m2 / 60 + s2 / 3600) x, y = m(lon, lat) plt.plot(x, y, 'ok', markersize=4) fig.suptitle(description, fontsize=20, fontweight='bold') return ()
def sat_data(sat): stations_url = 'http://celestrak.com/NORAD/elements/stations.txt' satellites = load.tle(stations_url, reload=True) satellite = satellites[str(sat)] ts = load.timescale() t = ts.now() geocentric = satellite.at(t) ground_station = Topos('30.287475 N', '97.735739 W') difference = satellite - ground_station topocentric = difference.at(t) el, az, distance = topocentric.altaz() if el.degrees > 0: visibility = True else: visibility = False sat_data = {'spacecraft ' : sat, 'times' : t.utc_jpl(), 'states' : {'azimuth' : str(az.degrees), 'elevation' : str(el.degrees)}} return jsonify(sat_data)
def get_sats(kind='stations', key_type='str'): """ Load a set of satellites parameters ---------- kind : str The kind of satellites to be loaded. Available is: 'stations' 'starlink' other - geos key_type : str Default is to have numeric and string ids for each satellites (ie two ids each) If key_type=='str' then only use string ids, otherwise use only numeric ids returns ------- sats : [:class:`skyfield.sgp4lib.EarthSatellite`,...] """ if kind is None: kind = 'stations' url = f'http://www.celestrak.com/NORAD/elements/{kind}.txt' satellites = load.tle(url) if key_type == 'str': sat = [satellites[n] for n in satellites.keys() if isinstance(n, str)] else: sat = [ satellites[n] for n in satellites.keys() if not isinstance(n, str) ] return sat
def get_iridium_passes(utc_dt, lat_deg, lon_deg, elevation_m): stations_url = 'http://celestrak.com/NORAD/elements/iridium-NEXT.txt' satellites = load.tle(stations_url) passes = [] for sat in satellites: if "IRIDIUM" in str(sat): elevation = str(elevation_m).split(" ") ts = load.timescale() t = ts.utc(utc_dt) geocentric = satellites[sat].at(t) subpoint = geocentric.subpoint() team = Topos(lat_deg, lon_deg, elevation_m=float(elevation[0])) difference = satellites[sat] - team topocentric = difference.at(t) alt, az, distance = topocentric.altaz() if alt.degrees > 9: pass_details = { "sat": sat, "alt_deg": alt.degrees, "az_deg": az.degrees, "dist_km": distance.km } passes.append(pass_details) return passes
def get_sat_tles(geostationary=True): ''' Collect the satellite TLEs that fall in the L-Band. Parameters ---------- geostationary: boolean Include geostationary staellites or not. Returns ------- sats: dictionary Satellite TLEs ready for consumption by Skyfield. ''' source_url = 'https://www.celestrak.com/NORAD/elements/' gps_tles = ['gps-ops.txt', 'glo-ops.txt', 'beidou.txt', 'galileo.txt', 'sbas.txt', ] comms_tles = ['iridium.txt', 'iridium-NEXT.txt', 'geo.txt'] if geostationary: LbandSats = gps_tles + comms_tles else: LbandSats = gps_tles + comms_tles[:-1] sats = {} for i in range(len(LbandSats)): sats.update(load.tle(source_url+LbandSats[i])) return sats
def from_strings(cls, longitude: str or float, latitude: str or float, sat_name: str, tle_file: str) -> 'SatelliteObserver': place = Topos(latitude, longitude) satellites = load.tle(tle_file) #print("loaded {} sats from {}".format(len(satellites), tle_file)) _sats_by_name = {sat.name: sat for sat in satellites.values()} satellite = _sats_by_name[sat_name] return cls(place, satellite)
def __init__(self): self.path = os.path.dirname(os.path.abspath(__file__)) self.TLE = '/../active.txt' self.TLE_path = ''.join([self.path + self.TLE]) self.satellites = load.tle(self.TLE_path) self.satellite = self.satellites['LAPAN-A2'] self.test_string = "myfirststring" self.read_tle = read_tle()
def info(sat): pass_number = request.args.get('passnum') time_interval = float(request.args.get('interval')) sat_data = cache.get('passes').get_json() initial_t = sat_data['times'][int(pass_number)-1] initial_t_dt = datetime.strptime(initial_t, "A.D. %Y-%b-%d %H:%M:%S.%f UT") initial_t_dt = initial_t_dt.replace(tzinfo=utc) initial_t_sec = timegm(initial_t_dt.timetuple()) stations_url = 'http://celestrak.com/NORAD/elements/stations.txt' satellites = load.tle(stations_url, reload=True) satellite = satellites[str(sat)] ts = load.timescale() ground_station = Topos('30.287475 N', '97.735739 W') difference = satellite - ground_station t = ts.utc(initial_t_dt) topocentric = difference.at(t) el, az_check, distance = topocentric.altaz() elapse_time = 0 pass_time = [] state = [] sat_data1 = {} while el.degrees > 0 and elapse_time < (60*60*2): if elapse_time == 0: find_pass_end = initial_t_sec else: find_pass_end += time_interval find_pass_end_time = datetime.utcfromtimestamp(find_pass_end) find_pass_end_time = find_pass_end_time.replace(tzinfo=utc) t_check = ts.utc(find_pass_end_time) topocentric = difference.at(t_check) el, az, distance = topocentric.altaz() if el.degrees < 0: break pass_time.append(t_check.utc_jpl()) state.append({'azimuth' : str(az.degrees), 'elevation' : str(el.degrees)}) elapse_time += time_interval sat_data1.update({'spacecraft ' : sat, 'times' : pass_time, 'states' : state}) return jsonify(sat_data1)
def sattrack(satname): satellites = load.tle(stations_url) satellite = satellites[satname] geocentric = satellite.at(t) print(geocentric.position.km) subpoint = geocentric.subpoint() print('latitude: ', subpoint.latitude) print('longitude: ', subpoint.longitude) print('Elevation (m): ', int(subpoint.elevation.m))
def main(): parser = argparse.ArgumentParser() parser.add_argument("-v", "--verbose", help="increase output verbosity", action="count",default=0) parser.add_argument('antenna', help='antenna found in antennas.input', type=str) parser.add_argument('satellite', help='satellite or spacecraft name or ID number or "up"', type=str) parser.add_argument('time', help='start time of observations or "now" \\ yyyy-mm-ddTHH:MM:SS.S', type=str) parser.add_argument('-f','--file', help='input file for satellites', type=str, default=None) parser.add_argument('-p','--plot', help='plot output flag', action='count',default=0) parser.add_argument('-n','--tracks', help='number of tracks from start. n=0 indicates all', action='count',default=0) parser.add_argument('-L','--limit', help='antenna elevation limit', type=float,default=10.) parser.add_argument('-o','--outfile', help='output file for tracking', type=str,default='tle2azel') args = parser.parse_args() ### global ts # this is to prevent ut0-ut1 loading error ts = load.timescale(builtin=True) # identify the telescope amd parameters name, longi, lati, z, max_az, max_el = _match_antenna(args) try: ant_ = Topos(latitude=float(lati), longitude=float(longi), elevation_m=float(z)) except ValueError: ant_ = Topos(latitude=lati, longitude=longi, elevation_m=float(z)) # make a time scale for a 24hour period beginning at given time every 10sec t_r = _generate_times(args) # first want to load TLEs. If an input file is given, use that. Else look for default TLEs. if args.file!=None: satellite_tles = load.tle(args.file) else: satellite_tles = _download_satellite_file() # check if satellite id/name given, else print all UP at given time # match satellite name and create TLE object if args.satellite in ("0","up"): _which_satellite_up(args,ant_,satellite_tles) else: sat_ = _match_satellite(args,satellite_tles) # make track with skyfield.api track = (sat_ - ant_).at(ts.from_astropy(t_r)).altaz() t_jd, t_mjd, az, el, rng = _process_track(args,t_r,track) # print out this information into 2 files, HMI format and sattrack format _hmi_outprint(args, az, el, rng, t_mjd) _sattrakk_outprint(args, az, el, rng, t_jd) if args.plot>0: _plottrack(args,t_mjd,az,el) print('Processed track for {0:20s} starting {1:30s}'.format(sat_.name,args.time))
def epoch_es_viejo(satellite, t): days = t - satellite.epoch print('{:.3f} days away from epoch'.format(days)) # si la diferencia entre hoy y el epoch es mayor a 14 dias, # hay que recargar el TLE if abs(days) > 7: satellites = load.tle(stations_url, reload=True) satellite = satellites[satellite.model.satnum] return satellite
def readTLE(fileName='./india_tle.dat'): # tle referesh days refresh_days = 14 # current date and time ts = load.timescale(builtin=True) t = ts.now() days = 1 old_date = 0 # call create local tle function print("Creating new tle file") dict = getISROSatelliteList() saveTLE(dict, fileName) # load the new one satellites = load.tle(fileName) if abs(days) > refresh_days: # call create local tle function print("Creating new tle file") # backup old tle backupFilename = Path(fileName).stem + old_date + '.dat' os.rename(fileName, backupFilename) # get the new one dict = getISROSatelliteList() saveTLE(dict, fileName) # load the new one satellites = load.tle(fileName) # sats dictionary for easy search sats = {} for item in [satellites]: names = [key for key in item.keys()] for satname in names: sat = item[satname] satid = sat.model.satnum sats[satid] = sat sats[satname] = sat # return dictionary return sats
def get_sat_positions(time, path_to_tle, sat_name): """Returns arrays of lat,lon of satellite in given sets of 'time' time, delta_time, num_of_div, tle_path Parameters ---------- time : list List of times in skyfield.timescale format. path_to_tle : string Path to TLE file sat_name: string Name of satellite to be looked for. Returns ------- lat: array Latitudes in array lon: array Longitude in array alt: array Height of satellite in meters. rad: Local earth radius in meters. TODO: right now constant radius """ from skyfield.api import load import numpy as np satellites = load.tle(path_to_tle, reload=True) satellite = satellites[sat_name] t = time geocentric = satellite.at(t) subpoint = geocentric.subpoint() sign1, d1, m1, s1 = subpoint.latitude.signed_dms() lat = sign1 * (d1 + m1 / 60 + s1 / 3600) sign2, d2, m2, s2 = subpoint.longitude.signed_dms() lon = sign2 * (d2 + m2 / 60 + s2 / 3600) alt = subpoint.elevation.m # TODO: Find the way to get local earth radius and case when len(alt) == 1, if statement is blee earth_rad = [6371000 for i in np.atleast_1d(alt)] vis_circle_rad = [ satellite_basic(earth_rad[i], np.atleast_1d(alt)[i])[5] for i in range(len(np.atleast_1d(earth_rad))) ] if len(earth_rad) == 1: earth_rad = earth_rad[0] vis_circle_rad = vis_circle_rad[0] return lat, lon, alt, earth_rad, vis_circle_rad
def start(self): """ Dev: K4YT3X IZAYOI Date Created: Jan 15, 2018 Last Modified: Jan 16, 2018 Dev: Reimannsum Last Modified: Aug 27, 2019 This method is the main ISS pointer controller it runs infinitively until Ctrl^C is pressed. """ ts = load.timescale() stations_url = 'http://celestrak.com/NORAD/elements/stations.txt' satellites = load.tle(stations_url) satellite = satellites['ISS (ZARYA)'] observer = Topos('42.5337N', '83.7384W') while True: t = ts.now() days = t - satellite.epoch if abs(days) > 14: satellites = load.tle(stations_url, reload=True) satellite = satellites['ISS (ZARYA)'] difference = satellite - observer topocentric = difference.at(t) alt, az, distance = topocentric.altaz() # unless the radians would be more use useful elevation = alt.degrees # unless the radians would be more use useful direction = az.degrees Avalon.info("ISS Position Update:") print('Elevation :{}\nAzimuth :{}\n'.format(elevation, direction)) self.motor.set_azimuth(float(direction)) self.servo.set_angle(float(elevation)) time.sleep(5)
def __init__(self, master): self.master = master self.satellites = load.tle("https://celestrak.com/NORAD/elements/active.txt") self.zoom = 2 self.top = 0 self.left = 0 self.drawMap() self.centerX = 0 self.centerY = 0 self.width = 360 self.height = 170.102258 #self.vertScale = 1 #self.horScale = 1 self.zoomHistory = []
def loadMostRecentTle(satgroup='noaa', satellite=33591): '''LOADMOSTRECENTTLE Day-old TLE and UA Ground Station State''' ##NOAA 15 and UAGroundStation state information rooturl = 'http://www.celestrak.com/NORAD/elements/' satgroup_tle = rooturl + satgroup + '.txt' #Download TLE and declare ground station satellites = load.tle(satgroup_tle) chosensat = satellites[satellite] UAGroundStation = Topos('33.213271 N', '87.544696 W') #Check age of TLE uploaded timetype = load.timescale() t = timetype.now() dt_tle = t - chosensat.epoch print('{:.2f} days away from the last epoch observed.'.format(dt_tle)) #Update if older than a day if (abs(dt_tle) > 1.00): satellites = load.tle(satgroup_tle, reload=True) chosensat = satellites[satellite] dt_tle = t - chosensat.epoch print('Now {:.2f} days away from the last epoch observed.'.format( dt_tle)) return chosensat, UAGroundStation, timetype
def _download_satellite_file(): url = 'http://celestrak.com/NORAD/elements' satfiles= ['gps-ops.txt','gnss.txt','weather.txt','glo-ops.txt'] infile = 'satellites.input' ''' Check if satellite input file already exists, if not check if downloadable satellite file exists. If not download and append ''' if os.path.exists(infile): os.remove(infile) os.system('touch {0:}'.format(infile)) for sfile in satfiles: if not os.path.exists(sfile): os.popen('wget --output-document={1:s} {0:s}/{1:s}'.format(url,sfile)) os.system('cat {0:s} >> {1:s}'.format(sfile,infile)) else: os.system('cat {0:s} >> {1:s}'.format(sfile,infile)) return load.tle(infile)
def schedule(tle_file, satellite_name, pass_script): satellites = load.tle(tle_file, reload=True) if satellite_name in satellites: satellite = satellites[satellite_name] next_pass = get_next_pass(satellite, satellite_name) if next_pass[0] - 1 > 0: minutes_to_wait = next_pass[0] - 1 else: minutes_to_wait = 0 # Schedule the defined command to run on a pass os.system("{} | at now + {} minutes".format(pass_script, \ str(minutes_to_wait))) print("Scheduling success") else: print('Did not find {} in provided TLE'.format(satellite_name))
def __init__(self, satellite, station, doppler, rotator, tleUrl): self.sat = load.tle(tleUrl, reload=False)[satellite.name] self.station = Topos(station.lat, station.lon, elevation_m=station.alt) self.dopplerControllerRX = DopplerController(doppler.rxPort) if doppler.txPort is not None: self.dopplerControllerTX = DopplerController(doppler.txPort) else: self.dopplerControllerTX = None self.rotatorController = RotatorController( rotator.model, rotator.device) self.isConnected = False self.predict = Predict(self.sat, self.station) self.rxFreq = satellite.rxFreq self.txFreq = satellite.txFreq self.timescale = load.timescale(builtin=True)
def get_range_velocity(sat_name: str, obs_lat: float, obs_lon: float, time: datetime) -> typing.List[float]: ts = load.timescale() if isinstance(time, str): time = parse(time) time = time.replace(tzinfo=utc) time = ts.utc(time) if time is not None else ts.now() observer = Topos(obs_lat, obs_lon) stations_url = "http://celestrak.com/NORAD/elements/stations.txt" satellites = load.tle(stations_url) sat = satellites[sat_name] relative_position = (sat - observer).at(time) # sat_velocity = sat.at(tnow).velocity.km_per_s range_velocity = relative_position.velocity.km_per_s return range_velocity
def state_at_time(sat): state_time = request.args.get('state_time') state_dtime = datetime.strptime(state_time, "%Y-%m-%dT%H:%M:%SZ") #might want to use date time ISO format state_dtime = state_dtime.replace(tzinfo=utc) stations_url = 'http://celestrak.com/NORAD/elements/stations.txt' satellites = load.tle(stations_url, reload=True) satellite = satellites[str(sat)] ts = load.timescale() t = ts.utc(state_dtime) ground_station = Topos('30.287475 N', '97.735739 W') difference = satellite - ground_station topocentric = difference.at(t) el, az, distance = topocentric.altaz() if el.degrees > 0: visibility = True else: visibility = False sat_data = {'spacecraft ' : sat, 'times' : t.utc_jpl(), 'states' : {'azimuth' : str(az.degrees), 'elevation' : str(el.degrees)}} # sat_dict = {'Satellite' : sat, # 'Current Azimuth:' : str(az.degrees), # 'Current Elevation:': str(el.degrees), # 'Current Time (UTC):' : str(t.utc_jpl()), # 'Visible from Austin' : visibility} return jsonify(sat_data)
def closestSatTo_P(px, py, pz, when): stations_url = 'http://celestrak.com/NORAD/elements/iridium.txt' satellites = load.tle(stations_url, reload=True) t = when iridium = [] c = 0 k = False for sat in satellites: if k: iridium.append(satellites[sat]) c = c + 1 k = not k iridPos = [] irSubP = [] irLat = [] irLon = [] irAlt = [] for i in range(0, 32): iridPos.append(iridium[i].at(t)) for i in range(0, 32): irSubP.append(iridPos[i].subpoint()) for i in range(0, 32): # splitto latitudine tpLt = str(irSubP[i].latitude).split(' ') tpLg = str(irSubP[i].longitude).split(' ') deLat = str(tpLt[0]).split('d') prLat = str(tpLt[1])[:2] seLat = str(tpLt[2]).split('"') irLat.append( float(deLat[0]) + ((float(prLat)) / 60) + ((float(seLat[0])) / 3600)) deLon = str(tpLg[0]).split('d') prLon = str(tpLg[1])[:2] seLon = str(tpLg[2]).split('"') irLon.append( float(deLon[0]) + ((float(prLon)) / 60) + ((float(seLon[0])) / 3600)) irAlt.append(irSubP[i].elevation.m) tmpTr = [] xx = [] yy = [] zz = [] for i in range(0, 32): tmpTr.append(gps_to_ecef_pyproj(irLat[i], irLon[i], irAlt[i])) for i in range(0, 32): xx.append(round(tmpTr[i][0], 3)) yy.append(round(tmpTr[i][1], 3)) zz.append(round(tmpTr[i][2], 3)) vertices = [] for i in range(0, 32): vertices.append(iridium[i]) jump = True min = iridium[0] min_d = distance(px, py, pz, xx[0], yy[0], zz[0]) for i in range(0, 32): if not jump: tmp = distance(px, py, pz, xx[i], yy[i], zz[i]) if tmp < min_d: min = iridium[i] min_d = tmp jump = False return min
import os, sys, stat, re from skyfield.api import Topos, load from pwnlib.tubes.remote import remote from pwnlib.tubes.process import process from math import isclose if __name__ == "__main__": #Grab data from local text file for speed and consistency #-------------------------------------------# satellites = load.tle('stations.txt') #-------------------------------------------# #Kick off and connect to challenge.py #-------------------------------------------# Ticket = os.getenv("TICKET", "") #Host = os.getenv("HOST","") #Port = int(os.getenv("PORT","0")) Host = os.getenv("HOST", "172.17.0.1") Port = int(os.getenv("PORT", "31338")) conn = remote(Host, Port) if len(Ticket) > 0: conn.recvline() conn.send(Ticket + "\n") #-------------------------------------------# #Grab time and coordinates to find the satellite #-------------------------------------------# #print(f"Satellite time {satellite_time}")
from skyfield.api import load stations_url = 'http://celestrak.com/NORAD/elements/noaa.txt' satellites = load.tle(stations_url) noaa15 = satellites[25338] noaa18 = satellites[28654] noaa19 = satellites[33591] bluffton = Topos(nstopos, wetopos) difference = noaa15 - bluffton print('noaa15') print(difference) print('') print('') difference = noaa18 - bluffton print('noaa18') print(difference) print('') print('') difference = noaa19 - bluffton print('noaa19') print(difference)
from hsl_comm import Predict from skyfield.api import load, Topos from datetime import datetime, timedelta sat = load.tle('https://celestrak.com/NORAD/elements/active.txt')['DUCHIFAT-3'] station = Topos(latitude='32.1150 N', longitude='34.7820 E', elevation_m=13) predict = Predict(sat, station) ts = predict.timescale t = ts.now() t1 = ts.utc(t.utc_datetime() + timedelta(days=1)) tDateTime = t.utc_datetime() passes = predict.getNextPasses(t, t1) print(passes[0])
# print("excluded nodes ", excluded_nodes) nb = np.delete(nb, i) # print("nb dopo ", nb) size = size - 1 for i in range(0, nb.size): rl.append(nx.dijkstra_path(c_graph, iridium[nb[i]], iridium[dest_ind])) rl_weight.append( nx.dijkstra_path_length(c_graph, iridium[nb[i]], iridium[dest_ind])) return rl, rl_weight, nb ######################################################################################################################## print("\n#########################CgrExe") stations_url = 'http://celestrak.com/NORAD/elements/iridium.txt' satellites = load.tle(stations_url, reload=False) iridium = [] c = 0 k = False for sat in satellites: if k: iridium.append(satellites[sat]) c = c + 1 k = not k c_graph = nx.Graph() op = open("file.txt", "r") lines = op.readlines()