Sonification of global climate data using Python

David Radcliffe

dradcliffe@gmail.com

Background

  • Most climate scientists agree that global warming is real, and due to human activity.
  • Main cause: Excess atmospheric carbon dioxide due to the burning of fossil fuels.
  • Global average surface temperatures have increased by 0.6 to 0.9 degrees Celsius in the past 100 years.

Impact of global warming

  • Changes in precipitation
  • More hot days and fewer cold days
  • More extreme weather events
  • Rising sea levels
  • Ocean acidification

Idea

  • Ed Hawkins' animation is really cool!
  • But it doesn't have a sound track...
  • Can I create a "musical" representation?
  • Is there a magic R package to create music from data?

Mingus

  • Mingus is a music theory package for Python
  • The basic object is a Note.
  • Notes are grouped into containers.
  1. NoteContainer
  2. Bar
  3. Track
  4. Composition
  5. Suite

Python Code

import pandas as pd
from mingus.containers import Note, NoteContainer, Bar, Track
from mingus.midi import midi_file_out

data = pd.read_csv('temp-anomaly-annual.csv')
track = Track()

# The track begins with 11 bars of rests, in 4/4 time.
for _ in range(11):
	bar = Bar()
	bar.place_rest(1) # Whole rest
	track.add_bar(bar)

for value in data.Anomaly:
	note = Note()
	pitch = int(36*value + 48)
	note.from_int(pitch)
	note.velocity = 127

	bar = Bar('C', (1, 4))
	bar.place_notes(note, 4)
	track.add_bar(bar)

midi_filename = "temp-anomaly.mid"
bpm = 600 # 10 beats per second. Each beat represents 1 year.
midi_file_out.write_Track(midi_filename, track, bpm)

My workflow

  • Download animation (MP4)
  • Download climate data
  • Aggregate data to year level
  • Save to CSV file
  • Use Python script to generate MIDI
  • Convert MIDI to MP3 (using zamzar.com)
  • Attach audio to video using Windows Movie Maker
  • Upload video to YouTube
  • ...
  • PROFIT!

Did it work?

  • Soundtrack gives an impression of short-term randomness but long term increase.
  • What are some other ways to represent climate change through music?
  • What are some other tools that I could have used?

Sonification of global climate data using Python

By David Radcliffe

Sonification of global climate data using Python

  • 1,256