Canadian wildfire data analysis. Used to generate files for this map and this analsis.
Data was downloaded from Natural Resources Canada. While they provide a single "combined" file from 1986 - 2021, that file was too large (1.5G) to process using command line tools, and obviously too large to host and work with on Observable.
Run sh prep_data.sh
to download and process the data. This may take ~10-15
minutes to complete depending on your internet connection.
prep_data.sh
is a schell script that downloads the data from NRCan, and then
processes it into a single geojson file. The steps are:
- Download the shapefiles
- Convert to geojson
- Convert to topojson (for simplification)
- Simplify the shapefiles to reduce their size
- Merge files into a single geojson file
Luckily, this set of tutorials helped outline the necessary steps! Though it may have been better to just use a node script, as I do for the later analysis.
Available features are described in this PDF. I'm assuming the features are the same for all years, but I haven't checked.
First, make sure to install necessary packages:
npm install
Then, after downloading the shapefiles via sh prep_data.sh
, run node extract_features.js
to extract features from the geojson files. This will
create a file called data/data.csv
that contains the features we want to
analyze.
This process now takes about ~30 minutes to complete, as it recursively projects all coordinates in the shapefiles to compute the centroid (if you leave out this computation, it only takes a minute or two).
The province shapefile.zip was downloaded from statistics Canada. This file was also too large to process using command line tools, so was simplified using the UI tool mapshaper.