Skip to content

Commit

Permalink
BUG: Fix parsing METAR code for smoke (Fixes Unidata#1951)
Browse files Browse the repository at this point in the history
Parser was not dealing well with a lot of weather code fields, so
restructure just to look for sequences of any of those codes.
  • Loading branch information
dopplershift committed Aug 5, 2021
1 parent b4b7864 commit f3c1bb3
Show file tree
Hide file tree
Showing 3 changed files with 398 additions and 342 deletions.
2 changes: 1 addition & 1 deletion src/metpy/io/_metar_parser/metar_parser.peg
Expand Up @@ -13,7 +13,7 @@ varwind <- sep [\d] [\d] [\d] "V" [\d] [\d] [\d]
vis <- ((sep ( ([\d] [\d] [\d] [\d] ("NDV")?) / ([\d] ([\d] / ((" " [\d])? "/" [\d]))? "SM") / "CAVOK")))?
run <- ((sep "R" [LRC]? [\d] [\d] [LRC]? "/" ([\d] [\d] [\d] [\d] "V")? ["M" / "P"]? [\d] [\d] [\d] [\d] "FT"))?
curwx <- (((sep (wx))*))?
wx <- (([-+] / "VC")? ("MI" / "PR" / "DR" / "BL" / "SH" / "TS" / "FG" / "TS" / "FZ" / "RA" / "BR" / "HZ" / "SN") ([-+])? ("RA" / "BR" / "DZ" / "FG" / "FU" / "VA" / "DU" / "SA" / "SA" / "HZ" / "PY")?)
wx <- (([-+] / "VC")? ("MI" / "BC" / "PR" / "DR" / "BL" / "SH" / "TS" / "FZ" / "DZ" / "RA" / "SN" / "SG" / "PL" / "GR" / "GS" / "UP" / "BR" / "FG" / "FU" / "VA" / "DU" / "SA" / "HZ" / "PO" / "SQ" / "FC" / "SS" / "DS")+)
skyc <- ((sep (cover))*)?
cover <- (("FEW" / "SCT" / "BKN" / "OVC" / "VV" / "///") ([\d]*)? ("TCU" / "CB" / "///")?) / ("CLR" / "SKC" / "NSC" / "NCD") / wx / "//"
temp_dewp <- ((sep "//"? temp "/" dewp "//"?))?
Expand Down

0 comments on commit f3c1bb3

Please sign in to comment.