@@ -0,0 +1,2501 @@
+#!/usr/bin/env python%0A%0A'''%0A@author David Stuebe %3Cdstuebe@asascience.com%3E%0A@file ion/processes/data/ctd_stream_publisher.py%0A@description A simple example process which publishes prototype ctd data%0A%0ATo Run:%0Abin/pycc --rel res/deploy/r2dm.yml%0A### In the shell...%0A%0A# create a stream id and pass it in...%0Afrom interface.services.dm.ipubsub_management_service import PubsubManagementServiceClient%0Apmsc = PubsubManagementServiceClient(node=cc.node)%0Astream_id = pmsc.create_stream(name='pfoo')%0Apid = cc.spawn_process(name='ctd_test',module='ion.processes.data.ctd_stream_publisher',cls='SimpleCtdPublisher',config=%7B'process':%7B'stream_id':stream_id%7D%7D)%0A%0A%0AOR...%0A%0A# just let the simple ctd publisher create it on its own for simple cases...%0Acc.spawn_process(name=%22viz_data_realtime%22, module=%22ion.processes.data.ctd_stream_publisher%22, cls=%22SimpleCtdPublisher%22)%0A'''%0Afrom gevent.greenlet import Greenlet%0Afrom pyon.ion.endpoint import StreamPublisherRegistrar%0Afrom pyon.ion.process import StandaloneProcess%0Afrom pyon.public import log%0A%0Aimport time%0Afrom uuid import uuid4%0Aimport random%0Aimport math%0A%0Afrom prototype.sci_data.stream_defs import ctd_stream_packet, SBE37_CDM_stream_definition, ctd_stream_definition%0Afrom prototype.sci_data.constructor_apis import PointSupplementConstructor%0A%0Afrom interface.services.dm.ipubsub_management_service import PubsubManagementServiceClient%0Afrom ion.processes.data.ctd_stream_publisher import SimpleCtdPublisher%0A%0Aclass SinusoidalCtdPublisher(SimpleCtdPublisher):%0A    def __init__(self, *args, **kwargs):%0A        super(SinusoidalCtdPublisher, self).__init__(*args,**kwargs)%0A        #@todo Init stuff%0A%0A%0A    def _trigger_func(self, stream_id):%0A%0A        sine_ampl = 2.0 # Amplitude in both directions%0A        samples = 60%0A        sine_curr_deg = 0 # varies from 0 - 360%0A%0A        count = samples #something other than zero%0A        while True:%0A            sine_curr_deg = (count %25 samples) * 360 / samples%0A%0A%0A            c = %5Bsine_ampl * math.sin(math.radians(sine_curr_deg))%5D%0A            t = %5Bsine_ampl * 2 * math.sin(math.radians(sine_curr_deg + 45))%5D%0A            p = %5Bsine_ampl * 4 * math.sin(math.radians(sine_curr_deg + 60))%5D%0A%0A            lat = lon = %5B0.0%5D%0A            tvar = %5Bcount%5D%0A%0A            ctd_packet = ctd_stream_packet(stream_id=stream_id,%0A                c=c, t=t, p = p, lat = lat, lon = lon, time=tvar)%0A%0A            log.warn('SinusoidalCtdPublisher sending 1 record!')%0A            self.publisher.publish(ctd_packet)%0A%0A            time.sleep(2.0)%0A%0A            count += 1%0A%0A%0A

Add sinusoidal stream publisher