Skip to content

Commit 890fe6a

Browse files
authored
fix: metar rmk not parsed following trends (#129)
Resolves #122
1 parent ae17bab commit 890fe6a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/parser/parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ export class MetarParser extends AbstractParser {
292292
i < trendParts.length &&
293293
trendParts[i] !== this.TEMPO &&
294294
trendParts[i] !== this.INTER &&
295-
trendParts[i] !== this.BECMG
295+
trendParts[i] !== this.BECMG &&
296+
trendParts[i] !== this.RMK
296297
) {
297298
if (
298299
trendParts[i].startsWith(this.FM) ||

tests/parser/parser.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,19 @@ describe("MetarParser", () => {
587587
expect(metar.remarks).toHaveLength(1);
588588
});
589589

590+
// https://github.com/aeharding/metar-taf-parser/issues/122
591+
test("TEMPO followed by RMK parses remark correctly", () => {
592+
const metar = new MetarParser(en).parse(
593+
"EGLL 231250Z 14012G22KT 2000 +TSRA FG BKN008 SCT025CB OVC050 18/17 Q1010 TEMPO 1000 -SHRA RMK QFE998",
594+
);
595+
596+
expect(metar.trends).toHaveLength(1);
597+
expect(metar.trends[0].type).toBe(WeatherChangeType.TEMPO);
598+
expect(metar.trends[0].raw).toBe("TEMPO 1000 -SHRA");
599+
expect(metar.remark).toBe("QFE998");
600+
expect(metar.remarks).toHaveLength(1);
601+
});
602+
590603
test("with 'none' runway deposit", () => {
591604
const input = "UUWW 151030Z 34002MPS CAVOK 14/02 Q1026 R01/000070 NOSIG";
592605

0 commit comments

Comments
 (0)