avwx-rest/avwx-api

Error parsing statute mile visibility value

Closed this issue · 4 comments

When parsing the example TAF below the highlighted visibility is returned with an incorrect value:

CYBC 051338Z 0514/0602 09018G28KT 1/2SM SN VV005 TEMPO 0514/0515 2SM -SN OVC012 FM051500 05012G22KT 11/2SM -SN VV008 TEMPO 0515/0523 3SM -SN OVC010 BECMG 0518/0520 34010KT FM052300 32008KT P6SM BKN030 TEMPO 0523/0601 5SM -SN BKN020 FM060100 31008KT P6SM SCT030 RMK FCST BASED ON AUTO OBS. NXT FCST BY 052000Z

"visibility": { "repr": "11/2", "value": 5.5, "spoken": "five and one half", "numerator": 11, "denominator": 2, "normalized": "5 1/2" }

The numerator should only ever be the single digit before the slash. The preceding figures are units.

I assume this is also true for all double-digit numerator values like "13/4SM" -> 1.75 ?

Is this also applied to other fields or just visibility?

Yes. My understanding is that a statue mile visibility group will only ever have a single digit numerator. According the the NOAA definition a correctly formed visibility element in a North American TAF should have a space between the whole miles and the fraction but I guess that’s not always followed.

I believe only visibility has these fractions. The only other slash characters are in date/time groups and wind shear groups but they are not used to denote fractions.

Ok. That should be an easy fix. It will have to be stuff behind an avwx-engine feature release, but I’ll comment back when it’s deployed.

Sorry for taking so long. The root issue here has been fixed and should be available on the server now.

>>> make_number('11/4')
Fraction(repr='5/4', value=1.25, spoken='one and one quarter', numerator=5, denominator=4, normalized='1 1/4')