本文整理汇总了Python中pyon.util.containers.DotDict.valid_values方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.valid_values方法的具体用法?Python DotDict.valid_values怎么用?Python DotDict.valid_values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.util.containers.DotDict
的用法示例。
在下文中一共展示了DotDict.valid_values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: recv_packet
# 需要导入模块: from pyon.util.containers import DotDict [as 别名]
# 或者: from pyon.util.containers.DotDict import valid_values [as 别名]
def recv_packet(self, msg, stream_route, stream_id):
'''
The callback method. For situations like bad or no data, publish an alert event.
@param msg granule
@param stream_route StreamRoute object
@param stream_id str
'''
log.debug("DemoStreamAlertTransform received a packet!: %s" % msg)
log.debug("type of packet received by transform: %s", type(msg))
#-------------------------------------------------------------------------------------
# Set up the config to use to pass info to the transform algorithm
#-------------------------------------------------------------------------------------
config = DotDict()
config.valid_values = self.valid_values
config.variable_name = self.instrument_variable_name
config.time_field_name = self.time_field_name
#-------------------------------------------------------------------------------------
# Store the granule received
#-------------------------------------------------------------------------------------
self.granules.put(msg)
#-------------------------------------------------------------------------------------
# Check for good and bad values in the granule
#-------------------------------------------------------------------------------------
bad_values, bad_value_times, self.origin = AlertTransformAlgorithm.execute(msg, config = config)
log.debug("DemoStreamAlertTransform got the origin of the event as: %s" % self.origin)
#-------------------------------------------------------------------------------------
# If there are any bad values, publish an alert event for the granule
#-------------------------------------------------------------------------------------
if bad_values:
# Publish the event
self.publisher.publish_event(
event_type = 'DeviceStatusEvent',
origin = self.origin,
origin_type='PlatformDevice',
sub_type = self.instrument_variable_name,
values = bad_values,
time_stamps = bad_value_times,
valid_values = self.valid_values,
state = DeviceStatusType.OUT_OF_RANGE,
description = "Event to deliver the status of instrument."
)
log.debug("DemoStreamAlertTransform published a BAD DATA event")
示例2: recv_packet
# 需要导入模块: from pyon.util.containers import DotDict [as 别名]
# 或者: from pyon.util.containers.DotDict import valid_values [as 别名]
def recv_packet(self, msg, stream_route, stream_id):
'''
The callback method. For situations like bad or no data, publish an alert event.
@param msg granule
@param stream_route StreamRoute object
@param stream_id str
'''
log.debug("DemoStreamAlertTransform received a packet!")
#-------------------------------------------------------------------------------------
# Set up the config to use to pass info to the transform algorithm
#-------------------------------------------------------------------------------------
config = DotDict()
config.valid_values = self.valid_values
config.variable_name = self.instrument_variable_name
config.time_field_name = self.instrument_variable_name
#-------------------------------------------------------------------------------------
# Store the granule received
#-------------------------------------------------------------------------------------
self.granules.put(msg)
#-------------------------------------------------------------------------------------
# Check for good and bad values in the granule
#-------------------------------------------------------------------------------------
bad_values, bad_value_times = AlertTransformAlgorithm.execute(msg, config = config)
#-------------------------------------------------------------------------------------
# If there are any bad values, publish an alert event for each of them, with information about their time stamp
#-------------------------------------------------------------------------------------
if bad_values:
for bad_value, time_stamp in zip(bad_values, bad_value_times):
# Create the event object
event = DeviceStatusEvent( origin = 'DemoStreamAlertTransform',
sub_type = self.instrument_variable_name,
value = bad_value,
time_stamp = time_stamp,
valid_values = self.valid_values,
state = DeviceStatusType.OUT_OF_RANGE,
description = "Event to deliver the status of instrument.")
# Publish the event
self.publisher._publish_event( event_msg = event,
origin=event.origin,
event_type = event.type_)