metar-taf-parser 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/locale/en.d.ts +6 -0
- package/locale/en.js +9 -3
- package/metar-taf-parser.d.ts +32 -3
- package/metar-taf-parser.js +60 -2
- package/package.json +1 -1
package/locale/en.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ declare const _default: {
|
|
|
142
142
|
ALQDS: string;
|
|
143
143
|
AO1: string;
|
|
144
144
|
AO2: string;
|
|
145
|
+
AO2A: string;
|
|
145
146
|
BASED: string;
|
|
146
147
|
Barometer: string[];
|
|
147
148
|
Ceiling: {
|
|
@@ -183,6 +184,11 @@ declare const _default: {
|
|
|
183
184
|
LGT: string;
|
|
184
185
|
LTG: string;
|
|
185
186
|
MOD: string;
|
|
187
|
+
Next: {
|
|
188
|
+
Forecast: {
|
|
189
|
+
By: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
186
192
|
NXT: string;
|
|
187
193
|
ON: string;
|
|
188
194
|
Obscuration: string;
|
package/locale/en.js
CHANGED
|
@@ -94,7 +94,7 @@ var en = {
|
|
|
94
94
|
TS: "thunderstorm",
|
|
95
95
|
},
|
|
96
96
|
Error: {
|
|
97
|
-
prefix: "An error
|
|
97
|
+
prefix: "An error occurred. Error code n°",
|
|
98
98
|
},
|
|
99
99
|
ErrorCode: {
|
|
100
100
|
AirportNotFound: "The airport was not found for this message.",
|
|
@@ -142,6 +142,7 @@ var en = {
|
|
|
142
142
|
ALQDS: "all quadrants",
|
|
143
143
|
AO1: "automated stations without a precipitation discriminator",
|
|
144
144
|
AO2: "automated station with a precipitation discriminator",
|
|
145
|
+
AO2A: "automated station with a precipitation discriminator (augmented)",
|
|
145
146
|
BASED: "based",
|
|
146
147
|
Barometer: [
|
|
147
148
|
"Increase, then decrease",
|
|
@@ -157,7 +158,7 @@ var en = {
|
|
|
157
158
|
Ceiling: {
|
|
158
159
|
Height: "ceiling varying between {0} and {1} feet",
|
|
159
160
|
Second: {
|
|
160
|
-
Location: "ceiling of {0} feet
|
|
161
|
+
Location: "ceiling of {0} feet measured by a second sensor located at {1}",
|
|
161
162
|
},
|
|
162
163
|
},
|
|
163
164
|
DSNT: "distant",
|
|
@@ -193,6 +194,11 @@ var en = {
|
|
|
193
194
|
LGT: "light",
|
|
194
195
|
LTG: "lightning",
|
|
195
196
|
MOD: "moderate",
|
|
197
|
+
Next: {
|
|
198
|
+
Forecast: {
|
|
199
|
+
By: "next forecast by {0}, {1}:{2}Z"
|
|
200
|
+
},
|
|
201
|
+
},
|
|
196
202
|
NXT: "next",
|
|
197
203
|
ON: "on",
|
|
198
204
|
Obscuration: "{0} layer at {1} feet composed of {2}",
|
|
@@ -224,7 +230,7 @@ var en = {
|
|
|
224
230
|
},
|
|
225
231
|
Second: {
|
|
226
232
|
Location: {
|
|
227
|
-
Visibility: "visibility of {0} SM
|
|
233
|
+
Visibility: "visibility of {0} SM measured by a second sensor located at {1}",
|
|
228
234
|
},
|
|
229
235
|
},
|
|
230
236
|
Sector: {
|
package/metar-taf-parser.d.ts
CHANGED
|
@@ -345,6 +345,13 @@ declare enum DepositType {
|
|
|
345
345
|
FrozenRidges = "9"
|
|
346
346
|
}
|
|
347
347
|
declare enum DepositCoverage {
|
|
348
|
+
/**
|
|
349
|
+
* Only reported by certain countries (e.g. Russia)
|
|
350
|
+
*/
|
|
351
|
+
None = "0",
|
|
352
|
+
/**
|
|
353
|
+
* Not reported (e.g. due to rwy clearance in progress)
|
|
354
|
+
*/
|
|
348
355
|
NotReported = "/",
|
|
349
356
|
Less10 = "1",
|
|
350
357
|
From11To25 = "2",
|
|
@@ -510,6 +517,7 @@ declare const _default: {
|
|
|
510
517
|
ALQDS: string;
|
|
511
518
|
AO1: string;
|
|
512
519
|
AO2: string;
|
|
520
|
+
AO2A: string;
|
|
513
521
|
BASED: string;
|
|
514
522
|
Barometer: string[];
|
|
515
523
|
Ceiling: {
|
|
@@ -551,6 +559,11 @@ declare const _default: {
|
|
|
551
559
|
LGT: string;
|
|
552
560
|
LTG: string;
|
|
553
561
|
MOD: string;
|
|
562
|
+
Next: {
|
|
563
|
+
Forecast: {
|
|
564
|
+
By: string;
|
|
565
|
+
};
|
|
566
|
+
};
|
|
554
567
|
NXT: string;
|
|
555
568
|
ON: string;
|
|
556
569
|
Obscuration: string;
|
|
@@ -1072,6 +1085,17 @@ interface IPrecipitationEndRemark extends IBaseRemark {
|
|
|
1072
1085
|
endMin: number;
|
|
1073
1086
|
}
|
|
1074
1087
|
|
|
1088
|
+
interface INextForecastByRemark extends IBaseRemark {
|
|
1089
|
+
type: RemarkType.NextForecastBy;
|
|
1090
|
+
day: number;
|
|
1091
|
+
hour: number;
|
|
1092
|
+
minute: number;
|
|
1093
|
+
}
|
|
1094
|
+
interface INextForecastByRemarkDated extends INextForecastByRemark {
|
|
1095
|
+
type: RemarkType.NextForecastBy;
|
|
1096
|
+
date: Date;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1075
1099
|
interface IBaseRemark {
|
|
1076
1100
|
type: RemarkType;
|
|
1077
1101
|
description?: string;
|
|
@@ -1128,9 +1152,12 @@ declare enum RemarkType {
|
|
|
1128
1152
|
PrecipitationAmount24Hour = "PrecipitationAmount24Hour",
|
|
1129
1153
|
SnowDepth = "SnowDepth",
|
|
1130
1154
|
SunshineDuration = "SunshineDuration",
|
|
1131
|
-
WaterEquivalentSnow = "WaterEquivalentSnow"
|
|
1155
|
+
WaterEquivalentSnow = "WaterEquivalentSnow",
|
|
1156
|
+
NextForecastBy = "NextForecastBy"
|
|
1132
1157
|
}
|
|
1133
|
-
type
|
|
1158
|
+
type RemarkBase = IUnknownRemark | IDefaultCommandRemark | ICeilingHeightRemark | ICeilingSecondLocationRemark | IHailSizeRemark | IHourlyMaximumMinimumTemperatureRemark | IHourlyMaximumTemperatureRemark | IHourlyMinimumTemperatureRemark | IHourlyPrecipitationAmountRemark | IHourlyPressureRemark | IHourlyTemperatureDewPointRemark | IIceAccretionRemark | IObscurationRemark | IPrecipitationAmount24HourRemark | IPrecipitationAmount36HourRemark | IPrecipitationBegRemark | IPrecipitationBegEndRemark | IPrecipitationEndRemark | IPrevailingVisibilityRemark | ISeaLevelPressureRemark | ISecondLocationVisibilityRemark | ISectorVisibilityRemark | ISmallHailSizeRemark | ISnowDepthRemark | ISnowIncreaseRemark | ISnowPelletsRemark | ISunshineDurationRemark | ISurfaceVisibilityRemark | IThunderStormLocationRemark | IThunderStormLocationMovingRemark | ITornadicActivityBegRemark | ITornadicActivityBegEndRemark | ITornadicActivityEndRemark | ITowerVisibilityRemark | IVariableSkyRemark | IVariableSkyHeightRemark | IVirgaDirectionRemark | IWaterEquivalentSnowRemark | IWindPeakCommandRemark | IWindShiftRemark | IWindShiftFropaRemark;
|
|
1159
|
+
type RemarkDated = RemarkBase | INextForecastByRemarkDated;
|
|
1160
|
+
type Remark = RemarkBase | INextForecastByRemark;
|
|
1134
1161
|
|
|
1135
1162
|
interface IWind {
|
|
1136
1163
|
speed: number;
|
|
@@ -1436,6 +1463,7 @@ type TAFTrendDated = IAbstractTrend & IBaseTAFTrend & {
|
|
|
1436
1463
|
start: Date;
|
|
1437
1464
|
end?: Date;
|
|
1438
1465
|
};
|
|
1466
|
+
remarks: RemarkDated[];
|
|
1439
1467
|
} & ({
|
|
1440
1468
|
type: WeatherChangeType.FM;
|
|
1441
1469
|
validity: IFMValidity & {
|
|
@@ -1457,6 +1485,7 @@ interface ITAFDated extends ITAF {
|
|
|
1457
1485
|
minTemperature?: ITemperatureDated;
|
|
1458
1486
|
maxTemperature?: ITemperatureDated;
|
|
1459
1487
|
trends: TAFTrendDated[];
|
|
1488
|
+
remarks: RemarkDated[];
|
|
1460
1489
|
}
|
|
1461
1490
|
|
|
1462
1491
|
declare abstract class ParseError extends Error {
|
|
@@ -1564,4 +1593,4 @@ declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptions): ITA
|
|
|
1564
1593
|
declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptionsDated): ITAFDated;
|
|
1565
1594
|
declare function parseTAFAsForecast(rawTAF: string, options: IMetarTAFParserOptionsDated): IForecastContainer;
|
|
1566
1595
|
|
|
1567
|
-
export { AltimeterUnit, CloudQuantity, CloudType, CommandExecutionError, DepositCoverage, DepositType, Descriptive, Direction, type Distance, DistanceUnit, type Forecast, type IAbstractTrend, type IAbstractValidity, type IAbstractWeatherCode, type IAbstractWeatherCodeDated, type IAbstractWeatherContainer, type IAltimeter, type IBaseRemark, type IBaseRunwayInfo, type IBaseTAFTrend, type ICeilingHeightRemark, type ICeilingSecondLocationRemark, type ICloud, type ICompositeForecast, type IEndValidity, type IFMValidity, type IFlags, type IForecastContainer, type IHourlyMaximumMinimumTemperatureRemark, type IHourlyMaximumTemperatureRemark, type IHourlyMinimumTemperatureRemark, type IHourlyPrecipitationAmountRemark, type IHourlyPressureRemark, type IHourlyTemperatureDewPointRemark, type IIceAccretionRemark, type IIcing, type IMetar, type IMetarDated, type IMetarTAFParserOptions, type IMetarTAFParserOptionsDated, type IMetarTrend, type IMetarTrendTime, type IObscurationRemark, type IPrecipitationAmount24HourRemark, type IPrecipitationAmount36HourRemark, type IPrecipitationBegEndRemark, type IPrevailingVisibilityRemark, type IRunwayInfoDeposit, type IRunwayInfoRange, type ISeaLevelPressureRemark, type ISecondLocationVisibilityRemark, type ISectorVisibilityRemark, type ISmallHailSizeRemark, type ISnowIncreaseRemark, type ISnowPelletsRemark, type ISunshineDurationRemark, type ISurfaceVisibilityRemark, type ITAF, type ITAFDated, type ITafGroups, type ITemperature, type ITemperatureDated, type IThunderStormLocationMovingRemark, type IThunderStormLocationRemark, type ITime, type ITornadicActivityBegEndRemark, type ITornadicActivityBegRemark, type ITornadicActivityEndRemark, type ITowerVisibilityRemark, type ITurbulence, type IUnknownRemark, type IValidity, type IValidityDated, type IVariableSkyHeightRemark, type IVariableSkyRemark, type IVirgaDirectionRemark, type IWaterEquivalentSnowRemark, type IWeatherCondition, type IWind, type IWindPeakCommandRemark, type IWindShear, type IWindShiftFropaRemark, IcingIntensity, Intensity, InvalidWeatherStatementError, type Locale, MetarType, ParseError, PartialWeatherStatementError, Phenomenon, type Remark, RemarkType, type RunwayInfo, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, type TAFTrend, type TAFTrendDated, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, type Visibility, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
|
|
1596
|
+
export { AltimeterUnit, CloudQuantity, CloudType, CommandExecutionError, DepositCoverage, DepositType, Descriptive, Direction, type Distance, DistanceUnit, type Forecast, type IAbstractTrend, type IAbstractValidity, type IAbstractWeatherCode, type IAbstractWeatherCodeDated, type IAbstractWeatherContainer, type IAltimeter, type IBaseRemark, type IBaseRunwayInfo, type IBaseTAFTrend, type ICeilingHeightRemark, type ICeilingSecondLocationRemark, type ICloud, type ICompositeForecast, type IEndValidity, type IFMValidity, type IFlags, type IForecastContainer, type IHourlyMaximumMinimumTemperatureRemark, type IHourlyMaximumTemperatureRemark, type IHourlyMinimumTemperatureRemark, type IHourlyPrecipitationAmountRemark, type IHourlyPressureRemark, type IHourlyTemperatureDewPointRemark, type IIceAccretionRemark, type IIcing, type IMetar, type IMetarDated, type IMetarTAFParserOptions, type IMetarTAFParserOptionsDated, type IMetarTrend, type IMetarTrendTime, type INextForecastByRemark, type INextForecastByRemarkDated, type IObscurationRemark, type IPrecipitationAmount24HourRemark, type IPrecipitationAmount36HourRemark, type IPrecipitationBegEndRemark, type IPrevailingVisibilityRemark, type IRunwayInfoDeposit, type IRunwayInfoRange, type ISeaLevelPressureRemark, type ISecondLocationVisibilityRemark, type ISectorVisibilityRemark, type ISmallHailSizeRemark, type ISnowIncreaseRemark, type ISnowPelletsRemark, type ISunshineDurationRemark, type ISurfaceVisibilityRemark, type ITAF, type ITAFDated, type ITafGroups, type ITemperature, type ITemperatureDated, type IThunderStormLocationMovingRemark, type IThunderStormLocationRemark, type ITime, type ITornadicActivityBegEndRemark, type ITornadicActivityBegRemark, type ITornadicActivityEndRemark, type ITowerVisibilityRemark, type ITurbulence, type IUnknownRemark, type IValidity, type IValidityDated, type IVariableSkyHeightRemark, type IVariableSkyRemark, type IVirgaDirectionRemark, type IWaterEquivalentSnowRemark, type IWeatherCondition, type IWind, type IWindPeakCommandRemark, type IWindShear, type IWindShiftFropaRemark, IcingIntensity, Intensity, InvalidWeatherStatementError, type Locale, MetarType, ParseError, PartialWeatherStatementError, Phenomenon, type Remark, type RemarkDated, RemarkType, type RunwayInfo, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, type TAFTrend, type TAFTrendDated, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, type Visibility, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
|
package/metar-taf-parser.js
CHANGED
|
@@ -575,6 +575,13 @@ var DepositType;
|
|
|
575
575
|
})(DepositType || (DepositType = {}));
|
|
576
576
|
var DepositCoverage;
|
|
577
577
|
(function (DepositCoverage) {
|
|
578
|
+
/**
|
|
579
|
+
* Only reported by certain countries (e.g. Russia)
|
|
580
|
+
*/
|
|
581
|
+
DepositCoverage["None"] = "0";
|
|
582
|
+
/**
|
|
583
|
+
* Not reported (e.g. due to rwy clearance in progress)
|
|
584
|
+
*/
|
|
578
585
|
DepositCoverage["NotReported"] = "/";
|
|
579
586
|
DepositCoverage["Less10"] = "1";
|
|
580
587
|
DepositCoverage["From11To25"] = "2";
|
|
@@ -1745,6 +1752,36 @@ class PrecipitationEndCommand extends Command {
|
|
|
1745
1752
|
}
|
|
1746
1753
|
_PrecipitationEndCommand_regex = new WeakMap();
|
|
1747
1754
|
|
|
1755
|
+
var _NextForecastByCommand_regex;
|
|
1756
|
+
class NextForecastByCommand extends Command {
|
|
1757
|
+
constructor() {
|
|
1758
|
+
super(...arguments);
|
|
1759
|
+
_NextForecastByCommand_regex.set(this, /^NXT FCST BY (\d{2})(\d{2})(\d{2})Z/);
|
|
1760
|
+
}
|
|
1761
|
+
canParse(code) {
|
|
1762
|
+
return __classPrivateFieldGet(this, _NextForecastByCommand_regex, "f").test(code);
|
|
1763
|
+
}
|
|
1764
|
+
execute(code, remark) {
|
|
1765
|
+
const matches = code.match(__classPrivateFieldGet(this, _NextForecastByCommand_regex, "f"));
|
|
1766
|
+
if (!matches)
|
|
1767
|
+
throw new UnexpectedParseError("Match not found");
|
|
1768
|
+
const day = +matches[1];
|
|
1769
|
+
const hour = matches[2];
|
|
1770
|
+
const minute = matches[3];
|
|
1771
|
+
const description = format(_("Remark.Next.Forecast.By", this.locale), day, hour, minute);
|
|
1772
|
+
remark.push({
|
|
1773
|
+
type: RemarkType.NextForecastBy,
|
|
1774
|
+
description,
|
|
1775
|
+
raw: matches[0],
|
|
1776
|
+
day,
|
|
1777
|
+
hour: +hour,
|
|
1778
|
+
minute: +minute,
|
|
1779
|
+
});
|
|
1780
|
+
return [code.replace(__classPrivateFieldGet(this, _NextForecastByCommand_regex, "f"), "").trim(), remark];
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
_NextForecastByCommand_regex = new WeakMap();
|
|
1784
|
+
|
|
1748
1785
|
class RemarkCommandSupplier {
|
|
1749
1786
|
constructor(locale) {
|
|
1750
1787
|
this.locale = locale;
|
|
@@ -1789,6 +1826,7 @@ class RemarkCommandSupplier {
|
|
|
1789
1826
|
new SnowDepthCommand(locale),
|
|
1790
1827
|
new SunshineDurationCommand(locale),
|
|
1791
1828
|
new WaterEquivalentSnowCommand(locale),
|
|
1829
|
+
new NextForecastByCommand(locale),
|
|
1792
1830
|
];
|
|
1793
1831
|
}
|
|
1794
1832
|
get(code) {
|
|
@@ -1852,6 +1890,8 @@ var RemarkType;
|
|
|
1852
1890
|
RemarkType["SnowDepth"] = "SnowDepth";
|
|
1853
1891
|
RemarkType["SunshineDuration"] = "SunshineDuration";
|
|
1854
1892
|
RemarkType["WaterEquivalentSnow"] = "WaterEquivalentSnow";
|
|
1893
|
+
// Canada commands below
|
|
1894
|
+
RemarkType["NextForecastBy"] = "NextForecastBy";
|
|
1855
1895
|
})(RemarkType || (RemarkType = {}));
|
|
1856
1896
|
|
|
1857
1897
|
function isWeatherConditionValid(weather) {
|
|
@@ -2111,7 +2151,7 @@ class RunwayCommand {
|
|
|
2111
2151
|
constructor() {
|
|
2112
2152
|
_RunwayCommand_genericRegex.set(this, /^(R\d{2}\w?\/)/);
|
|
2113
2153
|
_RunwayCommand_runwayMaxRangeRegex.set(this, /^R(\d{2}\w?)\/(\d{4})V(\d{3,4})([UDN])?(FT)?/);
|
|
2114
|
-
_RunwayCommand_runwayRegex.set(this, /^R(\d{2}\w?)\/([MP])?(\d{4})([UDN])
|
|
2154
|
+
_RunwayCommand_runwayRegex.set(this, /^R(\d{2}\w?)\/([MP])?(\d{4})(?:([UDN])|(FT)(?:\/([UDN]))?)$/);
|
|
2115
2155
|
_RunwayCommand_runwayDepositRegex.set(this, /^R(\d{2}\w?)\/([/\d])([/\d])(\/\/|\d{2})(\/\/|\d{2})$/);
|
|
2116
2156
|
}
|
|
2117
2157
|
canParse(input) {
|
|
@@ -2137,7 +2177,12 @@ class RunwayCommand {
|
|
|
2137
2177
|
if (!matches)
|
|
2138
2178
|
throw new UnexpectedParseError("Should be able to parse");
|
|
2139
2179
|
const indicator = matches[2] ? as(matches[2], ValueIndicator) : undefined;
|
|
2140
|
-
const trend =
|
|
2180
|
+
const trend = (() => {
|
|
2181
|
+
if (matches[6])
|
|
2182
|
+
return as(matches[6], RunwayInfoTrend);
|
|
2183
|
+
if (matches[4])
|
|
2184
|
+
return as(matches[4], RunwayInfoTrend);
|
|
2185
|
+
})();
|
|
2141
2186
|
const unit = matches[5]
|
|
2142
2187
|
? as(matches[5], RunwayInfoUnit)
|
|
2143
2188
|
: RunwayInfoUnit.Meters;
|
|
@@ -2893,6 +2938,17 @@ function metarDatesHydrator(report, date) {
|
|
|
2893
2938
|
};
|
|
2894
2939
|
}
|
|
2895
2940
|
|
|
2941
|
+
function remarksDatesHydrator(remarks, date) {
|
|
2942
|
+
return remarks.map((remark) => {
|
|
2943
|
+
if (remark.type === RemarkType.NextForecastBy) {
|
|
2944
|
+
return {
|
|
2945
|
+
...remark,
|
|
2946
|
+
date: determineReportDate(date, remark.day, remark.hour, remark.minute),
|
|
2947
|
+
};
|
|
2948
|
+
}
|
|
2949
|
+
return remark;
|
|
2950
|
+
});
|
|
2951
|
+
}
|
|
2896
2952
|
function tafDatesHydrator(report, date) {
|
|
2897
2953
|
const issued = determineReportDate(date, report.day, report.hour, report.minute);
|
|
2898
2954
|
return {
|
|
@@ -2917,6 +2973,7 @@ function tafDatesHydrator(report, date) {
|
|
|
2917
2973
|
: undefined,
|
|
2918
2974
|
trends: report.trends.map((trend) => ({
|
|
2919
2975
|
...trend,
|
|
2976
|
+
remarks: remarksDatesHydrator(trend.remarks, issued),
|
|
2920
2977
|
validity: (() => {
|
|
2921
2978
|
switch (trend.type) {
|
|
2922
2979
|
case WeatherChangeType.FM:
|
|
@@ -2933,6 +2990,7 @@ function tafDatesHydrator(report, date) {
|
|
|
2933
2990
|
}
|
|
2934
2991
|
})(),
|
|
2935
2992
|
})),
|
|
2993
|
+
remarks: remarksDatesHydrator(report.remarks, issued),
|
|
2936
2994
|
};
|
|
2937
2995
|
}
|
|
2938
2996
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metar-taf-parser",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Parse METAR and TAF reports",
|
|
5
5
|
"homepage": "https://aeharding.github.io/metar-taf-parser",
|
|
6
6
|
"packageManager": "pnpm@9.0.6+sha256.0624e30eff866cdeb363b15061bdb7fd9425b17bc1bb42c22f5f4efdea21f6b3",
|