glonass.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pyrsss 作者: butala 项目源码 文件源码
def __init__(self, glo_status_fname=GLO_STATUS_FNAME):
        """
        Parse *glo_status_fname* and store GLONASS status information.
        """
        super(GLONASS_Status, self).__init__()
        if glo_status_fname == GLO_STATUS_FNAME and not os.path.isfile(glo_status_fname):
            update_glo_status()
        def parse_dt(date, time):
            if date == '0000-00-00' and time == '00:00':
                return None
            else:
                return datetime.strptime(date + ' ' + time,
                                         '%Y-%m-%d %H:%M')
        with open(glo_status_fname) as fid:
            for line in fid:
                if line.startswith('#'):
                    continue
                toks = line.split()
                launch_dt = parse_dt(toks[0], toks[1])
                start_dt = parse_dt(toks[2], toks[3])
                end_dt = parse_dt(toks[4], toks[5])
                slot, freq, plane, GLONASS, cosmos = map(int, toks[6:])
                interval = DateTimeInterval.closed_open(start_dt, end_dt)
                info = StatusInfo(launch_dt, slot, freq, plane, GLONASS, cosmos)
                self.setdefault(slot, OrderedDict())[interval] = info
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号