EARTH 801
Computation and Visualization in the Earth Sciences

Small Project 2

PrintPrint

I suggest that this project do something visually interesting with an Earth science data set of some sort. If you are stumped or can't find anything good, let me know and I can help brainstorm.

Below is a video of the example program of an an animation of some foreshocks and aftershocks from the March 2011 Tohoku-Oki earthquake that happened off the coast of Japan. There's a time-elapsed clock up in the corner so you can tell how far along the animation is. I made the circle sizes go as a log scale instead of a linear scale like most people do because this way is actually a more accurate representation of the difference in earthquake magnitudes compared to each other. The fact that they are all represented as circular sources is not accurate, though. One thing you can see that falls naturally with my way of plotting is that you can really see the fact that aftershock locations basically fill up the area swept out by the mainshock. Remember from Earth 520 that one way to tell the areal extent of the rupture of a large earthquake is to see where the aftershocks are.

Animation (and code) of the Tohoku-Oki earthquake
E. Richardson

Here is the code that was shown in the video:

/**
 * tohokumap
 *
 * Loads a text file that contains three columns (lat, long, mag) of seismic locations
 * from NEIC Feb 10 - Apr 5 of 2011, in a box from 32N - 46N and 14E - 148E (Japan).
 *
 *
 * The magnitude of each event is shown by its radius (exp(mag)/20 = radius in pixels).
 *
 * The "clock" in the corner shows time elapsing as the events happen
 **/
 
 String[] lines;
 String[] coast;
 int index = 0;
 float magscale = 1.1;
 
 void setup() {
    size(700, 700); // Each degree of lon/lat is 50 pixels
    background(200);
    smooth();
    //frameRate(30);
    PFont font;
    font = loadFont("AppleSymbols-18.vlw");
    textFont(font);
    lines = loadStrings("tohoku_latlonmag.txt");
    coast = loadStrings("coast30062.txt");
    fill(0);
    text("Animation begins on 10 Feb 2011, ends on 5 Apr 2011", 100, 50);
    
    // Draw the coastline
    for (int i = 0; i < coast.length; i++) {
       String[] pieces = split(coast[i], ' ');
       float lon = float(pieces[0]);
       float lonMap = map(lon, 134, 148, 0, width);
       float lat = float(pieces[1]);
       float latMap = map(lat, 32, 46, heiht, 0);
       pushMatrix();
       translate(lonMap, latMap);
       stroke(0, 0, 255);
       point(0, 0);
       popMatrix();
    }
 }
 
 void draw() {
    // Plot the events
    stroke(150);
    if (index < lines.length) {
       String[] pieces = split(lines[index], ' ');
       float y = float(pieces[0]); // latitude
       float yMap = map(y, 32, 46, height, 0);
       float x = float(pieces[1]); // longitude
       float xMap = map(x, 134, 148, 0, width);
       float m = float(pieces[2]); //magnitude
       
       if (m < 4.0) {
          fill(192, 250, 58);
       }
       else if (m >= 4.0 && m <= 4.9) {
          fill(243, 250, 58);
       }
       else if (m >= 5.0 && m <= 5.9) {
          fill(250, 109, 58);
       }
       else if (m >= 6.0 && m <= 6.9) {
          fill(250, 186, 58);
       }
       else if (m >= 7.0 && m <= 7.9) {
          fill(150, 129, 58);
       }
       else if (m >= 8.0 && m <= 8.9) {
          fill(250, 100, 58);
       }
       else if (m > 8.9) {
          fill(250, 87, 58);
       }
       else {
          println("bummer! I don't know what to do with m = " +m);
       }
       
       ellipse(xMap, yMap, exp(m) / 20, exp(m) / 20);
       
       // Make a time elapsed clock up in the corner.
       noFill();
       ellipse(50, 50, 80, 80);
       
       // Angles start at 3 o'clock
       // Subtract HALF_PI to make the clock start at the top.
       float t = map(index, 0, lines.length, 0, TWO_PI) - HALF_PI;
       line(50, 50, cos(t) * 38 + 50, sin(t) * 38 + 50);
       
       index = index + 1;
    }
 }    

Another point made by this animation is that a magnitude 9 earthquake is really, really, really, mindbogglingly big!

If you are prepared to be watching closely at the beginning, you can see that this earthquake had a big foreshock, too, and that foreshock had a cascade of its own aftershocks before the main event happened.

Here is a video showing just the Tohoku aftershocks animation by itself. (This video lets you watch the animation without hearing me talk about the details of the program)

Animation of the Tohoku-Oki earthquake
E. Richardson

Here's a still shot from the end of the animation:

map of japan with earthquake location. display from aftershocks animation program.
Still image from the end of the animation of the Tohoku-Oki earthquake
E. Richardson

Turning in your work

Turn in your project to the "small project 2" dropbox. Remember to zip your whole folder and turn the zipped file in if your program requires external files such as fonts, images, or data in order to run.