def test_not_equal_aat(self): waypoints = self.aat.waypoints # test_unequal number_waypoints waypoints2 = deepcopy(waypoints) del waypoints2[2] aat2 = AAT(waypoints2, self.aat._t_min) self.assertNotEqual(self.aat, aat2) # test unequal t_min aat2 = AAT(waypoints, datetime.time(1, 0, 0)) self.assertNotEqual(self.aat, aat2)
def get_info_from_comment_lines(parsed_igc_file: dict, start_time_buffer: int = 0): lscsd_lines = list() lscsr_lines = list() lscsc_lines = list() for comment_record in parsed_igc_file['comment_records'][1]: line = 'L{}{}'.format(comment_record['source'], comment_record['comment']) if line.startswith('LSCSD'): lscsd_lines.append(line) elif line.startswith('LSCSC'): lscsc_lines.append(line) elif line.startswith('LSCSR'): lscsr_lines.append(line) task_information, competitor_information = get_task_and_competitor_info( lscsd_lines, lscsr_lines) waypoints = get_waypoints(lscsc_lines, task_information) aat = task_information['aat'] t_min = task_information.get('time_window', None) start_opening = task_information.get('gate_open', None) timezone = None # unclear where to get timezone information from strepla igc file if aat: task = AAT(waypoints, t_min, timezone, start_opening, start_time_buffer) else: task = RaceTask(waypoints, timezone, start_opening, start_time_buffer) return task, task_information, competitor_information
def get_info_from_comment_lines( parsed_igc_file: dict, start_time_buffer: int = 0) -> Tuple[Task, dict, dict]: """ There is specific contest information stored in the comment lines of the IGC files. This function extracts this information """ lcu_lines = list() lseeyou_lines = list() contest_information = dict() competitor_information = dict() comment_lines = get_comment_lines_from_parsed_file(parsed_igc_file) timezone = None t_min = None start_opening = None multi_start = False for line in comment_lines: if line.startswith('LCU::C'): lcu_lines.append(line) elif line.startswith('LSEEYOU OZ'): lseeyou_lines.append(line) elif line.startswith('LCU::HPGTYGLIDERTYPE:'): competitor_information['plane_model'] = line.split(':')[3] elif line.startswith('LCU::HPPLTPILOT:'): competitor_information['pilot_name'] = line.split(':')[3] elif line.startswith('LCU::HPCIDCOMPETITIONID:'): competitor_information['competition_id'] = line.split(':')[3] elif line.startswith('LCU::HPCCLCOMPETITIONCLASS:'): contest_information['competition_class'] = line.split(':')[3] elif line.startswith('LSEEYOU TSK'): start_opening, t_min, multi_start = get_task_rules(line) elif line.startswith('LCU::HPTZNTIMEZONE:'): timezone = int(line.split(':')[3]) if start_opening is not None: # convert start opening to UTC time start_opening = subtract_times(start_opening, datetime.time(hour=timezone)) waypoints = get_waypoints(lcu_lines, lseeyou_lines) if t_min is None: task = RaceTask(waypoints, timezone, start_opening, start_time_buffer, multi_start) else: task = AAT(waypoints, t_min, timezone, start_opening, start_time_buffer, multi_start) return task, contest_information, competitor_information