Transforming data (transforms)
Transforms are mathematical expressions that map an asset property's data points from one form to another. A transform expression consists of asset property variables, mathematical operators, and common functions. The transformed data points hold a onetoone relationship with the input data points.
For example, if your asset has a temperature measurement stream named
Temperature_C
with units in Celsius, you can convert each data point to
Fahrenheit with the formula Temperature_F = 9/5 * Temperature_C + 32
. Each
time AWS IoT SiteWise receives a data point in the Temperature_C
measurement stream,
the corresponding Temperature_F
value is calculated and available as the
Temperature_F
property within a few seconds.
Defining transforms (console)
When you define a transform for an asset model in the AWS IoT SiteWise console, you specify following parameters:

Name – The property's name.

Formula – The transform expression. Transform expressions can't use aggregation functions or temporal functions. Start typing or press the down arrow key to open the autocomplete feature. For more information, see Using formula expressions.
Important Transforms can input properties that are integer, double, Boolean, or string type. Booleans convert to
0
(false) and1
(true).Transforms must input one nonattribute property and any number of attribute properties. AWS IoT SiteWise calculates a new transformed data point each time the nonattribute input property receives a new data point. New attribute values don't trigger transform updates.
Formula expressions can only output double values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number. You can use the jp function to convert a string to a number. If you define a formula that computes a nonnumeric value, AWS IoT SiteWise doesn't output a data point for that computation. For more information, see Undefined, infinite, and overflow values.

Unit – (Optional) The scientific unit for the property, such as mm or Celsius.
For more information, see Creating an asset model (console).
Example transform definition
The following example demonstrates a transform property that converts an asset's temperature measurement data from Celsius to Fahrenheit.
Defining transforms (CLI)
When you define a transform for an asset model with the AWS IoT SiteWise API, you specify the following parameters:

name
– The property's name. 
dataType
– The data type of the transform, which must beDOUBLE
. 
expression
– The transform expression. Transform expressions can't use aggregation functions or temporal functions. For more information, see Using formula expressions. 
variables
– The list of variables that defines the other properties of your asset to use in the expression. Each variable structure contains a simple name to use in the expression and avalue
structure that identifies which property to link to that variable. Thevalue
structure contains the following information:
propertyId
– The ID of the property from which to input values. You can use the property's name instead of its ID.
Important Transforms can input properties that are integer, double, Boolean, or string type. Booleans convert to
0
(false) and1
(true).Transforms must input one nonattribute property and any number of attribute properties. AWS IoT SiteWise calculates a new transformed data point each time the nonattribute input property receives a new data point. New attribute values don't trigger transform updates.
Formula expressions can only output double values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number. You can use the jp function to convert a string to a number. If you define a formula that computes a nonnumeric value, AWS IoT SiteWise doesn't output a data point for that computation. For more information, see Undefined, infinite, and overflow values.


unit
– (Optional) The scientific unit for the property, such as mm or Celsius.
Example transform definition
The following example demonstrates a transform property that converts an asset's temperature measurement data from Celsius to Fahrenheit. This object is an example of an AssetModelProperty that contains a Transform. You can specify this object as a part of the CreateAssetModel request payload to create a transform property. For more information, see Creating an asset model (CLI).
{
...
"assetModelProperties": [...
{ "name": "Temperature F", "dataType": "DOUBLE", "type": { "transform": { "expression": "9/5 * temp_c + 32", "variables": [ { "name": "temp_c", "value": { "propertyId": "Temperature C" } } ] } }, "unit": "Fahrenheit" } ],...
}