Turbo87 / aerofiles

waypoint, task, tracklog readers and writers for aviation
http://aerofiles.readthedocs.org/
MIT License
45 stars 27 forks source link

aerofiles do not decode frequencies of NDBs and VORs #273

Closed lordfolken closed 10 months ago

lordfolken commented 10 months ago

Hello,

OpenAIP exports files for Navaids (NDB, VORs...) The Frequency field is set to the navaid's frequency, and currently aerofiles does not seem to like these:


./output/content/waypoint/country/CK-WPT-National-OpenAIP.cup
Traceback (most recent call last):
  File "/home/folken/git-xcsoar/xcsoar-data-content/./script/check/check_waypoints.py", line 9, in <module>
    cupfile.read(open(str(sys.argv[1])))
  File "/home/folken/git-xcsoar/xcsoar-data-content/lib/python3.11/site-packages/aerofiles/seeyou/reader.py", line 59, in read
    waypoint = self.decode_waypoint(fields)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/folken/git-xcsoar/xcsoar-data-content/lib/python3.11/site-packages/aerofiles/seeyou/reader.py", line 94, in decode_waypoint
    'frequency': self.decode_frequency(fields[self.headers.index('freq')]),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/folken/git-xcsoar/xcsoar-data-content/lib/python3.11/site-packages/aerofiles/seeyou/reader.py", line 219, in decode_frequency
    raise ParserError('Reading frequency failed')

Sample File:

"AITUTAKI","AI",CK,1849.490S,15946.404W,8.0M,10,,,320.000,"NAVAID, ID AI, Frequency 320.000, , Magnetic declination 13.352, Aligned to true north FALSE"
"ATIU","AT",CK,2000.187S,15806.370W,67.0M,10,,,388.000,"NAVAID, ID AT, Frequency 388.000, , Magnetic declination 13.757, Aligned to true north FALSE"
"MANIHAKI","MH",CK,1022.789S,16100.073W,4.0M,10,,,380.000,"NAVAID, ID MH, Frequency 380.000, , Magnetic declination 11.049, Aligned to true north FALSE"

So the question is whether the check is too strict, or whether this is bending the standard.

lordfolken commented 10 months ago

Rereading the document it seems the field is not to be used for other frequencies

11 Airport Frequency
key: freq
Number field representing the frequency of the airport of length 7. Decimal separator must be a point. It
can also be embraced in double quotes: https://en.wikipedia.org/wiki/Airband and is used only in
connection with waypoint styles 2, 3, 4, 5.
Example: 122.355