0% found this document useful (0 votes)
31 views3 pages

HandsOn 3. Sensor Data

This document provides instructions for exploring sensor data from a weather station. It has 4 steps: 1) Open a terminal and navigate to the sensor data directory 2) View the weather station data file to see the timestamped measurements 3) Look at a key file to understand what each measurement represents 4) Install Matplotlib and run a script to plot the air temperature measurements over time

Uploaded by

HGE05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

HandsOn 3. Sensor Data

This document provides instructions for exploring sensor data from a weather station. It has 4 steps: 1) Open a terminal and navigate to the sensor data directory 2) View the weather station data file to see the timestamped measurements 3) Look at a key file to understand what each measurement represents 4) Install Matplotlib and run a script to plot the air temperature measurements over time

Uploaded by

HGE05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Hands-on Activity: 4.

Exploring sensor data

Learning Goals:

By the end of this activity, you will be able to:

1. Identify the major components in semi-structured data from a weather station


2. Create plots of weather station data

Instructions:
Step 1. Open a terminal shell. Open a terminal shell by clicking on the square black box on the top
left of the screen.

Change into the sensor directory:

Run cd Downloads/lect4data/sensor

Run ls to see the image and scripts:

Step 2. View weather station data. Twenty-four hours of weather station data is in the file wx-
data.txt . View this data by running more wx-data.txt.
Each line in the file contains a timestamp in the first column and a set of measurements in the
second column. These column are separated by a tab. The measurements are also a set of columns
separated by commas.

The timestamp is the number of seconds since January 1, 1970. By looking at the successive
timestamps in the file, we can see that the measurements arrive about every second.

The measurements are prefixed with R0, R1, R2 , etc. Each R-value holds a different set of
measurements. For example, R1 has Dn, Dm, Dx , etc. Additionally, the different types are measured
at different frequencies. R1 is measured every second, but R0 and R2 are much less frequent.

Step 3. Look at key for measurements. We can learn what the measurement fields mean by looking
at the measurements key file. Open a new terminal and cd to
Downloads/lect4data/sensor.

Run more wxt-520-format.txt:

This file provides a list of what each field means. For example, Ta is the Air temperature, and Dn is
the Wind direction minimum.

Step 4. Plot data. To plot the air temperature, you will first need to install Matplotlib.

Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of
hardcopy formats and interactive environments across platforms.

Run the following command to install Matplotlib.


sudo pip3.5 install matplotlib
Now you can run the command:
./plot-data.py wx-data.txt Ta

And it will save a file named ‘results.png’ in your sensor data folder, which looks like this:

You might also like