metar-taf-parser 7.2.0 → 8.0.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/metar-taf-parser.d.ts +91 -4
- package/metar-taf-parser.js +65 -10
- package/package.json +1 -1
package/metar-taf-parser.d.ts
CHANGED
|
@@ -330,6 +330,41 @@ declare enum TurbulenceIntensity {
|
|
|
330
330
|
/** Extreme turbulence */
|
|
331
331
|
Extreme = "X"
|
|
332
332
|
}
|
|
333
|
+
declare enum DepositType {
|
|
334
|
+
/** (runway clearance in progress) */
|
|
335
|
+
NotReported = "/",
|
|
336
|
+
ClearDry = "0",
|
|
337
|
+
Damp = "1",
|
|
338
|
+
WetWaterPatches = "2",
|
|
339
|
+
RimeFrostCovered = "3",
|
|
340
|
+
DrySnow = "4",
|
|
341
|
+
WetSnow = "5",
|
|
342
|
+
Slush = "6",
|
|
343
|
+
Ice = "7",
|
|
344
|
+
CompactedSnow = "8",
|
|
345
|
+
FrozenRidges = "9"
|
|
346
|
+
}
|
|
347
|
+
declare enum DepositCoverage {
|
|
348
|
+
NotReported = "/",
|
|
349
|
+
Less10 = "1",
|
|
350
|
+
From11To25 = "2",
|
|
351
|
+
From26To50 = "5",
|
|
352
|
+
From51To100 = "9"
|
|
353
|
+
}
|
|
354
|
+
declare enum AltimeterUnit {
|
|
355
|
+
/**
|
|
356
|
+
* Inches of mercury (inHg)
|
|
357
|
+
*
|
|
358
|
+
* e.g. A2994 parses as 29.94 inHg
|
|
359
|
+
*/
|
|
360
|
+
InHg = "inHg",
|
|
361
|
+
/**
|
|
362
|
+
* Hectopascals (hPa), also known as millibars
|
|
363
|
+
*
|
|
364
|
+
* e.g. Q1018 parses as 1018 millibars
|
|
365
|
+
*/
|
|
366
|
+
HPa = "hPa"
|
|
367
|
+
}
|
|
333
368
|
|
|
334
369
|
declare const _default: {
|
|
335
370
|
CloudQuantity: {
|
|
@@ -1135,6 +1170,10 @@ interface IWeatherCondition {
|
|
|
1135
1170
|
phenomenons: Phenomenon[];
|
|
1136
1171
|
}
|
|
1137
1172
|
declare function isWeatherConditionValid(weather: IWeatherCondition): boolean;
|
|
1173
|
+
interface IAltimeter {
|
|
1174
|
+
value: number;
|
|
1175
|
+
unit: AltimeterUnit;
|
|
1176
|
+
}
|
|
1138
1177
|
interface ITemperature {
|
|
1139
1178
|
temperature: number;
|
|
1140
1179
|
day: number;
|
|
@@ -1143,7 +1182,11 @@ interface ITemperature {
|
|
|
1143
1182
|
interface ITemperatureDated extends ITemperature {
|
|
1144
1183
|
date: Date;
|
|
1145
1184
|
}
|
|
1146
|
-
|
|
1185
|
+
declare type RunwayInfo = IRunwayInfoRange | IRunwayInfoDeposit;
|
|
1186
|
+
interface IBaseRunwayInfo {
|
|
1187
|
+
name: string;
|
|
1188
|
+
}
|
|
1189
|
+
interface IRunwayInfoRange extends IBaseRunwayInfo {
|
|
1147
1190
|
name: string;
|
|
1148
1191
|
minRange: number;
|
|
1149
1192
|
maxRange?: number;
|
|
@@ -1157,6 +1200,50 @@ interface IRunwayInfo {
|
|
|
1157
1200
|
trend?: RunwayInfoTrend;
|
|
1158
1201
|
unit: RunwayInfoUnit;
|
|
1159
1202
|
}
|
|
1203
|
+
interface IRunwayInfoDeposit extends IBaseRunwayInfo {
|
|
1204
|
+
depositType?: DepositType;
|
|
1205
|
+
coverage?: DepositCoverage;
|
|
1206
|
+
/**
|
|
1207
|
+
* Depth of deposit
|
|
1208
|
+
*
|
|
1209
|
+
* Note: the quoted depth is the mean of a number of reading or if operationally significant the greatest depth measured.
|
|
1210
|
+
*
|
|
1211
|
+
* | Value | Description |
|
|
1212
|
+
* | ----- | ----------- |
|
|
1213
|
+
* | `"00"` | Less than 1mm |
|
|
1214
|
+
* | `"01"` to `"90"` | Measurement in mm |
|
|
1215
|
+
* | `"92"` | 10cm |
|
|
1216
|
+
* | `"93"` | 15cm |
|
|
1217
|
+
* | `"94"` | 20cm |
|
|
1218
|
+
* | `"95"` | 25cm |
|
|
1219
|
+
* | `"96"` | 30cm |
|
|
1220
|
+
* | `"97"` | 35cm |
|
|
1221
|
+
* | `"98"` | 40cm or more |
|
|
1222
|
+
* | `"99"` | Runway not operational due to snow, slush, ice, large drifts or runway clearance, depth not reported |
|
|
1223
|
+
* | `"//"` | Not operationally significant or not measurable |
|
|
1224
|
+
*/
|
|
1225
|
+
thickness?: string;
|
|
1226
|
+
/**
|
|
1227
|
+
* Friction Coefficient or Braking Action
|
|
1228
|
+
*
|
|
1229
|
+
* Note: Where braking action is assessed at a number of points along the runway the mean value will be transmitted or if operationally significant the lowest value.
|
|
1230
|
+
*
|
|
1231
|
+
* If measuring equipment does not allow measurement of friction with satisfactory reliability (such as contaminated by wet snow, slush or loose snow) the figure 99 will be used.
|
|
1232
|
+
*
|
|
1233
|
+
* | Value | Description |
|
|
1234
|
+
* | ----- | ----------- |
|
|
1235
|
+
* | `"28"` | Friction coefficient 0.28
|
|
1236
|
+
* | `"35"` | Friction coefficient 0.35
|
|
1237
|
+
* | `"91"` | Braking action poor
|
|
1238
|
+
* | `"92"` | Braking action medium to poor
|
|
1239
|
+
* | `"93"` | Braking action medium
|
|
1240
|
+
* | `"94"` | Braking action medium to good
|
|
1241
|
+
* | `"95"` | Braking action good
|
|
1242
|
+
* | `"99"` | Figures unreliable
|
|
1243
|
+
* | `"//"` | Braking action not reported or runway not operations or airport closed.
|
|
1244
|
+
*/
|
|
1245
|
+
brakingCapacity?: string;
|
|
1246
|
+
}
|
|
1160
1247
|
interface ICloud {
|
|
1161
1248
|
height?: number;
|
|
1162
1249
|
quantity: CloudQuantity;
|
|
@@ -1229,9 +1316,9 @@ interface IMetar extends IAbstractWeatherCode {
|
|
|
1229
1316
|
type?: MetarType;
|
|
1230
1317
|
temperature?: number;
|
|
1231
1318
|
dewPoint?: number;
|
|
1232
|
-
altimeter?:
|
|
1319
|
+
altimeter?: IAltimeter;
|
|
1233
1320
|
nosig?: true;
|
|
1234
|
-
runwaysInfo:
|
|
1321
|
+
runwaysInfo: RunwayInfo[];
|
|
1235
1322
|
/**
|
|
1236
1323
|
* Not used in North America
|
|
1237
1324
|
*/
|
|
@@ -1467,4 +1554,4 @@ declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptions): ITA
|
|
|
1467
1554
|
declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptionsDated): ITAFDated;
|
|
1468
1555
|
declare function parseTAFAsForecast(rawTAF: string, options: IMetarTAFParserOptionsDated): IForecastContainer;
|
|
1469
1556
|
|
|
1470
|
-
export { CloudQuantity, CloudType, CommandExecutionError, Descriptive, Direction, Distance, DistanceUnit, Forecast, IAbstractTrend, IAbstractValidity, IAbstractWeatherCode, IAbstractWeatherCodeDated, IAbstractWeatherContainer, IBaseRemark, IBaseTAFTrend, ICeilingHeightRemark, ICeilingSecondLocationRemark, ICloud, ICompositeForecast, IEndValidity, IFMValidity, IFlags, IForecastContainer, IHourlyMaximumMinimumTemperatureRemark, IHourlyMaximumTemperatureRemark, IHourlyMinimumTemperatureRemark, IHourlyPrecipitationAmountRemark, IHourlyPressureRemark, IHourlyTemperatureDewPointRemark, IIceAccretionRemark, IIcing, IMetar, IMetarDated, IMetarTAFParserOptions, IMetarTAFParserOptionsDated, IMetarTrend, IMetarTrendTime, IObscurationRemark, IPrecipitationAmount24HourRemark, IPrecipitationAmount36HourRemark, IPrecipitationBegEndRemark, IPrevailingVisibilityRemark,
|
|
1557
|
+
export { AltimeterUnit, CloudQuantity, CloudType, CommandExecutionError, DepositCoverage, DepositType, Descriptive, Direction, Distance, DistanceUnit, Forecast, IAbstractTrend, IAbstractValidity, IAbstractWeatherCode, IAbstractWeatherCodeDated, IAbstractWeatherContainer, IAltimeter, IBaseRemark, IBaseRunwayInfo, IBaseTAFTrend, ICeilingHeightRemark, ICeilingSecondLocationRemark, ICloud, ICompositeForecast, IEndValidity, IFMValidity, IFlags, IForecastContainer, IHourlyMaximumMinimumTemperatureRemark, IHourlyMaximumTemperatureRemark, IHourlyMinimumTemperatureRemark, IHourlyPrecipitationAmountRemark, IHourlyPressureRemark, IHourlyTemperatureDewPointRemark, IIceAccretionRemark, IIcing, IMetar, IMetarDated, IMetarTAFParserOptions, IMetarTAFParserOptionsDated, IMetarTrend, IMetarTrendTime, IObscurationRemark, IPrecipitationAmount24HourRemark, IPrecipitationAmount36HourRemark, IPrecipitationBegEndRemark, IPrevailingVisibilityRemark, IRunwayInfoDeposit, IRunwayInfoRange, ISeaLevelPressureRemark, ISecondLocationVisibilityRemark, ISectorVisibilityRemark, ISmallHailSizeRemark, ISnowIncreaseRemark, ISnowPelletsRemark, ISunshineDurationRemark, ISurfaceVisibilityRemark, ITAF, ITAFDated, ITafGroups, ITemperature, ITemperatureDated, IThunderStormLocationMovingRemark, IThunderStormLocationRemark, ITime, ITornadicActivityBegEndRemark, ITornadicActivityBegRemark, ITornadicActivityEndRemark, ITowerVisibilityRemark, ITurbulence, IUnknownRemark, IValidity, IValidityDated, IVariableSkyHeightRemark, IVariableSkyRemark, IVirgaDirectionRemark, IWaterEquivalentSnowRemark, IWeatherCondition, IWind, IWindPeakCommandRemark, IWindShear, IWindShiftFropaRemark, IcingIntensity, Intensity, InvalidWeatherStatementError, Locale, MetarType, ParseError, Phenomenon, Remark, RemarkType, RunwayInfo, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, TAFTrend, TAFTrendDated, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, Visibility, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
|
package/metar-taf-parser.js
CHANGED
|
@@ -531,6 +531,44 @@ var TurbulenceIntensity;
|
|
|
531
531
|
/** Extreme turbulence */
|
|
532
532
|
TurbulenceIntensity["Extreme"] = "X";
|
|
533
533
|
})(TurbulenceIntensity || (TurbulenceIntensity = {}));
|
|
534
|
+
var DepositType;
|
|
535
|
+
(function (DepositType) {
|
|
536
|
+
/** (runway clearance in progress) */
|
|
537
|
+
DepositType["NotReported"] = "/";
|
|
538
|
+
DepositType["ClearDry"] = "0";
|
|
539
|
+
DepositType["Damp"] = "1";
|
|
540
|
+
DepositType["WetWaterPatches"] = "2";
|
|
541
|
+
DepositType["RimeFrostCovered"] = "3";
|
|
542
|
+
DepositType["DrySnow"] = "4";
|
|
543
|
+
DepositType["WetSnow"] = "5";
|
|
544
|
+
DepositType["Slush"] = "6";
|
|
545
|
+
DepositType["Ice"] = "7";
|
|
546
|
+
DepositType["CompactedSnow"] = "8";
|
|
547
|
+
DepositType["FrozenRidges"] = "9";
|
|
548
|
+
})(DepositType || (DepositType = {}));
|
|
549
|
+
var DepositCoverage;
|
|
550
|
+
(function (DepositCoverage) {
|
|
551
|
+
DepositCoverage["NotReported"] = "/";
|
|
552
|
+
DepositCoverage["Less10"] = "1";
|
|
553
|
+
DepositCoverage["From11To25"] = "2";
|
|
554
|
+
DepositCoverage["From26To50"] = "5";
|
|
555
|
+
DepositCoverage["From51To100"] = "9";
|
|
556
|
+
})(DepositCoverage || (DepositCoverage = {}));
|
|
557
|
+
var AltimeterUnit;
|
|
558
|
+
(function (AltimeterUnit) {
|
|
559
|
+
/**
|
|
560
|
+
* Inches of mercury (inHg)
|
|
561
|
+
*
|
|
562
|
+
* e.g. A2994 parses as 29.94 inHg
|
|
563
|
+
*/
|
|
564
|
+
AltimeterUnit["InHg"] = "inHg";
|
|
565
|
+
/**
|
|
566
|
+
* Hectopascals (hPa), also known as millibars
|
|
567
|
+
*
|
|
568
|
+
* e.g. Q1018 parses as 1018 millibars
|
|
569
|
+
*/
|
|
570
|
+
AltimeterUnit["HPa"] = "hPa";
|
|
571
|
+
})(AltimeterUnit || (AltimeterUnit = {}));
|
|
534
572
|
|
|
535
573
|
function degreesToCardinal(input) {
|
|
536
574
|
const degrees = +input;
|
|
@@ -612,9 +650,6 @@ function convertTemperature(input) {
|
|
|
612
650
|
return -pySplit(input, "M")[1];
|
|
613
651
|
return +input;
|
|
614
652
|
}
|
|
615
|
-
function convertInchesMercuryToPascal(input) {
|
|
616
|
-
return 33.8639 * input;
|
|
617
|
-
}
|
|
618
653
|
/**
|
|
619
654
|
* Converts number `.toFixed(1)` before outputting to match python implementation
|
|
620
655
|
*/
|
|
@@ -2015,7 +2050,10 @@ class AltimeterCommand {
|
|
|
2015
2050
|
const matches = input.match(__classPrivateFieldGet(this, _AltimeterCommand_regex, "f"));
|
|
2016
2051
|
if (!matches)
|
|
2017
2052
|
throw new UnexpectedParseError("Match not found");
|
|
2018
|
-
metar.altimeter =
|
|
2053
|
+
metar.altimeter = {
|
|
2054
|
+
value: +matches[1],
|
|
2055
|
+
unit: AltimeterUnit.HPa,
|
|
2056
|
+
};
|
|
2019
2057
|
}
|
|
2020
2058
|
}
|
|
2021
2059
|
_AltimeterCommand_regex = new WeakMap();
|
|
@@ -2033,24 +2071,41 @@ class AltimeterMercuryCommand {
|
|
|
2033
2071
|
if (!matches)
|
|
2034
2072
|
throw new UnexpectedParseError("Match not found");
|
|
2035
2073
|
const mercury = +matches[1] / 100;
|
|
2036
|
-
metar.altimeter =
|
|
2074
|
+
metar.altimeter = {
|
|
2075
|
+
value: mercury,
|
|
2076
|
+
unit: AltimeterUnit.InHg,
|
|
2077
|
+
};
|
|
2037
2078
|
}
|
|
2038
2079
|
}
|
|
2039
2080
|
_AltimeterMercuryCommand_regex = new WeakMap();
|
|
2040
2081
|
|
|
2041
|
-
var _RunwayCommand_genericRegex, _RunwayCommand_runwayMaxRangeRegex, _RunwayCommand_runwayRegex;
|
|
2082
|
+
var _RunwayCommand_genericRegex, _RunwayCommand_runwayMaxRangeRegex, _RunwayCommand_runwayRegex, _RunwayCommand_runwayDepositRegex;
|
|
2042
2083
|
class RunwayCommand {
|
|
2043
2084
|
constructor() {
|
|
2044
2085
|
_RunwayCommand_genericRegex.set(this, /^(R\d{2}\w?\/)/);
|
|
2045
2086
|
_RunwayCommand_runwayMaxRangeRegex.set(this, /^R(\d{2}\w?)\/(\d{4})V(\d{3,4})([UDN])?(FT)?/);
|
|
2046
2087
|
_RunwayCommand_runwayRegex.set(this, /^R(\d{2}\w?)\/([MP])?(\d{4})([UDN])?(FT)?$/);
|
|
2088
|
+
_RunwayCommand_runwayDepositRegex.set(this, /^R(\d{2}\w?)\/([/\d])([/\d])(\/\/|\d{2})(\/\/|\d{2})$/);
|
|
2047
2089
|
}
|
|
2048
2090
|
canParse(input) {
|
|
2049
2091
|
return __classPrivateFieldGet(this, _RunwayCommand_genericRegex, "f").test(input);
|
|
2050
2092
|
}
|
|
2051
2093
|
execute(metar, input) {
|
|
2052
|
-
|
|
2053
|
-
|
|
2094
|
+
if (__classPrivateFieldGet(this, _RunwayCommand_runwayDepositRegex, "f").test(input)) {
|
|
2095
|
+
const matches = input.match(__classPrivateFieldGet(this, _RunwayCommand_runwayDepositRegex, "f"));
|
|
2096
|
+
if (!matches)
|
|
2097
|
+
throw new UnexpectedParseError("Should be able to parse");
|
|
2098
|
+
const depositType = as(matches[2], DepositType);
|
|
2099
|
+
const coverage = as(matches[3], DepositCoverage);
|
|
2100
|
+
metar.runwaysInfo.push({
|
|
2101
|
+
name: matches[1],
|
|
2102
|
+
depositType,
|
|
2103
|
+
coverage,
|
|
2104
|
+
thickness: matches[4],
|
|
2105
|
+
brakingCapacity: matches[5],
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
2108
|
+
else if (__classPrivateFieldGet(this, _RunwayCommand_runwayRegex, "f").test(input)) {
|
|
2054
2109
|
const matches = input.match(__classPrivateFieldGet(this, _RunwayCommand_runwayRegex, "f"));
|
|
2055
2110
|
if (!matches)
|
|
2056
2111
|
throw new UnexpectedParseError("Should be able to parse");
|
|
@@ -2085,7 +2140,7 @@ class RunwayCommand {
|
|
|
2085
2140
|
}
|
|
2086
2141
|
}
|
|
2087
2142
|
}
|
|
2088
|
-
_RunwayCommand_genericRegex = new WeakMap(), _RunwayCommand_runwayMaxRangeRegex = new WeakMap(), _RunwayCommand_runwayRegex = new WeakMap();
|
|
2143
|
+
_RunwayCommand_genericRegex = new WeakMap(), _RunwayCommand_runwayMaxRangeRegex = new WeakMap(), _RunwayCommand_runwayRegex = new WeakMap(), _RunwayCommand_runwayDepositRegex = new WeakMap();
|
|
2089
2144
|
|
|
2090
2145
|
var _TemperatureCommand_regex;
|
|
2091
2146
|
class TemperatureCommand {
|
|
@@ -3038,4 +3093,4 @@ function parse(rawReport, options, parser, datesHydrator) {
|
|
|
3038
3093
|
}
|
|
3039
3094
|
}
|
|
3040
3095
|
|
|
3041
|
-
export { CloudQuantity, CloudType, CommandExecutionError, Descriptive, Direction, DistanceUnit, IcingIntensity, Intensity, InvalidWeatherStatementError, MetarType, ParseError, Phenomenon, RemarkType, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
|
|
3096
|
+
export { AltimeterUnit, CloudQuantity, CloudType, CommandExecutionError, DepositCoverage, DepositType, Descriptive, Direction, DistanceUnit, IcingIntensity, Intensity, InvalidWeatherStatementError, MetarType, ParseError, Phenomenon, RemarkType, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
|