Skip to content

Interpolation at Time

Interpolation at Time - works out the linear interpolation at a specific time based on the points before and after. This is achieved by providing the following parameter:

Timestamps - A list of timestamp or timestamps

Prerequisites

Ensure you have installed the RTDIP SDK as specified in the Getting Started section.

This example is using DefaultAuth() and DatabricksSQLConnection() to authenticate and connect. You can find other ways to authenticate here. The alternative built in connection methods are either by PYODBCSQLConnection(), TURBODBCSQLConnection() or SparkConnection().

Parameters

Name Type Description
tag_names str List of tagname or tagnames ["tag_1", "tag_2"]
timestamps list List of timestamp or timestamps in the format YYY-MM-DDTHH:MM:SS or YYY-MM-DDTHH:MM:SS+zz:zz where %z is the timezone. (Example +00:00 is the UTC timezone)
window_length int Add longer window time in days for the start or end of specified date to cater for edge cases.
include_bad_data bool Include "Bad" data points with True or remove "Bad" data points with False

Example

from rtdip_sdk.authentication.azure import DefaultAuth
from rtdip_sdk.connectors import DatabricksSQLConnection
from rtdip_sdk.queries import TimeSeriesQueryBuilder

auth = DefaultAuth().authenticate()
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token)

data = (
    TimeSeriesQueryBuilder()
    .connect(connection)
    .source("{tablename_or_path}")
    .interpolation_at_time(
        tagname_filter=["{tag_name_1}", "{tag_name_2}"],
        timestamp_filter=["2023-01-01T09:30:00", "2023-01-02T12:00:00"],
    )
)

print(data)