[wxqc] Text to Degrees
Keith Miller
kdmiller at oldsgmail.com
Sun Apr 8 21:13:05 CDT 2007
> -----Original Message-----
> From: wxqc-bounces at lists.gladstonefamily.net
[mailto:wxqc-bounces at lists.gladstonefamily.net]On Behalf Of Steve
Hatchett
> Sent: Sunday, April 08, 2007 9:52 PM
> To: 'Discussion of weather data quality issues'
> Subject: Re: [wxqc] Text to Degrees
>
>
> For converting degrees to text, I like the following:
> http://www.tnetweather.com/nb-0002.php
>
> which is basically a two line function
> $windlabel = array ("N","NNE", "NE", "ENE", "E", "ESE", "SE", "SSE",
"S",
> "SSW","SW", "WSW", "W", "WNN", "NW", "NNW");
> $dir = $windlabel[ fmod((($winddir + 11) / 22.5),16) ];
>
Gee, that looks more complicated than mine:
function Deg2Card($degrees)
{
$cardinal = array('N','NNE', 'NE',
'ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','
N');
return $cardinal[round(($degrees / 22.5), 0)];
}
Keith
--
CW5250 => http://weather.stadhaugh.com
More information about the wxqc
mailing list