简体   繁体   English

Spotfire - 下采样时间序列数据 - 计算新列

[英]Spotfire - Downsample Time Series Data - Calculate New Column

In Tibco Spotfire, how do I downsample time series data to 30 minute intervals and take the closest value to the 00 and 30 minute timestamps?在 Tibco Spotfire 中,如何将时间序列数据下采样到 30 分钟间隔,并采用最接近0030分钟时间戳的值?

ID  DateTime            Value
-----------------------------
ID1 2022-06-06 19:01:34Z 100
ID1 2022-06-06 19:06:31Z 200
ID1 2022-06-06 19:11:34Z 300
ID1 2022-06-06 19:16:31Z 400
ID1 2022-06-06 19:21:32Z 500
ID1 2022-06-06 19:26:33Z 600
ID1 2022-06-06 19:31:32Z 700

Desired Spotfire table所需的 Spotfire 表

ID  DateTime            Value
-----------------------------
ID1 2022-06-06 19:00:00Z 100
ID1 2022-06-06 19:30:00Z 700

Maybe not with a single calculated column, but this should help.也许不是单个计算列,但这应该会有所帮助。

1 - create a timestamp: [TimeStamp] as ToEpochSeconds([DateTime]) 1 - 创建时间戳:[TimeStamp] as ToEpochSeconds([DateTime])

2 - create a timestamp to the nearest half-hour: [RoundTimeStamp] as Round([TimeStamp] / 1800,0) * 1800 2 - 创建一个最接近半小时的时间戳:[RoundTimeStamp] as Round([TimeStamp] / 1800,0) * 1800

3 - turn it back into a datetime: [RoundDateTime]: FromEpochSeconds(Integer([RoundTimeStamp])) 3 - 将其转回日期时间: [RoundDateTime]: FromEpochSeconds(Integer([RoundTimeStamp]))

4 - select the value: [ValueForRoundDateTime] as ValueforMin(Abs([TimeStamp] - [RoundTimeStamp]),[Value]) over (Intersect([ID],[RoundTimeStamp])) 4 - select 值:[ValueForRoundDateTime] as ValueforMin(Abs([TimeStamp] - [RoundTimeStamp]),[Value]) over (Intersect([ID],[RoundTimeStamp]))

This gives you the columns you wanted, [RoundDateTime] and [ValueForRoundDateTime].这将为您提供所需的列,[RoundDateTime] 和 [ValueForRoundDateTime]。

To create a table with only the necessary rows, you could add another table based on the current one:要创建仅包含必要行的表,您可以在当前表的基础上添加另一个表:

select + then choose Other then Linked copy to data table in analysis. select + 然后选择其他然后链接复制到分析中的数据表。

Then go to the Data Canvas, add transformations:然后 go 到数据 Canvas,添加转换:

1 - exclude all columns but [ID], RoundDateTime] and [ValueForRoundDateTime] 1 - 排除除 [ID]、RoundDateTime] 和 [ValueForRoundDateTime] 以外的所有列

2 - filter as Rank(baserowid(),"asc",Concatenate([RoundDateTime],[ID]))=1 2 - 过滤为 Rank(baserowid(),"asc",Concatenate([RoundDateTime],[ID]))=1

(the latter from this support article: https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-42284 ) (后者来自这篇支持文章: https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-42284

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将不均匀的数据时间[timestamps]系列转换为常规时间系列:R - Convert uneven Data Time [timestamps] series to regular time series : R 将带有“列表列”中数据的 pandas df 转换为长格式的时间序列。 使用三列:[数据列表] + [时间戳] + [持续时间] - Convert pandas df with data in a "list column" into a time series in long format. Use three columns: [list of data] + [timestamp] + [duration] Cassandra:时间序列数据时间戳的范围查询 - Cassandra: Range Queries on timestamp of time series data 在时间序列数据中插入缺失的行 - Insert missing rows in time series data 在R中基于时间戳插入新的系列行 - insert new series rows based on time-stamp in R Python时间序列:将字典中的每日数据合并为每周数据 - Python Time series: merging daily data in dictionary to weekly data 从列出生日期和r中的指定时间计算年龄 - calculate age from column birthdate and specified time in r 如何计算在列值上传递的行的时间差 - How do I calculate time difference of rows passed on column value 添加以当前时间为默认值的新列 - Adding a new column with the current time as a default value 如何计算午夜时列中的值之间的时间差? - how to calculate the time difference between the values in column over midnight?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM