Re: metar decoding
| From: | MVCS | Date: | Fri, 09 May 2003 22:25:29 +0000 |
| Subject: | Re: metar decoding | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147071@lists.php.net to get a copy of this message | ||
Bryan,
Even though I've barely managed to distinguish my arse from a hole in the
ground php-wise, I came to this group for metar-related problems as well.
What I've ended up doing is using NOAA's decoded metar for my local
monitoring station, reading that text file into an array, then echoing
whichever line of that array i need, and not using the ones I don't.
what i've come up with:
<?php
$weather = file
('http://205.156.51.200/pub/data/observations/metar/decoded/KLRU.TXT');
echo '<b>Current conditions for Anytown, USA</b><br>';
echo $weather[1] . '<br>';
echo $weather[2] . '<br>';
echo $weather[3] . '<br>';
echo $weather[4] . '<br>';
echo $weather[5] . '<br>';
?>
etc...
"Bryan Koschmann - Gkt" <gktnews@gktech.net> wrote in message
news:Pine.LNX.4.30.0305091222360.1215-100000@penguin.gktech.net...
> Hi,
>
> I was wondering, does anyone here have any experience decoding metar
> output? I know ther eis PHP weather, but that is far too much for what I
> want (plus i cant get it working anyway).
>
> I just want to get simple values that I can do what I want with.
>
> If it helps, this is what the output looks like:
>
> 2003/05/09 17:53
> KSFF 091753Z 06008G18KT 10SM SCT090 SCT200 16/01 A3000 RMK AO2 SLP158
> T01560011 10156 20044 50002
>
> The second line is always on one line. I know I can break it up using
> explode, but then I have to get things like this;
>
> 091753Z I need the 09 and the 1753 separated and do not need the Z
> 10SM I need just the 10
> SCT090 I need SCT and 090 separated
> SCT200 I need SCT and 200 separated
>
> There are of course others, but that would at least get me started.
>
> I'm sure it's just a matter of regular expressions, but my brain is having
> trouble grasping those ideas.
>
> If you have any ideas I'd be happy to hear them!
>
> Thanks,
>
> Bryan
>