How have bushfires changed in Australia?

Given the current tragedy unfolding throughout the east coast, I’m suddenly curious how the distribution of bushfires have changed over the years. It turns out that the Victorian government readily distributes historical fire data 1 (as well as huge amounts of other data). At time of writing this dataset stops at August 2019; I am also interested in seeing how the current fires have grown, but this will have to wait.

Naturally, I want a nice animation showing how the fires change. I have never done any GIS before. It turns out this is actually really easy with geopandas:

import geopandas
import matplotlib.pyplot as plt

df = geopandas.read_file('data/shape/fire_history.shp')
df = df[df['FIRETYPE'] == "BUSHFIRE"]
df = df.to_crs(epsg=3857)
years = set(df['SEASON'])

aus_poas = geopandas.read_file('basemap/aus_poas.shp')
vic_poas = aus_poas.query('code >= 3000 & code <= 3999')
vic_shape = vic_poas.dissolve(by='state')
vic_shape = vic_shape.to_crs(epsg=3857)

for counter, year in enumerate(years):
    data = df[df['SEASON'] == year]

    fig, ax = plt.subplots(figsize=(12, 10))
    ax.set_xticks([])
    ax.set_yticks([])
    ax.annotate(year, (2400, 400), xycoords='figure pixels', fontsize=32)
    ax.set_xlim(1.56e7, 1.68e7)
    vic_shape.plot(color='white', ax=ax, edgecolor='k')
    data.plot(column='FIRETYPE', ax=ax)

    filename = f"frames/pic{counter:02d}.png"
    plt.savefig(filename, dpi=300, bbox_inches='tight')
    plt.cla()

This should be intuitively readable; there is huge amounts of info online regarding geopandas. The only wrinkle is adding a basemap. The official docs recommend using contextily, a package which is supposed to magically add a basemap. However, as far as I can tell, it is entirely broken and does not work. I also couldn’t find any easily accessible official basemaps. Instead, I hacked together a solution based on some code from Spatial Vision 2 (who work with DELWP providing GIS services). I have simply overlayed fire data with the outline of Victorian postcodes. If anyone knows how to correctly add a basemap, please contact me. 3 4 5

I convert each frame into a video with ffmpeg 6:

ffmpeg -r 1 -f image2 -s 1920x1080 -i pic%02d.png -crf 25 fire_distribution_century.webm

This yields:

I can also see how the 2009 fires grew:

Finally, I can also quantify the evolution of fire scale over time, using the AREA_HA field:

1939 was a very bad year.

All code and visualisations here released under CC0.


  1. https://discover.data.vic.gov.au/dataset/fire-history-records-of-fires-primarily-on-public-land↩︎

  2. https://spatialvision.com.au/blog-open-source-spatial-geopandas-part-1/↩︎

  3. Also note that pickle will mangle the dataframe. When developing the script I necessarily had to fall into a run-edit cycle, which is slow because of the initial loading of shape data. Obviously dumping the processed shape data to disk the first time should make things faster, but on reading in the pickled data I got back insane errors so just gave up.↩︎

  4. Note that I have only plotted bushfires. Also included in the dataset are burns and other, unknown fires. Note also that some of the fires extend into SA or NSW. I assume this is correct; it does not appear to be an artifact. For this reason I have fixed an axis range so that vic_shape has a constant size.↩︎

  5. Note also the magic number 3857. This apparently corresponds to the Mercator projection (yes it sucks, but isn’t really so bad for the scale of a state). I haven’t seen an authoritative list of available projections.↩︎

  6. I assume there’s a ‘correct’ way to get matplotlib to produce animations. I haven’t bothered to check; this is unixy so why not. Command taken from here.↩︎