本文整理汇总了Python中pthelma.timeseries.Timeseries.aggregate方法的典型用法代码示例。如果您正苦于以下问题:Python Timeseries.aggregate方法的具体用法?Python Timeseries.aggregate怎么用?Python Timeseries.aggregate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pthelma.timeseries.Timeseries
的用法示例。
在下文中一共展示了Timeseries.aggregate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AggregateDbTimeseries
# 需要导入模块: from pthelma.timeseries import Timeseries [as 别名]
# 或者: from pthelma.timeseries.Timeseries import aggregate [as 别名]
def AggregateDbTimeseries(source_id, dest_id, db, read_tstep_func, transaction=None,
commit=True, missing_allowed=0.0,
missing_flag='MISSING', append_only=False,
last_incomplete=False, all_incomplete=False):
source = Timeseries(id=source_id, time_step=read_tstep_func(source_id))
dest_step = read_tstep_func(dest_id)
if append_only:
bounds = timeseries_bounding_dates_from_db(db = db, id = dest_id)
end_date = bounds[1] if bounds else None
source.read_from_db(db)
dest = source.aggregate(target_step=dest_step,
missing_allowed=missing_allowed,
missing_flag=missing_flag,
last_incomplete=last_incomplete,
all_incomplete=all_incomplete)[0]
dest.id = dest_id
if append_only:
d=dest.bounding_dates()
while (d is not None) and (end_date is not None) and d[0]<=end_date:
del dest[d[0]]
d=dest.bounding_dates()
dest.append_to_db(db=db, transaction=transaction, commit=commit)
else:
dest.write_to_db(db=db, transaction=transaction, commit=commit)