![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#2
|
|||
|
|||
|
In a previous article, "Bravo" said:
For you computer savvy folks in the newsgroup..... if I wanted to build a web page for my airport that provided live METAR data, where could I get the data from ? I see that the NWS web site has free software for decoding the Do what I do for http://xcski.com/~ptomblin/taf.html - write a perl script to go out to the NOAA site and download it, and run it once an hour or two out of cron. #!/usr/bin/perl -w # Get TAF file use Net::FTP; use Net::FTP::dataconn; my @stations = ("KROC", "KBUF", "KSYR", "KART", "CYOW"); my $ftp = Net::FTP-new("weather.noaa.gov", Timeout = 600, Passive = 1); if (!$ftp) { die "couldn't open ftp site"; } $ftp-login("anonymous"); my $br = 'BR'; $ftp-cwd("/data/forecasts/taf/stations/"); my $outstr = "HTMLHEADTITLELocal Aviation Weather/TITLE/HEAD\n"; $outstr .= "BODYH1TAFs/H1\n"; $outstr .= "TABLE BORDER=1\n"; foreach $station (@stations) { $outstr .= "TR\n"; $outstr .= "TD$station/TD\n"; my $dataconn = $ftp-retr($station . ".TXT"); die "TAF can't get $station" if (!defined($dataconn)); my $taf; my $numbytes = $dataconn-read($taf, 10000); $taf =~ s/\n/$br\n/g; $outstr .= "TD$taf/TD\n"; $outstr .= "/TR\n"; $dataconn-abort; } $outstr .= "/TABLE\n"; $outstr .= "H1METARs/H1\n"; $ftp-cwd("/data/observations/metar/stations/"); $outstr .= "TABLE BORDER=1\n"; foreach $station (@stations) { $outstr .= "TR\n"; $outstr .= "TD$station/TD\n"; my $dataconn = $ftp-retr($station . ".TXT"); die "METAR can't get $station" if (!defined($dataconn)); my $metar; my $numbytes = $dataconn-read($metar, 10000); $metar =~ s/\n/$br\n/g; $dataconn-abort; $outstr .= "TD$metar/TD\n"; $outstr .= "/TR\n"; } $outstr .= "/TABLE\n"; $ftp-quit; $outstr .= "/BODY/HTML\n"; my $fn = shift; open(TAF, "$fn") ; print TAF $outstr; close TAF; -- Paul Tomblin http://xcski.com/blogs/pt/ "Legacy (adj): an uncomplimentary computer-industry epithet that means 'it works'." -- Anthony DeBoer |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how can you get live METAR data ? - long | Bob Fry | General Aviation | 4 | November 5th 04 07:19 AM |
| Pirep: Garmin GPSMAP 296 versus 295. (very long) | Jon Woellhaf | Piloting | 12 | September 5th 04 12:55 AM |
| No METAR Data at AOPA and NWS? | Scott Lowrey | Piloting | 4 | March 3rd 04 08:19 PM |
| Aviation Insurance History, data, records? | cloudclimbr | General Aviation | 0 | February 17th 04 04:36 AM |
| Air Force conducts live test of MOAB | Otis Willie | Military Aviation | 0 | November 21st 03 11:45 PM |