Exemple #1
0
 def _timings(self):
     _retstr = ''
     _retstr += r'\section{Timings}' + '\n'
     _retstr += r'\begin{longtable}{ll}' + '\n'
     for timing in self.timings:
         _retstr += r'\textbf{{ {time} }} & {event}'.format(
             time=_el(
                 datetime.datetime.strptime(
                     timing['time'],
                     '%Y-%m-%dT%H:%M:%S').strftime('%H%M Z')),
             event=_el(timing['event'])) + r'\\' + '\n'
     _retstr += r'\end{longtable}'
     return _retstr
Exemple #2
0
 def _chatlog(self):
     _retstr = ''
     _retstr += r'\section{Chat Log}' + '\n'
     _retstr += r'\begin{longtable}{lll}' + '\n'
     for message in self.chatlog:
         _retstr += r'{time} & \textbf{{ {user} }} & '.format(
             time=message[0].strftime('%H%M.%S'),
             user=_el(message[1]),
         )
         _retstr += r'\begin{minipage}{100mm}'
         _retstr += _el(message[2])
         _retstr += r'\end{minipage}\\[.3cm]' + '\n'
     _retstr += r'\end{longtable}' + '\n'
     return _retstr
Exemple #3
0
    def _crew(self):
        _retstr = ''
        _retstr += r'\section{Crew}' + '\n'
        _retstr += r'\begin{longtable}{ll}' + '\n'

        for member in self.crewlist:
            _retstr += '{role} & {name} ({institute})'.format(
                role=_el(member['role']),
                name=_el(member['name']),
                institute=_el(member['institute']))
            _retstr += r'\\' + '\n'

        _retstr += r'\end{longtable}' + '\n'

        return _retstr
Exemple #4
0
    def _appendix(self):
        if not self.flight_folder:
            return ''

        cwd = os.getcwd()
        outputs = []
        text_files = []
        for _root, _dirs, _files in os.walk(self.flight_folder):
            for _file in _files:
                if ' ' in _file:
                    shutil.move(os.path.join(_root, _file),
                                os.path.join(_root, _file.replace(' ', '_')))
                    _file = _file.replace(' ', '_')

                _filepath = os.path.join(_root, _file)

                if _file[-3:].lower() in ['png', 'jpg']:
                    outputs.append(_filepath)

                if _file[-3:].lower() == 'txt':
                    if _file.lower().startswith(
                            'ms') and 'log' in _file.lower():
                        text_files.append(_filepath)
                    if 'wx' in _file.lower():
                        text_files.append(_filepath)

        _retstr = r'\section{Appendix}'

        for _txt in sorted(text_files):
            _retstr += r'\subsection{' + _el(
                os.path.basename(_txt)) + r'}' + '\n'
            with open(_txt, 'r') as f:
                _retstr += _el(f.read())

        _retstr += r'\subsection{Flight Folder Images}' + '\n'
        for _op in sorted(outputs):
            _retstr += r'\begin{center}' + '\n'
            _retstr += r'\begin{figure}' + '\n'
            _retstr += r'\includegraphics[width=.8\pagewidth]{' + _op + '}\n'
            _retstr += r'\caption{' + _el(os.path.basename(_op)) + '}\n'
            _retstr += r'\end{figure}' + '\n'
            _retstr += r'\end{center}' + '\n'

        return _retstr
Exemple #5
0
    def _flight_summary(self):
        _retstr = r'\begin{landscape}'
        _retstr += r'\section{Flight Summary}' + '\n'
        _retstr += r'{\scriptsize' + '\n'
        _retstr += r'\begin{longtable}{llllllllllll}' + '\n'

        _retstr += r'\hline' + '\n'
        _retstr += (r'Event & Start & Start lat & Start lon & Start alt & '
                    r'Start hdg & End & End lat & End lon & End alt & '
                    r'End hdg & Comment \\') + '\n'
        _retstr += r'\hline' + '\n'

        for evt in self.summary:
            _evt = evt['fields']

            for key, val in _evt.items():
                if val is None:
                    _evt[key] = ''

            _str = r'{evt} & {stime} & {slat:0.2f} & {slon:0.2f} & {salt} & {shdg} & '
            if _evt['stop_time']:
                _str += r'{etime} & {elat:0.2f} & {elon:0.2f} & {ealt} & {ehdg} & '
            else:
                _str += r'{etime} & {elat} & {elon} & {ealt} & {ehdg} &'
            _str += r'{comment}\\' + '\n'

            _retstr += _str.format(evt=_el(_evt['event']),
                                   stime=_el(_evt['start_time'][-8:]),
                                   slat=_evt['start_lat'],
                                   slon=_evt['start_lon'],
                                   salt=_evt['start_alt'],
                                   shdg=_evt['start_heading'],
                                   etime=_el(_evt['stop_time'][-8:]),
                                   elat=_evt['stop_lat'],
                                   elon=_evt['stop_lon'],
                                   ealt=_evt['stop_alt'],
                                   ehdg=_evt['stop_heading'],
                                   comment=_el(_evt['comment']))
        _retstr += '\n'
        _retstr += r'\end{longtable}' + '\n'
        _retstr += r'}'
        _retstr += r'\end{landscape}'
        return _retstr