Exemple #1
0
 def __init__(self, auto_update=True,
              cache_dir='/tmp/gnss/',
              pull_orbit=True, dgps=False,
              valid_const=['GPS', 'GLONASS']):
   self.auto_update = auto_update
   self.orbits = {}
   self.nav = {}
   self.dcbs = {}
   self.cache_dir = cache_dir
   self.dgps = dgps
   self.dgps_delays = []
   self.bad_sats = []
   self.ionex_maps = []
   self.pull_orbit = pull_orbit
   self.cached_orbit = {}
   self.cached_nav = {}
   self.cached_dcb = {}
   self.cached_ionex = None
   self.cached_dgps = None
   self.valid_const = valid_const
   prns = sum([get_prns_from_constellation(const) for const in self.valid_const], [])
   for prn in prns:
     self.cached_nav[prn] = None
     self.cached_orbit[prn] = None
     self.cached_dcb[prn] = None
     self.orbits[prn] = []
     self.dcbs[prn] = []
     self.nav[prn] = []
Exemple #2
0
 def get_dcb_data(self, time):
   file_path_dcb = download_dcb(time, cache_dir=self.cache_dir)
   dcbs = parse_dcbs(file_path_dcb, self.valid_const)
   for dcb in dcbs:
     self.dcbs[dcb.prn].append(dcb)
   detected_prns = set([dcb.prn for dcb in dcbs])
   for constellation in self.valid_const:
     for prn in get_prns_from_constellation(constellation):
       if prn not in detected_prns and prn not in self.bad_sats:
         print ('No dcb data found for prn : %s flagging as bad' % prn )
         self.bad_sats.append(prn)
Exemple #3
0
  def get_orbit_data(self, time):
    file_paths_sp3_ru = download_orbits_russia(time, cache_dir=self.cache_dir)
    ephems_sp3_ru = parse_sp3_orbits(file_paths_sp3_ru, self.valid_const)
    file_paths_sp3_us = download_orbits(time, cache_dir=self.cache_dir)
    ephems_sp3_us = parse_sp3_orbits(file_paths_sp3_us, self.valid_const)
    ephems_sp3 = ephems_sp3_ru + ephems_sp3_us
    if len(ephems_sp3) < 5:
      raise RuntimeError('No orbit data found on either servers')

    for ephem in ephems_sp3:
      self.add_ephem(ephem, self.orbits)
    for constellation in self.valid_const:
      for prn in get_prns_from_constellation(constellation):
        closest = get_closest(time, self.orbits[prn])
        if ((closest is None) or ((closest is not None) and (not closest.valid(time)))) and (prn not in self.bad_sats):
          print ('No orbit data found for prn : %s flagging as bad' % prn )
          self.bad_sats.append(prn)
Exemple #4
0
 def get_nav_data(self, time):
   ephems_gps, ephems_glonass = [], []
   if 'GPS' in self.valid_const:
     file_path_gps = download_nav(time, cache_dir=self.cache_dir, constellation='GPS')
     if file_path_gps:
       ephems_gps = parse_rinex_nav_msg_gps(file_path_gps)
   if 'GLONASS' in self.valid_const:
     file_path_glonass = download_nav(time, cache_dir=self.cache_dir, constellation='GLONASS')
     if file_path_glonass:
        ephems_glonass = parse_rinex_nav_msg_glonass(file_path_glonass)
   for ephem in (ephems_gps + ephems_glonass):
     self.add_ephem(ephem, self.nav)
   detected_prns = set([e.prn for e in ephems_gps + ephems_glonass])
   for constellation in self.valid_const:
     for prn in get_prns_from_constellation(constellation):
       if prn not in detected_prns and prn not in self.bad_sats:
         print ('No nav data found for prn : %s flagging as bad' % prn)
         self.bad_sats.append(prn)
Exemple #5
0
    def get_orbit_data(self, time):
        file_paths_sp3 = download_orbits_russia(time, cache_dir=self.cache_dir)
        ephems_sp3 = parse_sp3_orbits(file_paths_sp3, self.valid_const)
        if len(ephems_sp3) < 5:
            print "Russian orbit data seems broken, using NASA's"
            file_paths_sp3 = download_orbits(time, cache_dir=self.cache_dir)
            ephems_sp3 = parse_sp3_orbits(file_paths_sp3, self.valid_const)
        if len(ephems_sp3) < 5:
            raise RuntimeError('No orbit data found on either servers')

        for ephem in ephems_sp3:
            self.add_ephem(ephem, self.orbits)
        detected_prns = set([e.prn for e in ephems_sp3])
        for constellation in self.valid_const:
            for prn in get_prns_from_constellation(constellation):
                if prn not in detected_prns and prn not in self.bad_sats:
                    print 'No orbit data found for prn : %s flagging as bad' % prn
                    self.bad_sats.append(prn)