Update sample data in normalize example

pull/1953/head
noramullen1 2020-12-07 10:39:57 -08:00
parent a50b263525
commit 07a8845bfb
1 changed files with 7 additions and 7 deletions

View File

@ -13,28 +13,28 @@ menu:
[Submit a request](https://w2.influxdata.com/notebooks-early-access/) to be added to the queue, and we will send you a confirmation when youve been added to early access. [Submit a request](https://w2.influxdata.com/notebooks-early-access/) to be added to the queue, and we will send you a confirmation when youve been added to early access.
{{% /note %}} {{% /note %}}
Make it easier to compare data from different places by standardizing or normalizing it so that all measurements are between 0 and 1. This example walks through creating a notebook that normalizes response time using the [`map()`](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/map/) function and writing it to a new bucket. Make it easier to compare data from different places by standardizing or normalizing it. This example walks through creating a notebook with NOAA water database sample data that makes it easier to view water level and water temperature measurements alongside one another using the [`map()`](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/map/) function and writing it to a new bucket.
## Requirements ## Requirements
- This example uses [InfluxDB Cloud demo data](/influxdb/cloud/reference/sample-data/#influxdb-cloud-demo-data). - This example uses [NOAA water database data](/influxdb/v2.0/reference/sample-data/#noaa-water-sample-data). Note that using this data counts towards your total usage.
- Create a destination bucket to write normalized data to. For details, see [Create a bucket](/influxdb/cloud/organizations/buckets/create-bucket/). - Create a destination bucket to write normalized data to. For details, see [Create a bucket](/influxdb/cloud/organizations/buckets/create-bucket/).
## Normalize data with a notebook ## Normalize data with a notebook
1. Create a new notebook (see [Create a notebook](/influxdb/cloud/notebooks/create-notebook/). 1. Create a new notebook (see [Create a notebook](/influxdb/cloud/notebooks/create-notebook/).
2. Add a **Metric Selector** cell to select a bucket to query data from: 2. Add a **Metric Selector** cell to select a bucket to query data from:
- In the **Choose a bucket** dropdown, select **Website Monitoring Bucket**. - In the **Choose a bucket** dropdown, select your NOAA bucket.
- Select the **response_time** field. - Select the **h20_temperature** field.
- Select the **mean** function from the aggregate selector in the upper-right. - Select the **mean** function from the aggregate selector in the upper-right.
3. Add a **Flux Transformation** cell with the following script to bring in data from the previous cell and normalize it: 3. Add a **Flux Transformation** cell with the following script to bring in data from the previous cell and normalize it:
```sh ```sh
__PREVIOUS_RESULT__ __PREVIOUS_RESULT__
|> map(fn: (r) => ({ r with _value: r._value * r._value})) |> map(fn: (r) => ({ r with _value: float(v: r._value) / 10.0 }))
``` ```
4. Add an **Output to Bucket** cell: 4. Add an **Output to Bucket** cell:
- Select the destination bucket for your normalized data. - Select the destination bucket for your normalized data.
5. Add a **Markdown** cell to add a note to your team about what this notebook does. For example, the cell might say, "This notebook standardizes `response_time` so that all values are between 0 and 1." 5. Add a **Markdown** cell to add a note to your team about what this notebook does. For example, the cell might say, "This notebook makes `h20_temperature` easier to view alongside `water_level`."
5. Click **Preview** in the upper left to verify that your notebook runs and preview the output. 5. Click **Preview** in the upper left to verify that your notebook runs and preview the output.
6. Run your notebook: 6. Run your notebook:
- Click **Run** to run the notebook and write to the output bucket a single time. - Click **Run** to run the notebook and write to the output bucket a single time.
- To write continuously, click **Export as Task** in the upper right corner of the **Output to Bucket** cell. For details about working with tasks, see [Manage tasks](/influxdb/cloud/process-data/manage-tasks/) - To write continuously, click **Export as Task** in the upper right corner of the **Output to Bucket** cell. For details about working with tasks, see [Manage tasks](/influxdb/cloud/process-data/manage-tasks/).