Exemplo n.º 1
0
def create_angular_separation_report(base_output_dir, tz, start_day, end_day,
                                     data):
    ground_station = GroundStation.from_config(data.get('ground_station', []))
    sat_of_interest = SatelliteTle.from_config(
        data.get('satellite_of_interest', []))

    other_sats = []
    other_sats_data = data.get('other_satellites', [])
    for sat in other_sats_data:
        other_sats.append(SatelliteTle.from_config(sat))

    asrg = AngularSeparationReportGenerator(base_output_dir, ground_station,
                                            sat_of_interest, other_sats, tz,
                                            start_day, end_day)
    asrg.generate_report()
Exemplo n.º 2
0
def create_az_el_range_report(base_output_dir, tz, start_day, end_day, data):
    ground_station = GroundStation.from_config(data.get('ground_station', []))
    sat_of_interest = SatelliteTle.from_config(data.get('satellite', []))
    # sys.stderr.write(sat_of_interest.__repr__() + "\n") # debug
    time_step_seconds = Configuration.get_config_float(
        data.get('time_step_seconds', '15'), 1, 600, 15)
    aerg = AzElRangeReportGenerator(base_output_dir, ground_station, 0,
                                    sat_of_interest, tz, start_day, end_day,
                                    time_step_seconds)
    aerg.generate_report()
Exemplo n.º 3
0
def create_satellite_overflight_report(base_output_dir, tz, data):
    sat_tle = SatelliteTle.from_config(data.get('satellite', []))
    ground_station = GroundStation.from_config(data.get('ground_station', []))
    common_sat_name = data.get('common_satellite_name',
                               sat_tle.get_satellite_name())
    common_gs_name = data.get('common_ground_station_name',
                              ground_station.get_name())
    sorg = SatelliteOverflightReportGenerator(base_output_dir, sat_tle,
                                              ground_station, tz,
                                              common_sat_name, common_gs_name)
    sorg.generate_report()
Exemplo n.º 4
0
def create_satellite_html_report(base_output_dir, tz, inviews, contacts, insun,
                                 start_day, end_day, time_step_seconds, data):

    sat_tle = SatelliteTle.from_config(data.get('satellite', []))

    ground_station_list = []
    gs_list = data.get('ground_stations', [])
    for gs in gs_list:
        ground_station_list.append(GroundStation.from_config(gs))

    aer_days = Configuration.get_config_int(data.get('num_aer_days', '0'), 0,
                                            10, 0)

    shrg = SatelliteHtmlReportGenerator(base_output_dir, sat_tle, ground_station_list, tz, inviews, contacts, insun, aer_days, \
            start_day, end_day, time_step_seconds)
    shrg.generate_report()
Exemplo n.º 5
0
def create_ground_station_html_report(base_output_dir, tz, inviews, start_day,
                                      end_day, data):
    ground_station = GroundStation.from_config(data.get('ground_station', []))

    sat_list = []
    sat_data_list = data.get('satellites', [])
    for sat in sat_data_list:
        sat_list.append(SatelliteTle.from_config(sat))

    aer_days = Configuration.get_config_int(data.get('num_aer_days', '0'), 0,
                                            10, 0)

    gshrg = GroundStationHtmlReportGenerator(base_output_dir, ground_station,
                                             sat_list, tz, inviews, aer_days,
                                             start_day, end_day)
    gshrg.generate_report()
Exemplo n.º 6
0
def main():
    """Main function... makes 'forward declarations' of helper functions unnecessary"""
    conf_file = "config/sat_html_report.config"
    if (len(sys.argv) > 1):
        conf_file = sys.argv[1]
    #sys.stderr.write("conf_file: %s\n" % conf_file)

    with open(conf_file) as json_data_file:
        data = json.load(json_data_file)

    #base_output_dir = Configuration.get_config_directory(data.get('base_output_directory',tempfile.gettempdir()))
    tz = Configuration.get_config_timezone(data.get('timezone', 'US/Eastern'))
    inviews = Configuration.get_config_boolean(data.get('inviews', 'false'))
    contacts = Configuration.get_config_boolean(data.get('contacts', 'false'))
    insun = Configuration.get_config_boolean(data.get('insun', 'false'))
    start_day = Configuration.get_config_int(data.get('start_day', '0'), -180,
                                             180, 0)
    end_day = Configuration.get_config_int(data.get('end_day', '0'), -180, 180,
                                           0)
    time_step_seconds = Configuration.get_config_float(
        data.get('time_step_seconds', '15'), 1, 600, 15)
    sat_tle = SatelliteTle.from_config(data.get('satellite', []))
    ground_station = GroundStation.from_config(data.get('ground_station', []))

    # Determine the time range for the requested day
    day_date = datetime.now() + timedelta(days=start_day)
    day_year = day_date.year
    day_month = day_date.month
    day_day = day_date.day
    start_time = tz.localize(datetime(day_year, day_month, day_day, 0, 0, 0))
    end_time = tz.localize(datetime(day_year, day_month, day_day, 23, 59, 59))

    # Get the InviewCalculator and compute the inviews
    base_ic = InviewCalculator(ground_station, sat_tle)
    base_inviews = []
    base_inviews = base_ic.compute_inviews(start_time, end_time)
    for iv in base_inviews:
        print(iv)  # debug
        start_time = iv[0].astimezone(tz)
        end_time = iv[1].astimezone(tz)
        azels = base_ic.compute_azels(iv[0], iv[1], time_step_seconds)
        for azel in azels:
            #print("      %s, %7.2f,    %6.2f,   %7.1f\n" % (azel[0].astimezone(tz), azel[1], azel[2], azel[3])) # convert to specified time zone
            print("      %s, %7.2f,    %6.2f,   %7.1f" %
                  (azel[0].astimezone(tz), azel[1], azel[2],
                   azel[3]))  # convert to specified time zone
Exemplo n.º 7
0
def create_azel_cmd_telemetry_report(tz, tlmfile, cmdfile, pngfile, data):
    satnum = data.get('satellite', [])['number']
    ground_station = GroundStation.from_config(data.get('ground_station', []))
    tle = SatelliteTle.from_config(data.get('satellite', []))
    show_track = Configuration.get_config_boolean(
        data.get('show_track', 'false'))

    aer = AzElRangeReportGenerator("",
                                   ground_station,
                                   1,
                                   tle,
                                   tz,
                                   0,
                                   time_step_seconds=15)
    (fig, ax) = aer.create_polar_fig_and_ax()
    aer.generate_azelrange_plot_groundconstraints(ax)

    satdata = {}
    tlmdata = {}
    if (tlmfile is not None):
        process_telem_file(tlmfile, tz, satnum, ground_station, data, satdata,
                           tlmdata)

    hidata = {}
    lowdata = {}
    cleardata = {}
    nre = {}
    if (cmdfile is not None):
        hidata = process_cmd_file(cmdfile, tz, satnum, ground_station, data,
                                  satdata,
                                  re.compile("CADET_FIFO_REQUEST.*FLAGS [1H]"),
                                  True)
        lowdata = process_cmd_file(
            cmdfile, tz, satnum, ground_station, data, satdata,
            re.compile("CADET_FIFO_REQUEST.*FLAGS [^1H]"), True)
        cleardata = process_cmd_file(cmdfile, tz, satnum, ground_station,
                                     data, satdata,
                                     re.compile("CADET_FIFO_CLEAR"), True)
        nre = process_cmd_file(cmdfile, tz, satnum, ground_station, data,
                               satdata, re.compile("CADET_FIFO"), False)

    if (show_track):
        for j in satdata.keys():
            d = satdata[j]
            for i in range(len(d.plotinviews)):
                if (d.plotinviews[i]):
                    icazels = d.inview_computer.compute_azels(
                        d.inviews[i][0], d.inviews[i][1], 15)
                    aer.generate_azelrange_plot_track(
                        ax, "%s %s" % (tle.get_satellite_name(), j), icazels,
                        4)  # Hardwire every 4

    for i in tlmdata.keys():
        aer.generate_azelrange_plot_points(ax, "Telemetry", "#00FF00",
                                           tlmdata[i])
    for i in cleardata.keys():
        aer.generate_azelrange_plot_points(ax, "Clear Data Cmd", "#FF0000",
                                           cleardata[i])
    for i in hidata.keys():
        aer.generate_azelrange_plot_points(ax, "High Data Request", "#0000FF",
                                           hidata[i])
    for i in lowdata.keys():
        aer.generate_azelrange_plot_points(ax, "Low Data Request", "#9900FF",
                                           lowdata[i])
    for i in nre.keys():
        aer.generate_azelrange_plot_points(ax, "NRE Cmd", "#FF6600", nre[i])

    ax.legend(loc=1, bbox_to_anchor=(1.12, 1.12))
    plt.figure(1)
    plt.savefig(pngfile)
Exemplo n.º 8
0
def create_inview_list_report(base_output_dir, tz, start_day, end_day, data):
    sat_tle = SatelliteTle.from_config(data.get('satellite', []))
    ground_station = GroundStation.from_config(data.get('ground_station', []))
    ilrg = InviewListReportGenerator(base_output_dir, sat_tle, ground_station,
                                     tz, start_day, end_day)
    ilrg.generate_report()