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
business_unit str Business unit of the data
region str Region
asset str Asset
data_security_level str Level of data security
data_type str Type of the data (float, integer, double, string)
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 interpolation_at_time

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

parameters = {
    "business_unit": "{business_unit}",
    "region": "{region}", 
    "asset": "{asset_name}", 
    "data_security_level": "{security_level}", 
    "data_type": "float",
    "tag_names": ["{tag_name_1}", "{tag_name_2}"],
    "timestamps": ["2023-01-01", "2023-01-02"], 
    "window_length": 1,
}
x = interpolation_at_time.get(connection, parameters)
print(x)