MODIS Rapid Response System Global Fire Maps

How to download all files at once and create an animation

NASA distributes an archive of near real-time maps of global fires : Each of these fire maps accumulates the locations of the fires detected by MODIS on board the Terra and Aqua satellites over a 10-day period. Each colored dot indicates a location where MODIS detected at least one fire during the compositing period. Color ranges from red where the fire count is low to yellow where number of fires is large. The compositing periods are referenced by their start and end dates (julian day). The duration of each compositing period was set to 10 days. Compositing periods are reset every year to make year-to-year comparisons straightforward. The first compositing period of each year starts on January 1. The last compositing period of each year includes a few days from the next year.

Here are some instructions to download and produce an animation from these files.

Result

MODIS Rapid Response System Global Fire Maps from MichaŽl Delorme on Vimeo.

download.php

NB : A webcrawler could be used instead of this script (e.g. wget) from http://rapidfire.sci.gsfc.nasa.gov/firemaps/.

<?php      
/**
 * Download images from the MODIS Rapid Response System Global Fire Maps archives
 * 
 * 
 */
 
$strSize = '2048x1024'; 
// '4096x2048' 
// '8192x4096'

$fnDest = './img/';

/*--------------------*/

$urlBase = 'http://rapidfire.sci.gsfc.nasa.gov/firemaps/';

header("Content-type: text/plain\r\n" );
$fnLog = 'log.txt';
$hdlLog = fopen($fnLog, 'a');

for($y = 2000; $y <= date('Y'); $y++) {
	$intMaxDayYear = date('L', mktime(0,0,0,1,1,$y)) ? 366 : 365;
	
	for($d = $y == 2000 ? 61 : 1; 
	  ($y != date('Y') && $d <= $intMaxDayYear) || ($y == date('Y') && $d + 18 <= date('z'));
	  $d = $d + 10) {
		$strMinDate = sprintf("%04d%03d", $y, $d);		
		$strMaxDate = $d + 9 > $intMaxDayYear ? sprintf("%04d%03d", $y + 1, $d + 9 - $intMaxDayYear) : sprintf("%04d%03d", $y, $d + 9);
		$strFn = 'firemap.' . $strMinDate .'-'. $strMaxDate .'.'. $strSize .'.jpg';
		out("-> $strFn");
		
		$tmp = @file_get_contents($urlBase . $strFn);
		if ($tmp)  {
			out("    $strFn downloaded");
		}
		else {
			out("    Error downloading $strFn\n");
			continue;
		}
		
		$tmp2 = @file_put_contents($fnDest . $strFn, $tmp);
		if ($tmp2)  {
			out("    $strFn saved ($tmp2 bytes)\n");
		}
		else {
			out("    Error writing $strFn\n");
		}
		
	}
}

fclose($hdlLog);
echo "Logfile written in $fnLog.\n\n";

function out($strOut) {
	global $hdlLog;
	
	echo $strOut ."\n";
	fwrite($hdlLog, $strOut ."\n");
}

?>
      

Some files (less than five) are oddly named (they don't belong to a standard 10 days period) and don't adhere to the common filename convention. They must be downloaded manually.

Animation

In Sony Vegas :

  1. Options / Preferences / Editing :
    • New still image length : 0.150 s
    • Automatically overlap multiple selected media when added : checked
    • Cut-to-overlap conversion / Amount : 0.05 s
  2. Add all images in the timeline.
  3. Add titles, music and render...