def list(cls): self = cls() if not hasattr(self, "_stations"): self._stations = {} for abbr, charact in ws.config["stations"].items(): charact["parent_frame"] = get_frame(charact["parent_frame"]) full_name = charact.pop("name") mask = charact.get("mask") if mask: # reverse direction of the mask to put it in counterclockwise # to comply with the mathematical definition charact["mask"] = ( (2 * pi - radians(mask["azims"][::-1])), radians(mask["elevs"][::-1]), ) # Deletion of all unknown characteristics from the charact dict # and conversion to object attributes (they may be used by addons) extra_charact = {} for key in list(charact.keys()): if key not in ("parent_frame", "latlonalt", "mask"): extra_charact[key] = charact.pop(key) self._stations[abbr] = create_station(abbr, **charact) self._stations[abbr].abbr = abbr self._stations[abbr].full_name = full_name for key, value in extra_charact.items(): setattr(self._stations[abbr], key, value) return self._stations
def next_3_passes(files, curr_day, curr_month, curr_year, curr_hour, curr_minute, curr_second, curr_microsecond, station_name, lat, lon, height): AOS_time_list = list() MAX_elev_list = list() LOS_time_list = list() with open(os.path.join(TLE_source_path, files), 'r') as f: data = f.readlines() tle = Tle(data) station = create_station(station_name, (lat, lon, height)) azims, elevs = [], [] #sadf from datetime import datetime starttime = Date( datetime(int(curr_year), int(curr_month), int(curr_day), int(curr_hour), int(curr_second))) q = 0 #print(" Time Azim Elev Distance Radial Velocity") #print("=========================================================") for orb in station.visibility(tle.orbit(), start=starttime, stop=timedelta(days=1), step=timedelta(minutes=2), events=True): #azim = -np.degrees(orb.theta) % 360 elev = np.degrees(orb.phi) #elevs.append(90 - elev) #asdf r = orb.r / 1000. #print("{event:7} {orb.date:%H:%M:%S} {azim:7.2f} {elev:7.2f} {r:10.2f} {orb.r_dot:10.2f}".format(orb=orb, r=r, azim=azim, elev=elev, event=orb.event.info if orb.event is not None else "")) if orb.event and orb.event.info == "AOS": AOS_time = str(orb.date)[:-4] + 'Z' AOS_time_list.append(AOS_time) q = q + 1 if orb.event and orb.event.info == "MAX": MAX_elev = str(round(elev, 4)) MAX_elev_list.append(MAX_elev) if orb.event and orb.event.info == "LOS": LOS_time = str(orb.date)[:-4] + 'Z' LOS_time_list.append(LOS_time) if q == 10: break more_AOS = True if len(AOS_time_list) > len(LOS_time_list): while more_AOS: AOS_time_list = AOS_time_list[:-1] q = q - 1 if not len(AOS_time_list) > len(LOS_time_list): more_AOS = False print(len(AOS_time_list), ' access events calculated') return AOS_time_list, MAX_elev_list, LOS_time_list, q
import sys import numpy as np import matplotlib.pyplot as plt from beyond.dates import Date, timedelta from beyond.orbits import Tle from beyond.frames import create_station from beyond.config import config tle = Tle("""ISS (ZARYA) 1 25544U 98067A 16086.49419020 .00003976 00000-0 66962-4 0 9998 2 25544 51.6423 110.4590 0001967 0.7896 153.8407 15.54256299992114""").orbit() # Station definition station = create_station('TLS', (43.428889, 1.497778, 178.0)) azims, elevs = [], [] print(" Time Azim Elev Distance Radial Velocity") print("=========================================================") for orb in station.visibility(tle, start=Date.now(), stop=timedelta(hours=24), step=timedelta(seconds=30), events=True): elev = np.degrees(orb.phi) # Radians are counterclockwise and azimuth is clockwise azim = np.degrees(-orb.theta) % 360 # Archive for plotting azims.append(azim) # Matplotlib actually force 0 to be at the center of the polar plot, # so we trick it by inverting the values elevs.append(90 - elev)
import sys import numpy as np import matplotlib.pyplot as plt from beyond.dates import Date, timedelta from beyond.io.tle import Tle from beyond.frames import create_station from beyond.config import config tle = Tle("""ISS (ZARYA) 1 25544U 98067A 16086.49419020 .00003976 00000-0 66962-4 0 9998 2 25544 51.6423 110.4590 0001967 0.7896 153.8407 15.54256299992114""" ).orbit() # Station definition station = create_station('TLS', (43.428889, 1.497778, 178.0)) azims, elevs = [], [] print(" Time Azim Elev Distance Radial Velocity") print("=========================================================") for orb in station.visibility(tle, start=Date.now(), stop=timedelta(hours=24), step=timedelta(seconds=30), events=True): elev = np.degrees(orb.phi) # Radians are counterclockwise and azimuth is clockwise azim = np.degrees(-orb.theta) % 360 # Archive for plotting
sites = read_site_file(args.SITEFILE) if not args.site in sites.keys(): print("ERROR: Site {} not found in {}.".format(args.site, args.SITEFILE)) sys.exit(-1) site = sites[args.site] tle, name = tle_from_file(args.TLEFILE) orbit = tle.orbit() # Station definition station = create_station( site['symbol'], (site['latitude'].to(u.deg).value, site['longitude'].to( u.deg).value, site['altitude'].to(u.m).value)) starttime = datetime.strptime(args.starttime, '%Y-%m-%dT%H:%M:%S') pass_data = { 'azims': [], 'elevs': [], 'date': [], 'r': [], 'r_dot': [], 'event': [] } print(" Time Azim Elev Distance Radial Velocity") print("=========================================================")