Normalize data with notebooks
Walk through the following example to create a notebook that queries NOAA NDBC sample data, normalizes degree-based wind directions to cardinal directions, and then writes the normalized data to a bucket.
.
In the Build a Query cell:
- In the FROM column under Sample, select NOAA National Buoy Data.
- In the next FILTER column, select _measurement from the drop-down list and select the ndbc measurement in the list of measurements.
- In the next FILTER column, select _field from the drop-down list, and select the wind_dir_degt field from the list of fields.
-
Define a custom function () that converts a numeric degree value to a cardinal direction (N, NNE, NE, etc.).
Use to load the output of the previous notebook cell into the Flux script.
Use map() to iterate over each input row, update the field key to , and normalize the column to a cardinal direction using the custom function.
Click after your Flux Script cell to add a new cell and select Output to Bucket. Select a bucket from the Choose a bucket drop-down list.
Click Run to run the notebook and write the normalized data to your bucket.
To continuously run your notebook, export the notebook as a task:
Click to add a new cell and then select Task.
-
- Every: Interval that the task should run at.
- Offset: (Optional) Time to wait after the defined interval to execute the task. This allows the task to capture late-arriving data.
- Click Export as Task.