From 48449a92ca57f08820decc3696cdf7ace092a1bb Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 30 Apr 2021 13:21:17 -0600 Subject: [PATCH] port interpolate pkg from flux-restructure branch, closes #2414 (#2467) --- .../flux/stdlib/interpolate/_index.md | 15 ++++ .../flux/stdlib/interpolate/linear.md | 15 ++++ .../flux/stdlib/interpolate/_index.md | 23 ++++++ .../flux/stdlib/interpolate/linear.md | 71 +++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 content/influxdb/cloud/reference/flux/stdlib/interpolate/_index.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/interpolate/linear.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/interpolate/_index.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/interpolate/linear.md diff --git a/content/influxdb/cloud/reference/flux/stdlib/interpolate/_index.md b/content/influxdb/cloud/reference/flux/stdlib/interpolate/_index.md new file mode 100644 index 000000000..92b398621 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/interpolate/_index.md @@ -0,0 +1,15 @@ +--- +title: Flux interpolate package +list_title: Interpolate package +description: > + The Flux `interpolate` package provides functions that insert rows for missing + data at regular intervals and estimate values using different interpolation methods. + Import the `interpolate` package. +menu: + influxdb_cloud_ref: + name: Interpolate + parent: Flux standard library +weight: 202 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/interpolate/linear.md b/content/influxdb/cloud/reference/flux/stdlib/interpolate/linear.md new file mode 100644 index 000000000..ed657d1f3 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/interpolate/linear.md @@ -0,0 +1,15 @@ +--- +title: interpolate.linear() function +description: > + The `interpolate.linear` function inserts rows at regular intervals using + **linear interpolation** to determine values for inserted rows. +menu: + influxdb_cloud_ref: + name: interpolate.linear + parent: Interpolate +weight: 301 +introduced: 0.87.0 +list_query_example: interpolate_linear +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/interpolate/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/interpolate/_index.md new file mode 100644 index 000000000..ca5b0bd94 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/interpolate/_index.md @@ -0,0 +1,23 @@ +--- +title: Flux interpolate package +list_title: Interpolate package +description: > + The Flux `interpolate` package provides functions that insert rows for missing + data at regular intervals and estimate values using different interpolation methods. + Import the `interpolate` package. +menu: + influxdb_2_0_ref: + name: Interpolate + parent: Flux standard library +weight: 202 +--- + +The `interpolate` package provides functions that insert rows for missing +data at regular intervals and estimate values using different interpolation methods. +Import the `interpolate` package: + +```js +import "interpolate" +``` + +{{< children type="articles" show="pages" >}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/interpolate/linear.md b/content/influxdb/v2.0/reference/flux/stdlib/interpolate/linear.md new file mode 100644 index 000000000..bb37a83dd --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/interpolate/linear.md @@ -0,0 +1,71 @@ +--- +title: interpolate.linear() function +description: > + The `interpolate.linear` function inserts rows at regular intervals using + **linear interpolation** to determine values for inserted rows. +menu: + influxdb_2_0_ref: + name: interpolate.linear + parent: Interpolate +weight: 301 +introduced: 0.87.0 +list_query_example: interpolate_linear +--- + +The `interpolate.linear` function inserts rows at regular intervals using +[linear interpolation](https://en.wikipedia.org/wiki/Linear_interpolation) +to determine values for inserted rows. + +```js +import "interpolate" + +interpolate.linear(every: 1m) +``` + +#### Function requirements +- Input data must have `_time` and `_value` columns. +- **All columns** other than `_time` and `_value` must be part of the group key. + +## Parameters + +### every +Duration of time between interpolated points. + +_**Data type:** Duration_ + +## Examples + +### Interpolate missing data by day +```js +import "interpolate" + +data + |> interpolate.linear(every: 1d) +``` + +{{< flex >}} +{{% flex-content %}} +##### Input +| _time | _value | +|:----- | ------:| +| 2021-01-01T00:00:00Z | 10.0 | +| 2021-01-02T00:00:00Z | 20.0 | +| 2021-01-04T00:00:00Z | 40.0 | +| 2021-01-05T00:00:00Z | 50.0 | +| 2021-01-08T00:00:00Z | 80.0 | +| 2021-01-09T00:00:00Z | 90.0 | +{{% /flex-content %}} +{{% flex-content %}} +##### Output +| _time | _value | +|:----- | ------:| +| 2021-01-01T00:00:00Z | 10.0 | +| 2021-01-02T00:00:00Z | 20.0 | +| 2021-01-04T00:00:00Z | 40.0 | +| 2021-01-05T00:00:00Z | 50.0 | +| 2021-01-06T00:00:00Z | 60.0 | +| 2021-01-07T00:00:00Z | 70.0 | +| 2021-01-08T00:00:00Z | 80.0 | +| 2021-01-09T00:00:00Z | 90.0 | +{{% /flex-content %}} +{{< /flex >}}