[wxqc] Text to Degrees

Shell Shrader shell at shellware.com
Sun Apr 8 19:46:33 CDT 2007


I don't average wind direction.. I capture it based on the last recorded direction.

Conversion between degrees and text looks like so (assumes 16 points of granularity):

Private Function ConvertDirection(ByVal dDegrees As Single) As String
Select Case dDegrees
Case 0
ConvertDirection = "N"
Case 22.5
ConvertDirection = "NNE"
Case 45
ConvertDirection = "NE"
Case 67.5
ConvertDirection = "ENE"
Case 90
ConvertDirection = "E"
Case 112.5
ConvertDirection = "ESE"
Case 135
ConvertDirection = "SE"
Case 157.5
ConvertDirection = "SSE"
Case 180
ConvertDirection = "S"
Case 202.5
ConvertDirection = "SSW"
Case 225
ConvertDirection = "SW"
Case 247.5
ConvertDirection = "WSW"
Case 270
ConvertDirection = "W"
Case 292.5
ConvertDirection = "WNW"
Case 315
ConvertDirection = "NW"
Case 337.5
ConvertDirection = "NNW"
Case Else
ConvertDirection = dDegrees.ToString
End Select
End Function

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://server.gladstonefamily.net/pipermail/wxqc/attachments/20070408/11707e26/attachment.htm 


More information about the wxqc mailing list