How to use the metar.Metar.debug 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 / test / test_metar.py View on Github external
def test_xlate_loc():
    """Test that xlate_loc does the right thing."""
    Metar.debug = True
    report = Metar.Metar(
        "METAR KEWR 111851Z VRB03G19KT 2SM R04R/3000VP6000FT TSRA BR FEW015 "
        "BKN040CB BKN065 OVC200 22/22 A2987 RMK AO2 PK WND 29028/1817 WSHFT "
        "1812 TSB05RAB22 SLP114 FRQ LTGICCCCG TS OHD AND NW-N-E MOV NE "
        "P0013 T02270215"
    )
    mstring = str(report)
    assert mstring.find("thunderstorm overhead") > -1
github python-metar / python-metar / parse_metar.py View on Github external
silent = False
report = True
debug = False
prof = False

try:
    opts, files = getopt.getopt(sys.argv[1:], 'dpqs')
    for opt in opts:
        if opt[0] == '-s':
            silent = True
            report = False
        elif opt[0] == '-q':
            report = False
        elif opt[0] == '-d':
            debug = True
            Metar.debug = True
        elif opt[0] == '-p':
            prof = True
except:
    usage()

def process_line(line):
    """Decode a single input line."""
    line = line.strip()
    if len(line) and line[0] == line[0].upper():
        try:
            obs = Metar.Metar(line)
            if report:
                print("--------------------")
                print(obs.string())
        except Metar.ParserError as exc:
            if not silent: