How to use the metar.Datatypes.direction.compass_dirs function in metar

To help you get started, we’ve selected a few metar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python-metar / python-metar / metar / Datatypes.py View on Github external
def __init__(self, d):
        if d in direction.compass_dirs:
            self._compass = d
            self._degrees = direction.compass_dirs[d]
        else:
            self._compass = None
            value = float(d)
            if value < 0.0 or value > 360.0:
                raise ValueError("direction must be 0..360: '" + str(value) + "'")
            self._degrees = value