Sift | Docs

Step 6: Create Calculated Channel and view it in Sift

Overview

As in Step 6 of the first tutorial, let's create a Calculated Channel that computes the difference between max_air_temp(C) and min_air_temp(C) to capture the daily air temperature swing. This time, we will do it using the REST API instead of the UI. The endpoint we will use to create the Calculated Channel is CreateCalculatedChannel.

Create Calculated Channel

Run the cURL command below to create the Calculated Channel.

curl -X POST "YOUR_REST_API_URL_HERE/api/v2/calculated-channels" \
  -H "Authorization: Bearer YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "fl_demo_calculated_channel",
    "calculatedChannelConfiguration": {
      "assetConfiguration": {
        "selection": {
          "assetIds": ["ASSET_ID"]
        }
      },
      "queryConfiguration": {
        "sel": {
          "expression": "$1 - $2",
          "expressionChannelReferences": [
            {
              "channelReference": "$1",
              "channelIdentifier": "max_air_temp(C)"
            },
            {
              "channelReference": "$2",
              "channelIdentifier": "min_air_temp(C)"
            }
          ]
        }
      }
    }
  }'

Placeholders

  • Replace YOUR_REST_API_URL_HERE with your REST API URL obtained in the previous step.
  • Replace YOUR_API_KEY_HERE with your API key obtained in the previous step.
  • Replace fl (in fl_demo_calculated_channel) with your initials.
  • Replace ASSET_ID with the ASSET ID you copied in Step 3.
A successful response
{
"calculatedChannel": { 
    "calculatedChannelId": "string",
....
}

Plot Calculated Channel in Sift

Now that we have created the Calculated Channel using the REST API, let's view the created Calculated Channel in Sift.

  1. In Sift, click .
  2. Click the Runs tab.
  3. In the Run name or description box, enter the name of the created Run.
  4. Click your Run from the search results to open it.
  5. Click Explore 2.
  6. In the Channels tab, click the following Channels:
    1. max_air_temp(C)
    2. min_air_temp(C)
  7. Click the Calculated Channels tab.
  8. In the Calculated Channels tab, click the name of the created Calculated Channel.
Created Calculated Channel

On this page