{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "tags": [ "remove-cell" ] }, "outputs": [], "source": [ "import sys\n", "import os\n", "if not any(path.endswith('textbook') for path in sys.path):\n", " sys.path.append(os.path.abspath('../../..'))\n", "from textbook_utils import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "(sec:theory_measurementError)=\n", "# Example: Measuring Air Quality\n", "\n", "Across the US, [sensors to measure air pollution are widely used](https://web-strategist.com/blog/2020/09/20/how-the-crowd-provides-air-quality-data/) by individuals, community groups, and state and local air monitoring agencies. For example, on two days in September 2020, approximately 600,000 Californians and 500,000 Oregonians viewed PurpleAir’s map as fire spread through their states and evacuations were planned. ([PurpleAir](https://www2.purpleair.com) creates air quality maps from crowdsourced data that streams in from its sensors.) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The sensors measure the amount of particulate matter in the air that has a diameter smaller than 2.5 micrometers (the unit of measurement is micrograms per cubic meter: μg/m3). The measurements recorded are the average concentrations over two minutes. While the level of particulate matter changes over the course of a day as, for example, people commute to and from work, there are certain times of the day, like at midnight, when we expect the two minute averages to change little in a half hour. If we examine the measurements taken during these times of the day, we can get a sense of the combined variability in the instrument recordings and the mixing of particles in the air. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Anyone can access sensor measurements from PurpleAir's site. The site provides a download tool, and data are available for any sensor that appears on PurpleAir's map. We downloaded data from one sensor over a 24-hour period and selected three half-hour time intervals spread throughout the day where the readings were roughly constant over the 30-minute period. This gave us three sets of 15 two-minute averages, for a total of 45 measurements:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "tags": [ "remove-input" ] }, "outputs": [ { "data": { "text/html": [ "
\n", " | aq2.5 | \n", "time | \n", "hour | \n", "meds | \n", "diff30 | \n", "
---|---|---|---|---|---|
0 | \n", "6.14 | \n", "2022-04-01 00:01:10 UTC | \n", "0 | \n", "5.38 | \n", "0.59 | \n", "
1 | \n", "5.00 | \n", "2022-04-01 00:03:10 UTC | \n", "0 | \n", "5.38 | \n", "-0.55 | \n", "
2 | \n", "5.29 | \n", "2022-04-01 00:05:10 UTC | \n", "0 | \n", "5.38 | \n", "-0.26 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
42 | \n", "7.55 | \n", "2022-04-01 19:27:20 UTC | \n", "19 | \n", "8.55 | \n", "-1.29 | \n", "
43 | \n", "9.47 | \n", "2022-04-01 19:29:20 UTC | \n", "19 | \n", "8.55 | \n", "0.63 | \n", "
44 | \n", "8.55 | \n", "2022-04-01 19:31:20 UTC | \n", "19 | \n", "8.55 | \n", "-0.29 | \n", "
45 rows × 5 columns
\n", "