/*
   ###########################################################################
   This function returns the closest compass symbol corresponding to azimuth
   angle in degrees and zero-mode.  Default zero azimuth direction is north,
   in accordance with the geographic standard.

   ZModeNS = 'N' (North = 0 convention)

   The compass is divided into 16 named directions.

  ---------------------------------------
    AZIMUTH ANGLE CLOCKWISE FROM NORTH

  Symbol     direction        Angle Deg.
  ------  ---------------     ----------
    N     North                  0.0
    NNE   North Northeast       22.5
    NE    Northeast             45.0
    ENE   East Northeast        67.5
    E     East                  90.0
    ESE   East Southeast       112.5
    SE    Southeast            135.0
    SSE   South Southeast      157.5
    S     South                180.0
    SSW   South Southwest      202.5
    SW    Southwest            225.0
    WSW   West Southwest       247.5
    W     West                 270.0
    WNW   West Northwest       292.5
    NW    Northwest            315.0
    NNW   North Northwest      337.5
    N     North                360.0

   NO DEPENDENCIES

   ERRORS:
   FALSE is returned if angular argument is non-numeric.
   ###########################################################################
*/

   function Compass_Symbol ($AzimDeg)
{
   $ZModeN0 = 'N  NNENE ENEE  ESESE SSES  SSWSW WSWW  WNWNW NNWN';

   $a = trim($AzimDeg);  if (!Is_Numeric($a)) {return FALSE;}

   $a -= 360*floor($a/360);

   $i = ($a < 11.25 or $a > 348.75)? 0:floor(0.5 + $a/22.5);

   return trim(substr($ZModeN0, 3*$i, 3));

} // End of  Compass_Symbol (...)