本文整理汇总了Python中timeseries.TimeSeries.sorted_event_items方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.sorted_event_items方法的具体用法?Python TimeSeries.sorted_event_items怎么用?Python TimeSeries.sorted_event_items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timeseries.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.sorted_event_items方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_to_pi_file
# 需要导入模块: from timeseries import TimeSeries [as 别名]
# 或者: from timeseries.TimeSeries import sorted_event_items [as 别名]
def write_to_pi_file(*args, **kwargs):
"""Write the given timeseries in PI XML format.
Parameters:
*kwargs['filename']*
name of PI XML file to create and write to
*kwargs['timeseries']*
single time series, or a dict of time series, where each time series
has with a method 'events' to generate all date, value pairs
"""
multiple_series_stub = kwargs['timeseries']
if isinstance(multiple_series_stub, dict):
multiple_series = []
for parameter_id, series_stub in multiple_series_stub.iteritems():
my_kwargs = deepcopy(kwargs)
my_kwargs["parameter_id"] = parameter_id
series = TimeSeries(*args, **my_kwargs)
series.sorted_event_items = lambda s=series_stub: list(s.events())
multiple_series.append(series)
multiple_series.sort(key=lambda series: series.parameter_id)
else:
series = TimeSeries(*args, **kwargs)
series.sorted_event_items = lambda: list(multiple_series_stub.events())
multiple_series = [series]
TimeSeries.write_to_pi_file(kwargs['filename'], multiple_series)