当前位置: 首页>>代码示例>>Python>>正文


Python DotDict.time_field_name方法代码示例

本文整理汇总了Python中pyon.util.containers.DotDict.time_field_name方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.time_field_name方法的具体用法?Python DotDict.time_field_name怎么用?Python DotDict.time_field_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyon.util.containers.DotDict的用法示例。


在下文中一共展示了DotDict.time_field_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: recv_packet

# 需要导入模块: from pyon.util.containers import DotDict [as 别名]
# 或者: from pyon.util.containers.DotDict import time_field_name [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")
开发者ID:mbarry02,项目名称:coi-services,代码行数:52,代码来源:event_alert_transform.py

示例2: recv_packet

# 需要导入模块: from pyon.util.containers import DotDict [as 别名]
# 或者: from pyon.util.containers.DotDict import time_field_name [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_)
开发者ID:kerfoot,项目名称:coi-services,代码行数:49,代码来源:event_alert_transform.py


注:本文中的pyon.util.containers.DotDict.time_field_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。