> ## Content Index
> Fetch the complete content index at: https://www.bambooweekly.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Bamboo Weekly #24: Wildfire smoke
- URL: https://www.bambooweekly.com/bw-24-wildfire-smoke/
- Published: 2023-07-12T15:00:35.000Z
- Updated: 2026-08-06T10:45:55.000Z
- Description: Get practice working with multiple files, comprehensions, grouping, plotting, and GeoPandas
- Author: Reuven M. Lerner
- Tags: multiple-files, comprehensions, grouping, plotting, geopandas

Several weeks ago, I started to see a number of odd-looking pictures on Facebook and other social media. The pictures were from New York and other US cities, but they all seemed oddly ... orange. People also took selfies with N95 masks on, making jokes (!) about how they've returned to wearing masks for the first time in a year or more — only this time, they were masking outside, rather than inside. And they weren't worried about viruses, but rather particles of smoke.

The reason, as you might recall, was a set of Canadian wildifres whose smoke ended up covering part of the United States. People were — and please pardon my use of highly technical language — freaking out for a few days, and taking nonstop pictures of what looked like a science fiction story.

(And yes, to my readers on the West Coast of the US, I realize that you've been suffering from such problems for years, and often need masks when wildfires are burning. Pre-covid, the only people I knew with masks on hand were people living in Northern California. I'm certainly not trying to ignore you!)

How bad was the smoke? Was it equally bad in all places, at all times? And can we somehow use Pandas to plot the smoke amounts on a map?

Those are the questions that I want to address this week. Along the way, we'll not only work with some interesting and important data, but we'll also experiment with GeoPandas, an extension to Pandas that (as you might guess) lets us explore and plot geographical data. I've recently started to play with [GeoPandas](https://geopandas.org/en/stable/?ref=bambooweekly.com), and my only regret is that I didn't start doing so years ago. I've found it to be both exciting and addictive, and hope that you'll be similarly excited to start working with it.

### Data and questions

This week's data comes from the US [Environmental Protection Agency](https://www.epa.gov/?ref=bambooweekly.com). The EPA collects a variety of types of data regarding outdoor air quality, but much of the data is historical, and doesn't include more recent values. If you want recent data, you'll need to get it from the following page:

```
https://www.epa.gov/outdoor-air-quality-data/download-daily-data
```

Unfortunately, this page only lets you download info about pollutant and state at at a time. Not being an expert in this sort of thing, I decided that we would look at what's known as PM 2.5 µm or less, and that we would only look at a handful of states.

In order to get this data, you'll need to go to the above page. Then:

1. Choose PM2.5 for "pollutant."
2. Choose 2023 for the year.
3. We'll download data for three states: New York, Pennsylvania, and Ohio. (And yes, that means you'll need to fill out this form three times.)
4. After choosing a state, you'll be asked to either choose a city (first list) or county (second list). The first option on the second (county) list is "all sites," and it should also be the default.
5. Click on "get data."
6. Finally, click on the "Download CSV" link that appears in place of the "submit" button. As they say, the link will only work for 10 minutes.
7. Rename each of the three files you downloaded, and put them in the same directory.

And now, with the data downloaded into CSV files, we can start to work with it.

I have 11 tasks and questions for you this week. The learning goals are: Working with multiple files, time series, grouping, plotting, creating a GeoDataFrame from an existing one, and plotting geographical data against a map.

- Create a single Pandas data frame from the three downloaded files. We'll only need a few of the columns: Date, PM2.5 concentration, site name, state, longitude, and latitude. Make the index a combination of the date and state name. Rename the columns to be all lowercase and shorter, to make it easier to work with.
- What were the minimum, median, and maximum PM2.5 particle counts measured in these three states?
- Create a line plot showing the median PM2.5 particle count for each state, per day.
- On which date was the highest reading taken for each state?
- What was the PM2.5 value on June 30th for the northernmost collection point? The southernmost collection point?
- Download and install GeoPandas. Create a GeoDataFrame that contains all of the information from our existing data frame, adding the geometry based on the "longitude" and "latitude" columns. (The following documentation will help: [https://geopandas.org/en/stable/gallery/create\_geopandas\_from\_pandas.html](https://geopandas.org/en/stable/gallery/create%5Fgeopandas%5Ffrom%5Fpandas.html?ref=bambooweekly.com))
- Plot the GeoDataFrame's PM2.5 values on January 1st. Use the "Spectral\_r" colormap, and show the legend.
- Now plot the GeoDataFrame's PM2.5 values on July 1st. Use the "Spectral\_r" colormap, and show the legend.
- Read US states into a GeoDataFrame. The shapefile for doing that is at the US Census Bureau, at [https://www2.census.gov/geo/tiger/GENZ2018/shp/cb\_2018\_us\_state\_500k.zip](https://www2.census.gov/geo/tiger/GENZ2018/shp/cb%5F2018%5Fus%5Fstate%5F500k.zip?ref=bambooweekly.com). Inside of the zipfile, you'll find a shapefile (cb\_2018\_us\_state\_500k.shp) you can use.
- Clip the US map to have a bottom left corner of (-86, 38.5) and a top right corner of (-72, 45.5). Display the result.
- Using Matplotlib, plot the PM2.5 values on July 1st on top of the US map.

I’ll be back tomorrow with my detailed solutions, and a link to the Jupyter notebook that I used to create them.

I look forward to your comments and questions!

Reuven