Esempio n. 1
0
    def read_igc(self, competition_day, soaring_spot_info):
        f = open(soaring_spot_info.igc_directory + self.file_name, "U")  # U extension is a necessity for cross compatibility!
        full_file = f.readlines()
        f.close()

        if len(competition_day.LCU_lines) != 0:
            competition_day.task_found = True

        for line in full_file:

            if line.startswith('B'):
                if len(self.b_records) == 0 or (len(self.b_records) > 0 and self.b_records[-1][0:7] != line[0:7]):
                    self.b_records.append(line)
                    continue

            if line.startswith('I'):
                no_extensions = int(line[1:3])
                i_record_byte = 3
                for extension_number in range(no_extensions):
                    extension_name = line[i_record_byte+4: i_record_byte+7]
                    extension_start_byte = int(line[i_record_byte:i_record_byte+2])
                    extension_end_byte = int(line[i_record_byte+2:i_record_byte+4])
                    i_record_byte += 7

                    if extension_name == 'ENL':
                        self.ENL = True
                        self.ENL_indices = [extension_start_byte, extension_end_byte]

            if line.startswith('LCU::HPGTYGLIDERTYPE:'):
                self.airplane = line[21:-1]
                continue

            if line.startswith('LCU::HPCIDCOMPETITIONID:'):
                self.competition_id = line[24:-1]
                continue

            if line.startswith('LSEEYOU TSK'):

                tsk_split = line.split(',')
                for task_element in tsk_split:
                    if task_element.startswith('TaskTime') and not hasattr(competition_day, 't_min'):
                        competition_day.t_min = hhmmss2ss(task_element[9::], 0)  # asuming no UTC offset
                        competition_day.aat = True  # Default is False
                    if task_element.startswith('NoStart') and competition_day.start_opening == hhmmss2ss("09:00:00", 0):
                        competition_day.start_opening = hhmmss2ss(task_element[8::], 0)  # time in local time, not UTC
                    if task_element.startswith('MultiStart=True'):
                        competition_day.multi_start = True
                continue

            if not competition_day.task_found:
                if line.startswith('LCU::C'):
                    competition_day.LCU_lines.append(line)
                if line.startswith('LSEEYOU OZ='):
                    competition_day.LSEEYOU_lines.append(line)
                if line.startswith('LCU::HPTZNTIMEZONE:'):
                    competition_day.utc_to_local = int(line[19:-1])
Esempio n. 2
0
    def __init__(self):
        self.flights = []
        self.file_paths = []

        self.task = []
        self.LCU_lines = []
        self.LSEEYOU_lines = []
        self.task_distances = []

        self.task_date = ""

        self.no_tps = 0
        self.no_legs = 0

        self.aat = False
        self.multi_start = False
        self.task_found = False
        self.start_opening = hhmmss2ss("09:00:00", 0)
Esempio n. 3
0
    def __init__(self):
        self.flights = []
        self.file_paths = []

        self.task = []
        self.LCU_lines = []
        self.LSEEYOU_lines = []
        self.task_distances = []

        self.task_date = ""

        self.no_tps = 0
        self.no_legs = 0

        self.aat = False
        self.multi_start = False
        self.task_found = False
        self.start_opening = hhmmss2ss("09:00:00", 0)
Esempio n. 4
0
    def read_igc(self, competition_day, soaring_spot_info):
        f = open(soaring_spot_info.igc_directory + self.file_name,
                 "U")  # U extension is a necessity for cross compatibility!
        full_file = f.readlines()
        f.close()

        if len(competition_day.LCU_lines) != 0:
            competition_day.task_found = True

        for line in full_file:

            if line.startswith('B'):
                if len(self.b_records) == 0 or (
                        len(self.b_records) > 0
                        and self.b_records[-1][0:7] != line[0:7]):
                    self.b_records.append(line)
                    continue

            if line.startswith('I'):
                no_extensions = int(line[1:3])
                i_record_byte = 3
                for extension_number in range(no_extensions):
                    extension_name = line[i_record_byte + 4:i_record_byte + 7]
                    extension_start_byte = int(
                        line[i_record_byte:i_record_byte + 2])
                    extension_end_byte = int(line[i_record_byte +
                                                  2:i_record_byte + 4])
                    i_record_byte += 7

                    if extension_name == 'ENL':
                        self.ENL = True
                        self.ENL_indices = [
                            extension_start_byte, extension_end_byte
                        ]

            if line.startswith('LCU::HPGTYGLIDERTYPE:'):
                self.airplane = line[21:-1]
                continue

            if line.startswith('LCU::HPCIDCOMPETITIONID:'):
                self.competition_id = line[24:-1]
                continue

            if line.startswith('LSEEYOU TSK'):

                tsk_split = line.split(',')
                for task_element in tsk_split:
                    if task_element.startswith('TaskTime') and not hasattr(
                            competition_day, 't_min'):
                        competition_day.t_min = hhmmss2ss(
                            task_element[9::], 0)  # asuming no UTC offset
                        competition_day.aat = True  # Default is False
                    if task_element.startswith(
                            'NoStart'
                    ) and competition_day.start_opening == hhmmss2ss(
                            "09:00:00", 0):
                        competition_day.start_opening = hhmmss2ss(
                            task_element[8::],
                            0)  # time in local time, not UTC
                    if task_element.startswith('MultiStart=True'):
                        competition_day.multi_start = True
                continue

            if not competition_day.task_found:
                if line.startswith('LCU::C'):
                    competition_day.LCU_lines.append(line)
                if line.startswith('LSEEYOU OZ='):
                    competition_day.LSEEYOU_lines.append(line)
                if line.startswith('LCU::HPTZNTIMEZONE:'):
                    competition_day.utc_to_local = int(line[19:-1])