def ondata(self, data, notification, timestamp, event_queue='', processed_queue=''): resdata = [] tsdata = [] # Process the array of data for ind in range(data.height.shape[0]): ts = data.time[ind] samp = data.height[ind] if samp<0 or samp>100: # Must convert pydap/numpy Int32 to int! if event_queue: self.queue_result(event_queue,\ {'event':(int(ts),'out_of_range',int(samp))},\ 'out_of_range') samp = 0 qcsamp = samp # Must convert pydap/numpy Int32 to int! resdata.append(int(qcsamp)) tsdata.append(int(ts)) dset = dap_tools.simple_dataset(\ {'DataSet Name':'Simple Data','variables':\ {'time':{'long_name':'Data and Time','units':'seconds'},\ 'height':{'long_name':'person height','units':'meters'}}}, \ {'time':tsdata, 'height':resdata}) # Messages contains a new dap dataset to send to send if processed_queue: self.queue_result(processed_queue,dset,'Example processed data')
def setUp(self): # create a dataset self.ds1 = dap_tools.simple_dataset(\ {'DataSet Name':'SimpleData','variables':\ {'time':{'long_name':'Data and Time','units':'seconds'},\ 'height':{'long_name':'person height','units':'meters'}}}, \ {'time':(111,112,123,114,115,116,117,118,119,120), \ 'height':(8,6,4,-2,-1,5,3,1,4,5)})
def setUp(self): self.data1 = dap_tools.simple_dataset(\ {'DataSet Name':'Simple Data','variables':\ {'time':{'long_name':'Data and Time','units':'seconds'},\ 'height':{'long_name':'person height','units':'meters'}}}, \ {'time':(111,112,123,114,115,116,117,118,119,120), \ 'height':(8,6,4,-2,-1,5,3,1,4,5)}) self.data2 = dap_tools.simple_dataset(\ {'DataSet Name':'Simple Data','variables':\ {'time':{'long_name':'Data and Time','units':'seconds'},\ 'height':{'long_name':'person height','units':'meters'}}}, \ {'time':(101,102,103,104,105,106,107,108,109,110), \ 'height':(5,2,9001,5,-1,9,3,888,3,4)}) self.notification = 'Notify me that OOI is working' self.timestamp = 3.14159 self.ec = example_consumer.ExampleConsumer() yield self.ec.plc_init()
def setUp(self): self.data1 = dap_tools.simple_dataset(\ {'DataSet Name':'Simple Data','variables':\ {'time':{'long_name':'Data and Time','units':'seconds'},\ 'height':{'long_name':'person height','units':'meters'}}}, \ {'time':(111,112,123,114,115,116,117,118,119,120), \ 'height':(8,6,4,-2,-1,5,3,1,4,5)}) self.data2 = dap_tools.simple_dataset(\ {'DataSet Name':'Simple Data','variables':\ {'time':{'long_name':'Data and Time','units':'seconds'},\ 'height':{'long_name':'person height','units':'meters'}}}, \ {'time':(101,102,103,104,105,106,107,108,109,110), \ 'height':(5,2,9001,5,-1,9,3,888,3,4)}) self.notification='Notify me that OOI is working' self.timestamp=3.14159 self.ec = example_consumer.ExampleConsumer() yield self.ec.plc_init()
def ondata(self, data, notification, timestamp, event_queue='', processed_queue=''): resdata = [] tsdata = [] # Process the array of data for ind in range(data.height.shape[0]): ts = data.time[ind] samp = data.height[ind] if samp < 0 or samp > 100: # Must convert pydap/numpy Int32 to int! if event_queue: self.queue_result(event_queue,\ {'event':(int(ts),'out_of_range',int(samp))},\ 'out_of_range') samp = 0 qcsamp = samp # Must convert pydap/numpy Int32 to int! resdata.append(int(qcsamp)) tsdata.append(int(ts)) dset = dap_tools.simple_dataset(\ {'DataSet Name':'Simple Data','variables':\ {'time':{'long_name':'Data and Time','units':'seconds'},\ 'height':{'long_name':'person height','units':'meters'}}}, \ {'time':tsdata, 'height':resdata}) # Messages contains a new dap dataset to send to send if processed_queue: self.queue_result(processed_queue, dset, 'Example processed data')