# Wildfire-smoke mapping extracts

Teaching extracts for **Lecture 6** and **Classwork 5** (mapping environmental data with `geom_sf()`). They are derived from the public-data build of the Canadian wildfire smoke research project and published at `https://bcdanl.github.io/data/`.

The extracts contain **no mortality data**. They cover fires, smoke, air quality, boundaries, and population only, so that course work stays outcome-blind.

## Rebuild

```bash
Rscript wildfire-maps-lecture/R/build_wildfire_map_data.R \
  "/Volumes/Extreme SSD/wildfire-claude" wildfire-maps-lecture/build
```

The script checks row counts and keys, repairs polygons so that they are valid under both planar (GEOS) and spherical (s2) checks, and reads every GeoJSON back before accepting it. Every file is under 30 MB (largest: 14.6 MB).

## Files

| File | Rows | One row is | Key variables |
|---|---:|---|---|
| `wildfire_us_counties_2020.geojson` | 3,108 | contiguous-U.S. county (incl. DC; Connecticut's 2020 counties) | `GEOID`, `county_name`, `STUSPS`, `state_name`, `region`, `division`, `pop_2020` |
| `wildfire_us_states_2020.geojson` | 49 | state or DC, dissolved from the counties | `STATEFP`, `STUSPS`, `state_name`, `region`, `pop_2020` |
| `wildfire_canada_provinces_2021.geojson` | 13 | province or territory | `PRUID`, `prov_abbr`, `prov_name` |
| `wildfire_smoke_county_month_2006_2025.csv` | 745,920 | county × month | `smoke_pm25` (monthly mean of daily smoke PM2.5, µg/m³), `days_gt15` |
| `wildfire_smoke_county_day_2023_06.csv` | 93,240 | county × day, June 2023 | `smoke_pm25`, `total_pm25`, `hms_share` |
| `wildfire_ember_county_day_2023_06.csv` | 93,240 | county × day, June 2023 | `pm25_model`, `pm25_all_fires`, `pm25_canada_fires` |
| `wildfire_aqs_pm25_2023_06.csv` | 24,028 | monitor × day, June 2023 | `site_id`, `GEOID`, `pm25`, `latitude`, `longitude` |
| `wildfire_hms_smoke_2023_06.geojson` | 2,089 | analyst-drawn smoke plume, June 2023 | `date` (UTC), `start_utc`, `end_utc`, `satellite`, `density` |
| `wildfire_firms_canada_2023.csv` | 280,457 | MODIS fire detection in Canada, 2023 | `latitude`, `longitude`, `frp` (MW), `local_date`, `acq_date` (UTC), `prov_abbr` |
| `wildfire_nbac_burned_area_2023.geojson` | 968 | 2023 fire (outer perimeter) | `fire_id`, `agency`, `start_date`, `end_date`, `area_ha`, `cause` |

## Construction notes

- **Boundaries.** Census 2020 cartographic boundaries (1:500,000), simplified with a 500 m tolerance so that neighbors keep identical shared borders: each shared border is simplified once and the polygons are rebuilt from the simplified borders. Dissolving the published counties by state leaves no sliver holes (the build checks this). States are dissolved from the simplified counties, so the two layers line up exactly. County population is the sum of Census 2020 block-group populations. Canadian provinces drop island parts under 250 km² and are simplified the same way with a 2.5 km tolerance.
- **Smoke.** CSU kriged PM2.5, median-background definition, population-weighted county averages. Smoke = HMS flag × (total − background), so small negative values are kept as measurement noise. 2006–2023 use release 2025-03-21; 2024 and 2025 use releases 2026-02-25 and 2026-08-06.
- **EMBER.** EPA CMAQ runs for 2023. `pm25_all_fires` = base − zero-fire run; `pm25_canada_fires` = base − zero-Canadian-fire run. Population-weighted.
- **AQS.** Daily PM2.5 (parameter 88101), the series that keeps exceptional-event (smoke) days.
- **HMS.** `date` is the UTC date of each plume's start time. Plumes are drawn from satellite images and are often aloft, so they mark smoke overhead, not smoke at breathing height.
- **FIRMS.** MODIS Collection 6.1 standard detections. `local_date` is the local solar date (UTC + longitude/15 hours).
- **NBAC.** Outer perimeters of 2023 fires, with unburned islands filled, parts under 1 km² dropped, and a 500 m tolerance; seven prescribed burns excluded. `area_ha` is the official adjusted burned area. `agency` is the administering agency (for example `PC` = Parks Canada, `DND` = National Defence), not always a province.

## Sources and licences

- U.S. Census Bureau cartographic boundaries and 2020 centers of population — public domain.
- Statistics Canada 2021 boundary files — Statistics Canada Open Licence.
- CSU kriged smoke PM2.5, Dryad doi:10.5061/dryad.k0p2ngfhv — CC0 1.0.
- EPA EMBER CMAQ runs, Zenodo record 13737754 — CC BY 4.0.
- EPA Air Quality System pre-generated daily files — public domain.
- NOAA Hazard Mapping System smoke polygons — public domain.
- NASA FIRMS MODIS active fires (doi:10.5067/FIRMS/MODIS/MCD14ML) — open; cite NASA FIRMS.
- Canadian Forest Service, CWFIS National Burned Area Composite — Open Government Licence – Canada; cite CWFIS, Natural Resources Canada.
