Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Earthquakes in three dimensions

by snowhare (Friar)
on Jan 01, 2009 at 21:17 UTC ( [id://733670]=CUFP: print w/replies, xml ) Need Help??

With the annual 'OMG there are earthquakes in Yellowstone and we are all going to die' news cycle in progress, I looked at the USGS web page for the earthquake swarm. The page was singularly uninformative because the swarm is very localized and you can't really tell what was going on from the picture. But they also have the raw data that the map is generated from available. And I thought "Hey, I'll bet I could generate a 3D scattergram of that data." And thanks to Perl and gnuplot, I could. More, I could even animate it. :) This will only work on *nix style systems with gnuplot installed.
#!/usr/bin/perl use strict; use warnings; use IO::Handle; my @data = <DATA>; my $GNUPLOT_IOH = IO::Handle->new; $GNUPLOT_IOH->autoflush(1); open($GNUPLOT_IOH, '|- ', 'gnuplot') || die( "Could not open a pipe to + gnuplot: $!\n"); my $x_rot = 70; print $GNUPLOT_IOH "set title 'Yellowstone Earthquake Swarm'\n"; print $GNUPLOT_IOH "set xlabel 'Longitude'\n"; print $GNUPLOT_IOH "set ylabel 'Latitude'\n"; print $GNUPLOT_IOH "set zlabel 'Depth (km)\n"; for (my $y_rot = 0; $y_rot <= 360; $y_rot += 0.2) { print $GNUPLOT_IOH "set view $x_rot,$y_rot\n"; print $GNUPLOT_IOH "splot '-' using 4:3:5\n"; print $GNUPLOT_IOH join('',@data); print $GNUPLOT_IOH "\ne\n"; select(undef,undef,undef, 0.05); # sleep for 0.05 second } print $GNUPLOT_IOH "\nexit\n"; close($GNUPLOT_IOH); exit; ################################################################ # Magnitude Date Latitude Longitude Depth __DATA__ 2.7 2009/01/01:12:51:24 44.548 -110.361 -0.2 2.4 2009/01/01:10:13:52 44.541 -110.389 -0.2 #2.4 2009/01/01:10:12:57 44.325 -110.388 -37.0 2.3 2009/01/01:10:06:51 44.529 -110.370 -0.5 2.3 2009/01/01:10:02:57 44.528 -110.346 -0.2 1.6 2009/01/01:06:59:39 44.504 -110.340 -0.9 2.1 2009/01/01:05:29:09 44.507 -110.309 -1.5 2.2 2009/01/01:05:19:51 44.509 -110.350 -1.7 1.5 2008/12/31:15:05:00 44.514 -110.360 -1.1 3.3 2008/12/31:15:02:11 44.523 -110.361 -4.9 1.5 2008/12/31:12:50:01 44.518 -110.368 -2.0 1.1 2008/12/31:12:46:53 44.520 -110.362 -2.0 1.9 2008/12/31:12:42:06 44.519 -110.367 -0.1 1.6 2008/12/31:12:26:56 44.501 -110.385 -2.2 1.4 2008/12/31:12:23:52 44.520 -110.371 -1.0 1.7 2008/12/31:11:52:19 44.503 -110.371 -0.4 1.3 2008/12/31:11:40:04 44.526 -110.368 -2.2 1.6 2008/12/31:11:25:24 44.516 -110.376 -1.8 1.4 2008/12/31:11:25:11 44.523 -110.364 -2.2 1.4 2008/12/31:11:22:16 44.520 -110.382 -2.2 2.7 2008/12/31:11:15:44 44.522 -110.372 -1.2 1.5 2008/12/31:11:12:40 44.516 -110.373 -0.6 1.8 2008/12/31:11:08:59 44.532 -110.381 -0.4 2.4 2008/12/31:11:06:14 44.520 -110.371 -1.2 1.9 2008/12/31:11:05:12 44.532 -110.380 -0.3 1.3 2008/12/31:10:53:29 44.520 -110.364 -2.2 1.5 2008/12/31:10:52:23 44.546 -110.394 -0.7 1.9 2008/12/31:10:43:37 44.524 -110.372 -1.5 1.1 2008/12/31:10:26:01 44.532 -110.381 -2.0 1.8 2008/12/31:10:23:43 44.530 -110.380 -1.0 1.2 2008/12/31:10:23:07 44.529 -110.380 -0.9 1.5 2008/12/31:10:21:49 44.521 -110.373 -2.1 1.4 2008/12/31:10:16:44 44.527 -110.367 -0.8 1.4 2008/12/31:10:14:42 44.568 -110.444 -7.2 1.9 2008/12/31:10:13:50 44.531 -110.381 -2.1 1.4 2008/12/31:10:11:14 44.518 -110.369 -2.2 1.3 2008/12/31:10:08:13 44.529 -110.377 -2.0 1.1 2008/12/31:10:02:32 44.525 -110.378 -0.7 1.3 2008/12/31:09:56:38 44.525 -110.371 -1.8 1.1 2008/12/31:09:56:09 44.508 -110.362 -2.1 1.1 2008/12/31:09:45:54 44.511 -110.361 -2.5 1.7 2008/12/31:09:45:34 44.507 -110.364 -2.2 1.1 2008/12/31:09:45:02 44.516 -110.370 -2.3 1.2 2008/12/31:09:37:18 44.512 -110.356 -1.5 1.4 2008/12/31:09:34:27 44.522 -110.365 -0.1 1.3 2008/12/31:09:33:05 44.500 -110.369 -3.6 1.3 2008/12/31:09:26:32 44.535 -110.365 -0.9 1.9 2008/12/31:09:21:28 44.533 -110.380 -0.7 1.4 2008/12/31:09:16:01 44.525 -110.373 -2.2 1.3 2008/12/31:09:13:59 44.514 -110.370 -1.6 2.6 2008/12/31:09:05:59 44.520 -110.368 -0.5 3.6 2008/12/31:09:02:28 44.525 -110.362 -4.3 1.2 2008/12/31:09:00:19 44.518 -110.366 -1.9 2.5 2008/12/31:08:59:21 44.522 -110.362 -0.5 3.0 2008/12/31:08:58:11 44.527 -110.369 -1.3 1.1 2008/12/31:07:27:46 44.535 -110.355 -0.4 1.0 2008/12/31:06:19:28 44.528 -110.378 -1.0 1.5 2008/12/31:06:02:54 44.529 -110.358 -2.0 1.6 2008/12/31:05:59:03 44.531 -110.355 -2.0 1.1 2008/12/31:05:58:39 44.528 -110.377 -2.0 1.1 2008/12/31:05:24:55 44.543 -110.344 -0.1 1.2 2008/12/31:05:22:43 44.526 -110.379 -1.1 2.5 2008/12/31:05:17:41 44.530 -110.375 -1.1 2.8 2008/12/31:05:06:40 44.529 -110.382 -1.6 #1.0 2008/12/31:04:49:57 44.726 -111.162 -7.4 1.9 2008/12/30:20:21:32 44.535 -110.353 -0.0 #1.3 2008/12/30:19:05:33 44.731 -111.165 -7.3 2.8 2008/12/30:19:05:13 44.540 -110.350 -0.1 1.1 2008/12/30:19:01:06 44.533 -110.359 -2.3 2.8 2008/12/30:11:59:07 44.533 -110.374 -0.9 1.5 2008/12/30:09:17:43 44.525 -110.379 -0.0 1.4 2008/12/30:09:10:20 44.527 -110.380 -0.6 1.0 2008/12/30:04:02:27 44.503 -110.390 -2.4 1.1 2008/12/30:03:16:31 44.524 -110.406 -1.6 1.5 2008/12/30:03:11:35 44.552 -110.359 -2.1 1.0 2008/12/30:03:08:25 44.499 -110.379 -2.2 #1.2 2008/12/30:03:02:08 44.595 -110.318 -13.0 #1.1 2008/12/30:02:50:02 44.787 -110.996 -7.2 #1.2 2008/12/30:02:44:42 44.788 -110.995 -7.2 #1.2 2008/12/30:02:29:17 44.712 -111.147 -2.5 #1.6 2008/12/30:02:25:29 44.787 -111.001 -7.5 1.3 2008/12/30:02:13:36 44.516 -110.360 -2.5 1.0 2008/12/30:02:00:37 44.553 -110.341 -2.2 1.0 2008/12/30:01:51:00 44.517 -110.354 -1.8 1.3 2008/12/30:01:47:56 44.527 -110.381 -1.1 2.3 2008/12/30:01:47:26 44.532 -110.359 -2.0 1.7 2008/12/30:01:35:08 44.530 -110.361 -2.1 1.5 2008/12/30:01:15:37 44.522 -110.360 -2.1 2.1 2008/12/30:00:51:20 44.505 -110.373 -0.2 1.0 2008/12/30:00:41:35 44.522 -110.361 -1.8 2.8 2008/12/30:00:36:39 44.525 -110.362 -1.2 2.4 2008/12/29:21:25:15 44.525 -110.360 -2.0 1.6 2008/12/29:21:18:51 44.521 -110.362 -2.2 1.8 2008/12/29:21:18:36 44.522 -110.359 -2.1 2.9 2008/12/29:20:38:25 44.514 -110.381 -2.1 2.3 2008/12/29:20:38:04 44.511 -110.385 -2.3 1.0 2008/12/29:20:26:29 44.520 -110.355 -2.2 1.9 2008/12/29:20:14:26 44.498 -110.364 -2.3 1.4 2008/12/29:20:13:31 44.508 -110.359 -2.2 2.2 2008/12/29:19:56:46 44.522 -110.365 -1.2 1.2 2008/12/29:19:53:50 44.511 -110.377 -2.2 1.1 2008/12/29:19:46:13 44.515 -110.386 -2.4 1.7 2008/12/29:19:44:50 44.525 -110.373 -0.0 1.7 2008/12/29:19:40:27 44.511 -110.379 -2.5 2.4 2008/12/29:19:37:07 44.502 -110.366 -1.8 1.2 2008/12/29:19:36:08 44.521 -110.385 -2.0 1.7 2008/12/29:19:35:27 44.511 -110.385 -2.4 2.9 2008/12/29:19:29:38 44.513 -110.381 -0.5 2.5 2008/12/29:19:28:55 44.515 -110.381 -0.0 1.8 2008/12/29:19:26:21 44.519 -110.370 -2.0 1.5 2008/12/29:19:24:43 44.520 -110.342 -2.3 3.3 2008/12/29:19:14:49 44.521 -110.369 -1.8 1.2 2008/12/29:18:47:45 44.523 -110.371 -2.1 1.4 2008/12/29:18:40:00 44.533 -110.359 -4.8 1.1 2008/12/29:16:32:12 44.494 -110.360 -2.4 1.6 2008/12/29:16:31:55 44.491 -110.360 -2.3 1.2 2008/12/29:16:15:28 44.480 -110.363 -2.3 1.5 2008/12/29:14:58:37 44.486 -110.354 -1.3 1.7 2008/12/29:10:25:18 44.523 -110.371 -2.4 1.8 2008/12/29:09:14:04 44.527 -110.376 -0.3 2.4 2008/12/29:08:57:55 44.527 -110.378 -0.5 2.4 2008/12/29:08:28:24 44.527 -110.382 -0.4 2.0 2008/12/29:05:30:35 44.517 -110.372 -1.0 2.3 2008/12/29:05:30:04 44.477 -110.349 -6.5 1.7 2008/12/29:05:29:23 44.489 -110.354 -4.2 2.4 2008/12/29:05:23:36 44.516 -110.361 -6.4 1.9 2008/12/29:04:29:18 44.522 -110.385 -1.0 2.8 2008/12/29:04:25:53 44.514 -110.370 -0.1 2.6 2008/12/28:23:57:56 44.521 -110.371 -1.4 2.0 2008/12/28:23:08:25 44.506 -110.377 -1.4 1.8 2008/12/28:22:34:34 44.527 -110.381 -0.5 1.9 2008/12/28:22:32:54 44.534 -110.376 -2.0 2.2 2008/12/28:22:24:20 44.525 -110.375 -0.3 1.5 2008/12/28:21:02:58 44.515 -110.380 -2.1 1.6 2008/12/28:20:56:30 44.505 -110.372 -2.4 1.9 2008/12/28:20:52:56 44.509 -110.385 -2.0 1.5 2008/12/28:20:29:51 44.514 -110.381 -0.1 1.0 2008/12/28:20:29:42 44.523 -110.378 -2.0 1.7 2008/12/28:20:17:28 44.522 -110.377 -2.0 1.9 2008/12/28:20:02:51 44.520 -110.376 -2.1 3.1 2008/12/28:19:55:17 44.511 -110.353 -0.7 1.5 2008/12/28:19:49:31 44.521 -110.372 -2.5 3.0 2008/12/28:19:32:15 44.511 -110.356 -2.7 1.4 2008/12/28:16:32:05 44.514 -110.373 -2.1 1.5 2008/12/28:15:52:38 44.505 -110.374 -2.1 1.3 2008/12/28:15:45:24 44.509 -110.362 -2.4 1.9 2008/12/28:15:43:08 44.500 -110.359 -2.4 2.0 2008/12/28:15:41:24 44.499 -110.361 -2.1 2.8 2008/12/28:15:37:40 44.514 -110.359 -0.0 1.6 2008/12/28:14:39:16 44.498 -110.378 -2.6 1.5 2008/12/28:14:11:26 44.495 -110.359 -2.2 2.0 2008/12/28:14:09:49 44.513 -110.362 -0.1 1.9 2008/12/28:14:05:23 44.519 -110.381 -2.1 1.2 2008/12/28:13:56:46 44.514 -110.364 -0.1 1.1 2008/12/28:13:18:00 44.517 -110.366 -2.1 1.7 2008/12/28:13:08:36 44.496 -110.365 -2.2 1.6 2008/12/28:13:07:52 44.496 -110.365 -2.5 1.7 2008/12/28:12:46:31 44.509 -110.362 -2.1 1.1 2008/12/28:12:42:46 44.468 -110.359 -2.4 1.7 2008/12/28:12:42:06 44.471 -110.367 -7.2 2.0 2008/12/28:12:35:03 44.512 -110.362 -0.4 1.6 2008/12/28:12:19:59 44.515 -110.371 -2.3 2.3 2008/12/28:12:18:53 44.478 -110.365 -1.0 1.8 2008/12/28:12:16:49 44.476 -110.368 -6.3 1.3 2008/12/28:12:00:24 44.475 -110.372 -2.3 1.8 2008/12/28:11:59:50 44.504 -110.365 -2.2 2.1 2008/12/28:11:37:53 44.515 -110.365 -0.0 2.3 2008/12/28:11:02:25 44.484 -110.362 -0.5 2.2 2008/12/28:10:52:06 44.479 -110.361 -6.4 1.5 2008/12/28:10:49:46 44.482 -110.365 -2.4 1.7 2008/12/28:10:46:08 44.510 -110.363 -1.5 1.9 2008/12/28:09:51:10 44.515 -110.371 -0.4 1.9 2008/12/28:09:32:34 44.509 -110.364 -2.1 1.0 2008/12/28:09:30:24 44.514 -110.381 -2.1 1.7 2008/12/28:09:29:57 44.560 -110.475 -3.2 2.2 2008/12/28:09:25:14 44.508 -110.364 -1.9 3.2 2008/12/28:09:23:57 44.511 -110.361 -0.4 1.5 2008/12/28:09:19:26 44.509 -110.358 -2.1 2.7 2008/12/28:09:16:57 44.510 -110.358 -2.6 1.9 2008/12/28:09:14:12 44.489 -110.355 -2.2 1.1 2008/12/28:09:13:54 44.507 -110.371 -0.4 1.9 2008/12/28:09:09:18 44.492 -110.366 -2.4 2.0 2008/12/28:09:07:52 44.500 -110.361 -0.4 2.1 2008/12/28:09:03:18 44.486 -110.356 -2.2 1.3 2008/12/28:08:57:55 44.501 -110.359 -2.1 1.5 2008/12/28:08:41:33 44.509 -110.359 -2.5 2.2 2008/12/28:08:23:41 44.506 -110.369 -0.1 1.1 2008/12/28:08:22:46 44.499 -110.362 -2.5 1.3 2008/12/28:08:22:24 44.499 -110.361 -2.3 1.7 2008/12/28:08:15:33 44.499 -110.364 -2.1 1.0 2008/12/28:08:14:58 44.501 -110.380 -5.3 1.9 2008/12/28:07:16:13 44.513 -110.374 -2.0 2.5 2008/12/28:07:15:18 44.495 -110.359 -0.0 2.5 2008/12/28:06:37:41 44.492 -110.356 -2.6 2.0 2008/12/28:06:37:20 44.497 -110.379 -2.1 1.0 2008/12/28:06:14:58 44.488 -110.357 -2.2 2.2 2008/12/28:06:11:00 44.488 -110.359 -0.4 1.3 2008/12/28:06:07:46 44.493 -110.367 -2.4 1.9 2008/12/28:06:06:27 44.482 -110.370 -2.1 2.4 2008/12/28:06:02:21 44.508 -110.364 -1.0 1.2 2008/12/28:06:01:38 44.497 -110.376 -2.3 2.1 2008/12/28:06:00:46 44.493 -110.377 -2.4 1.5 2008/12/28:05:59:31 44.510 -110.378 -1.8 1.0 2008/12/28:05:59:03 44.498 -110.371 -3.0 1.9 2008/12/28:05:52:01 44.499 -110.362 -2.1 1.8 2008/12/28:05:44:41 44.485 -110.379 -2.2 1.9 2008/12/28:05:28:49 44.498 -110.383 -2.3 1.9 2008/12/28:05:28:05 44.485 -110.371 -2.5 1.8 2008/12/28:05:26:14 44.484 -110.359 -2.0 1.2 2008/12/28:05:26:03 44.470 -110.355 -5.2 1.3 2008/12/28:05:24:39 44.489 -110.359 -4.1 2.8 2008/12/28:05:23:54 44.489 -110.354 -2.5 1.9 2008/12/28:05:21:16 44.480 -110.344 -4.0 1.7 2008/12/28:05:20:10 44.494 -110.379 -2.4 1.6 2008/12/28:05:19:11 44.492 -110.372 -2.2 3.9 2008/12/28:05:15:56 44.502 -110.366 -0.3 2.7 2008/12/28:04:51:03 44.501 -110.355 -2.3 1.8 2008/12/28:04:50:22 44.500 -110.363 -2.4 1.3 2008/12/28:04:40:16 44.497 -110.379 -2.2 1.4 2008/12/28:04:33:44 44.508 -110.369 -2.0 1.6 2008/12/28:03:21:59 44.496 -110.365 -2.5 1.9 2008/12/28:03:01:58 44.504 -110.367 -0.4 1.2 2008/12/28:03:01:33 44.500 -110.370 -2.5 1.2 2008/12/28:02:53:06 44.495 -110.368 -2.3 2.0 2008/12/28:02:52:04 44.497 -110.362 -2.3 2.2 2008/12/28:02:51:21 44.498 -110.362 -0.4 1.5 2008/12/28:02:50:11 44.494 -110.362 -2.5 1.3 2008/12/28:02:49:49 44.498 -110.359 -3.1 1.8 2008/12/28:02:42:06 44.495 -110.362 -2.2 1.9 2008/12/28:02:38:34 44.495 -110.360 -2.4 2.6 2008/12/28:00:08:50 44.493 -110.354 -0.4 3.3 2008/12/27:22:30:03 44.498 -110.358 -4.3 1.5 2008/12/27:22:28:53 44.500 -110.368 -2.1 1.8 2008/12/27:22:27:36 44.499 -110.367 -2.5 1.0 2008/12/27:21:28:06 44.500 -110.362 -3.5 1.6 2008/12/27:21:22:08 44.495 -110.372 -2.6 2.1 2008/12/27:21:08:49 44.496 -110.370 -2.0 3.2 2008/12/27:20:26:27 44.505 -110.364 -2.4 3.5 2008/12/27:20:17:33 44.488 -110.357 -4.1 2.3 2008/12/27:18:56:35 44.484 -110.367 -0.5 3.0 2008/12/27:18:23:07 44.495 -110.364 -2.8 2.0 2008/12/27:18:21:36 44.493 -110.362 -7.2 1.2 2008/12/27:17:01:46 44.484 -110.373 -2.4 2.7 2008/12/27:17:01:07 44.490 -110.366 -1.2 2.6 2008/12/27:16:30:54 44.498 -110.362 -2.5

Replies are listed 'Best First'.
Re: Earthquakes in three dimensions
by zentara (Archbishop) on Jan 02, 2009 at 11:46 UTC
    Nicely done.

    I wonder if global warming can be blamed? :-) My thoughts would go like this: Increased Co2 causes a warming blanket around earth. This temp rise causes the magma to start thermally expanding throughout the entire globe's interior. The safety release valve (Yellowstone) is starting to steam and rumble.

    Another reason to forget about my new years resolutions.


    I'm not really a human, but I play one on earth Remember How Lucky You Are
Re: Earthquakes in three dimensions
by sflitman (Hermit) on Jan 02, 2009 at 11:25 UTC
    Nicely done! So, are we at risk for a supervolcanic eruption? I'm guessing...not for the next century or so...

    SSF

Re: Earthquakes in three dimensions
by Anonymous Monk on Jan 02, 2009 at 15:54 UTC
    cool. Any way to connect the dots?
      print $GNUPLOT_IOH "set style data line\n";
Re: Earthquakes in three dimensions
by spiritway (Vicar) on Jan 07, 2009 at 02:29 UTC
    I love it! I just read an article about Yellowstone becoming a "supervolcano", written in 2004. The image they painted was grim - 6-meter-deep ash for hundreds of miles, widespread devastation, and on and on, like a Jerry Brukheimer movie but without the popcorn.
Re: Earthquakes in three dimensions
by BioNrd (Monk) on Jan 08, 2009 at 17:04 UTC
    That is really excellent. I wonder though is there a way to include the magnitude data, say by color or symbol differences?

    ---- Even a blind squirrel finds a nut sometimes.
      Untested advice: try changing
      "splot '-' using 4:3:5\n"
      to
      "splot '-' using 4:3:5:1 with points pointsize variable\n"
      or
      "splot '-' using 4:3:5:(2*$1) with points pointsize variable\n"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://733670]
Approved by Corion
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-03-19 04:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found