GabrielRogd / VatPy

A series of Python scripts that fetches ping times from VATSIM's API and, in addition, can fetch & (partly) decode METAR data.
0 stars 0 forks source link

metar.py crashing due to mutliple backslashes within METAR #7

Open GabrielRogd opened 5 months ago

GabrielRogd commented 5 months ago
gabriel@Gabriels-MacBook-Pro VatPy % /usr/local/bin/python3 /Users/gabriel/Desktop/VatPy/src/metar.py
Enter the ICAO code: egll
METAR: EGLL 280850Z AUTO 17011KT 9999 FEW028/// //////TCU 07/03 Q0978 NOSIG
Would you like this to be decoded? (yes/no): 
Traceback (most recent call last):
  File "/Users/gabriel/Desktop/VatPy/src/metar.py", line 121, in <module>
    main()
  File "/Users/gabriel/Desktop/VatPy/src/metar.py", line 116, in main
    decoded_METAR = decode_METAR(METAR)
                    ^^^^^^^^^^^^^^^^^^^
  File "/Users/gabriel/Desktop/VatPy/src/metar.py", line 53, in decode_METAR
    if dew_point[0] == "0":
       ~~~~~~~~~^^^
IndexError: string index out of range

That's what the output looks like when you're trying to decode a METAR that looks like this.

GabrielRogd commented 5 months ago

That backslash represents that within the vicinity of an airport, there's rain. I will make an attempt to disintegrate it from the rest of the METAR output.

GabrielRogd commented 5 months ago

Due to my personal focusing on my computer science studies, don't anticipate the fix anytime soon.