Oil in the Gulf

Posted Monday, May 24, 2010 at 11:12 a.m. by Chris Amico in Projects about JavaScript, journalism, JQuery and programming

By now, I'm pretty sure anyone who reads this blog has seen the widget the PBS NewsHour launched a few weeks ago. Those ticking numbers have been embedded on dozens of websites, bringing thousands of new visitors our site.

So it's probably worth mentioning up front that at first, I thought building this thing was a bad idea. I thought it was gimmicky, and that it assigned specificity where there was none. I argued that any number we pick as the rate of spillage was almost guaranteed to be wrong, since the government, BP and outside experts were all changing their estimates and estimates varied so widely. Also, I didn't think I could do it.

My colleague Dave had the idea a few weeks ago. No one, he rightly pointed out, was keeping track of how much oil had spilled into the Gulf of Mexico. The leak had been going on for less than two weeks at the time, and most news reports only noted the daily spill rate.

Figuring out how much had spilled based on when the leak started and how many barrels or gallons per day were leaking isn't hard: total = rate * time. I've been joking at work that the past month has been all eighth-grade algebra and JavaScript.

But as I mentioned, picking the right rate is probably impossible. The official rate, from the US Coast Guard and NOAA went from 1,000 barrels per day to 5,000 to some unknown number greater than 5,000. Outside experts have said anywhere from 25,000 to 100,000 barrels a day could be leaking. BP told Congress it could be as high as 60,000 barrels a day (then called such estimates "alarmist").

So the challenge was to build a tool that would do simple math, but had all the uncertainty of the situation baked in. Hence the slider. That way, we let users pick which estimates they believe, and the ticker shows them how much oil has leaked into the Gulf based on that figure.

When BP began siphoning oil directly out of the well using a mile-long tube, I rewrote part of the code to subtract that amount from the leak rate--after the user had picked a leak rate. When BP increased, then decreased, the amount of oil it was capturing, I rewrote the main function again. Now, each time BP tells us how much oil it is sucking up, we create another time segment, adjusted by the siphoned amount, and add it to the total. If this sounds confusing, well, thank BP.

I mentioned above that I didn't think I could build the ticker, let alone one with a user-adjustable rate and increasingly-complicated math. The fact that this project is doable is really a credit to jQuery and its contributors, who've really made some incredible things almost easy. Almost.


may 24, 2010 at 11:36 p.m. // Alex said:

Beyond Petroleum indeed. I'm a huge fan of fan charts like these for projecting uncertainty, is there sufficient range in estimates to create a confidence interval?

Comments are closed for this post. If you still have something to say, please email me.