From: Thierry B. <th...@so...> - 2002-02-04 10:42:26
Hi,
Thank you for your great work.
However I've a little question, I'm trying to know the current weather for
my town (NICE in France).
I can get several informations but how can I know if it's raining or not ?
Thanks.
Thierry
From: Martin G. <gim...@gi...> - 2002-02-04 20:25:10
Thierry Bucco <th...@so...> writes:
> Hi,
>
> Thank you for your great work.
>
> However I've a little question, I'm trying to know the current
> weather for my town (NICE in France).
>
> I can get several informations but how can I know if it's raining or
> not ?
Hmm - you could look at the 'weather' entry in the decoded metar, but
that contains the whole description.
The codes for rain (or precipitation as it's called in the
documentation) can be found here:
http://tgsv5.nws.noaa.gov/oso/oso1/oso12/fmh1/fmh1ch12.htm
Look at section 12.6.8. So you could figure out if it's raining by
doing something like this:
$metar = get_metar('NICE');
if (ereg('(RA|DZ|SN|SG|GR|GS|PE|IC|UP)', $metar) {
echo "It's raining!";
} else {
echo "No rain.";
}
I hope that helps you.
--
Martin Geisler My GnuPG Key: 0xF7F6B57B
See my homepage at http://www.gimpster.com/ for:
PHP Weather => Shows the current weather on your webpage.
PHP Shell => A telnet-connection (almost :-) in a PHP page.