def _trigger_func(self, stream_id):

        sine_ampl = 2.0 # Amplitude in both directions
        samples = 60
        sine_curr_deg = 0 # varies from 0 - 360

        startTime = time.time()
        count = samples #something other than zero

        while True:
            count = time.time() - startTime
            sine_curr_deg = (count % samples) * 360 / samples

            c = [sine_ampl * math.sin(math.radians(sine_curr_deg))]
            t = [sine_ampl * 2 * math.sin(math.radians(sine_curr_deg + 45))]
            p = [sine_ampl * 4 * math.sin(math.radians(sine_curr_deg + 60))]

            lat = lon = [0.0]
            tvar = [time.time()]

            ctd_packet = ctd_stream_packet(stream_id=stream_id,
                c=c, t=t, p = p, lat = lat, lon = lon, time=tvar)

            log.info('SinusoidalCtdPublisher sending 1 record!')
            self.publisher.publish(ctd_packet)

            time.sleep(1.0)
    def _get_ctd_packet(self, stream_id, length):

        c = [random.uniform(0.0, 75.0) for i in xrange(length)]

        t = [random.uniform(-1.7, 21.0) for i in xrange(length)]

        p = [random.lognormvariate(1, 2) for i in xrange(length)]

        lat = [random.uniform(-90.0, 90.0) for i in xrange(length)]

        lon = [random.uniform(0.0, 360.0) for i in xrange(length)]

        tvar = [self.last_time + i for i in xrange(1, length + 1)]

        self.last_time = max(tvar)

        ctd_packet = ctd_stream_packet(stream_id=stream_id,
                                       c=c,
                                       t=t,
                                       p=p,
                                       lat=lat,
                                       lon=lon,
                                       time=tvar)

        return ctd_packet
Esempio n. 3
0
    def _trigger_func(self, stream_id):

        sine_ampl = 2.0  # Amplitude in both directions
        samples = 60
        sine_curr_deg = 0  # varies from 0 - 360

        startTime = time.time()
        count = samples  #something other than zero

        while True:
            count = time.time() - startTime
            sine_curr_deg = (count % samples) * 360 / samples

            c = [sine_ampl * math.sin(math.radians(sine_curr_deg))]
            t = [sine_ampl * 2 * math.sin(math.radians(sine_curr_deg + 45))]
            p = [sine_ampl * 4 * math.sin(math.radians(sine_curr_deg + 60))]

            lat = lon = [0.0]
            tvar = [time.time()]

            ctd_packet = ctd_stream_packet(stream_id=stream_id,
                                           c=c,
                                           t=t,
                                           p=p,
                                           lat=lat,
                                           lon=lon,
                                           time=tvar)

            log.info('SinusoidalCtdPublisher sending 1 record!')
            self.publisher.publish(ctd_packet)

            time.sleep(2.0)
    def _get_ctd_packet(self, stream_id, length):

        c = [random.uniform(0.0,75.0)  for i in xrange(length)]

        t = [random.uniform(-1.7, 21.0) for i in xrange(length)]

        p = [random.lognormvariate(1,2) for i in xrange(length)]

        lat = [random.uniform(-90.0, 90.0) for i in xrange(length)]

        lon = [random.uniform(0.0, 360.0) for i in xrange(length)]

        tvar = [self.last_time + i for i in xrange(1,length+1)]

        self.last_time = max(tvar)

        ctd_packet = ctd_stream_packet(stream_id=stream_id,
            c=c, t=t, p=p, lat=lat, lon=lon, time=tvar)

        return ctd_packet
Esempio n. 5
0
 def _generate_point(self, entropy=5):
     points = []
     random_values = self._random_data(entropy)
     point = ctd_stream_packet(stream_id='test_data', p=random_values[0], c=random_values[1], t=random_values[2],time=random_values[3], lat=random_values[4], lon=random_values[5], create_hdf=False)
     return point