Re: Extracting METAR Data from Personal Weather Station
Brought to you by:
iridium
From: Martin G. <gim...@gi...> - 2003-04-16 18:29:59
|
"Jake Ortman" <ja...@or...> writes: > OK, I know I discussed this before, but the output wasn't as good as I > would've liked, mostly because the data sucked. > > Anyway, we'll try this again. I can get access to a "metar.txt" file > from a local weather station that contains the following: > > "METAR SNRV 072215Z AUTO 18308KT 13/01 A3016 RMK A02 SLP212 NOSPECI P0000 > T01310015" Great, that should be enough. > Any ideas? I'm not a wonderful PHP programmer by any means, and it > was probably a fluke I got the print_table to work for me to begin > with :). Hehe, I don't think this should be that difficult :-) Since your file contains just the one METAR for your local airport, then I think the easiest way would be to change get_metar_file() in data_retrieval.php to this function get_metar_file($icao) { if ($icao == 'SNRV') { return file('full/pathname/to/your/metar.txt'); } else { $host = 'weather.noaa.gov'; $location = "/pub/data/observations/metar/stations/$icao.TXT"; return @file('http://' . $host . $location); } } That should implement an override so that the METAR for SNRV will be fetched from the local file somewhere on your filesystem, and the rest will still be fetched from the NWS. The rest of the logic with caching should still work, as far as I can see... -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather: Shows the current weather on your webpage and PHP Shell: A telnet-connection (almost :-) in a PHP page. Join Freenet: http://gimpster.com/downloads/freenet/ |