Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

scot (6695)

scot
  (email not shown publicly)
http://redcloudresearch.com/

Perl hacker
"apprentice" sysadmin for ASP running Sparc-Solaris-Java-Oracle stack

Journal of scot (6695)

Tuesday May 29, 2007
05:45 PM

Automated extraction of NOAA weather satellite images

[ #33367 ]

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" ;
};

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.