Ejemplo n.º 1
0
def calc_vtec(dog,
              rec_pos,
              measurement,
              ionh=IONOSPHERE_H,
              el_cut=0.30,
              n1=0,
              n2=0,
              rcvr_bias=0,
              sat_bias=0):
    """
    Given a receiver position and measurement from a specific sv
    this calculates the vertical TEC, and the point at which
    that TEC applies (between the sat and the rec)
    """
    if measurement is None:
        return None
    stec = calc_tec(measurement,
                    n1=n1,
                    n2=n2,
                    rcvr_bias=rcvr_bias,
                    sat_bias=sat_bias)
    if stec is None:
        return None
    if math.isnan(stec):
        return None

    if not measurement.processed:
        measurement.process(dog)
    el, az = helpers.get_el_az(rec_pos, measurement.sat_pos)
    # ignore things too low in the sky
    if el < el_cut or math.isnan(el):
        return None
    s_to_v = s_to_v_factor(el, ionh=ionh)
    return stec * s_to_v, ion_loc(rec_pos, measurement.sat_pos), s_to_v
Ejemplo n.º 2
0
    def filter_ticks(self, this_data):
        '''
        Starts with an assumed 'connection' of length zero at the first time point ('tick'). Runs through the list
        of ticks (integers) in increasing order. Skips ticks where the satelite elevation was too low. With each tick,
        judges whether the connection has 'dropped' either due to a) DISCONNECTION, or b) CYCLE_SLIP. If it has dropped,
        it stops counting and the connection is considered 'complete' (i.e. initialized).
        :param this_data:
        :return:
        '''
        if self.ticks is not None:
            return

        self.ticks = []
        last_seen = self.tick0
        last_mw = None
        for tick in range(self.tick0, self.tickn):
            if not this_data[tick]:
                continue

            if not contains_needed_info(this_data[tick]):
                continue

            # ignore "bad connections" (low elevation)
            if not this_data[tick].processed:
                if not this_data[tick].process(self.dog):
                    continue
            if not this_data[tick].corrected:
                this_data[tick].correct(self.loc, self.dog)
            el, _ = helpers.get_el_az(self.loc, this_data[tick].sat_pos)
            if el < EL_CUTOFF:
                continue

            # detect slips due to long disconnection time
            if tick - last_seen > DISCON_TIME:
                #                print("cycle slip: {0}-{1}@{2} exceeded discon time ({3})".format(
                #                    self.station, self.prn, tick, last_seen
                #                ))
                break
            last_seen = tick

            # detect cycle slips due to changing N_w
            mw, _ = tec.melbourne_wubbena(this_data[tick])
            if last_mw is not None and abs(last_mw - mw) > CYCLE_SLIP_CUTOFF:
                print("cycle slip: {0}-{1}@{2} jump of {3:0.2f}".format(
                    self.station, self.prn, tick, last_mw - mw))
                break
            last_mw = mw

            # all good
            self.ticks.append(tick)

        # Update the local property holding the first and last tick:
        if self.ticks:
            self.tick0 = self.ticks[0]
            self.tickn = self.ticks[-1]
        else:
            self.ticks = [tick]
            self.tick0 = tick
            self.tickn = tick
Ejemplo n.º 3
0
    def filter_ticks(self, this_data):
        if self.ticks is not None:
            return

        self.ticks = []
        last_seen = self.tick0
        last_mw = None
        for tick in range(self.tick0, self.tickn):
            if not this_data[tick]:
                continue

            if not contains_needed_info(this_data[tick]):
                continue

            # ignore "bad connections" (low elevation)
            if not this_data[tick].processed:
                if not this_data[tick].process(self.dog):
                    continue
            if not this_data[tick].corrected:
                this_data[tick].correct(self.loc, self.dog)
            el, _ = helpers.get_el_az(self.loc, this_data[tick].sat_pos)
            if el < EL_CUTOFF:
                continue

            # detect slips due to long disconnection time
            if tick - last_seen > DISCON_TIME:
                #                print("cycle slip: {0}-{1}@{2} exceeded discon time ({3})".format(
                #                    self.station, self.prn, tick, last_seen
                #                ))
                break
            last_seen = tick

            # detect cycle slips due to changing N_w
            mw, _ = tec.melbourne_wubbena(this_data[tick])
            if last_mw is not None and abs(last_mw - mw) > CYCLE_SLIP_CUTOFF:
                print("cycle slip: {0}-{1}@{2} jump of {3:0.2f}".format(
                    self.station, self.prn, tick, last_mw - mw))
                break
            last_mw = mw

            # all good
            self.ticks.append(tick)

        if self.ticks:
            self.tick0 = self.ticks[0]
            self.tickn = self.ticks[-1]
        else:
            self.ticks = [tick]
            self.tick0 = tick
            self.tickn = tick