Automated extraction of NOAA weather satellite images

scot on 2007-05-29T22:45:27

NOAA updates its weather satellite images on the GOES website every 30 minutes, with images in infrared, visible light, and water vapor wavelengths; for both the eastern and western halves of the US. The script below grabs those images and saves them to a local file with a timestamp. Could prove useful for doing your own weather forecasting or whatever....I have updated the script to use the "strftime" function from the POSIX module,and the filenames now are very precise (for example "eastconusir20070530_074348.jpg"). I also updated the script to timestamp the images with Greenwich Mean Time...thanks to graff and jasonk over at Perlmonks for their feedback...


use strict;
use LWP::Simple;
use POSIX;

my $image; my $url; my %images = ( "eastconusir" => "http://www.goes.noaa.gov/GIFS/ECIR.JPG", "eastconusvis" => "http://www.goes.noaa.gov/GIFS/ECVS.JPG", "eastconuswv" => "http://www.goes.noaa.gov/GIFS/ECWV.JPG", "westconusir" => "http://www.goes.noaa.gov/GIFS/WCIR.JPG", "westconusvis" => "http://www.goes.noaa.gov/GIFS/WCVS.JPG", "westconusvwv" => "http://www.goes.noaa.gov/GIFS/WCWV.JPG", );



foreach my $key (keys %images) { print $key."\n"; my $epoch = ( head( $images{$key} ) )[ 2 ] || next; my $timestring = strftime( "%Y%m%d_%H%M%S", gmtime( $epoch ) ); print $timestring."\n"; print $images{$key}."\n"; my $status = getstore($images{$key},$key.$timestring.".jpg"); print $status."\n" ; };