aewx-metar-parser 3.0.2 → 4.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/CHANGELOG.md +17 -1
- package/README.md +7 -3
- package/dist/convert.js +27 -32
- package/dist/convert.test.js +1 -1
- package/dist/metar-parser-helpers.js +119 -0
- package/dist/metar-parser.js +164 -237
- package/dist/metar-parser.test.js +187 -86
- package/dist/metar-parser.type.js +1 -0
- package/docs/KEYW.json +57 -0
- package/docs/KFSO.json +87 -0
- package/eslint.config.js +11 -8
- package/package.json +10 -9
- package/src/convert.test.ts +1 -1
- package/src/convert.ts +35 -40
- package/src/metar-parser-helpers.ts +155 -0
- package/src/metar-parser.test.ts +205 -86
- package/src/metar-parser.ts +203 -329
- package/src/metar-parser.type.ts +85 -0
- package/types/convert.d.ts +9 -14
- package/types/convert.d.ts.map +1 -1
- package/types/metar-parser-helpers.d.ts +29 -0
- package/types/metar-parser-helpers.d.ts.map +1 -0
- package/types/metar-parser.d.ts +1 -61
- package/types/metar-parser.d.ts.map +1 -1
- package/types/metar-parser.type.d.ts +74 -0
- package/types/metar-parser.type.d.ts.map +1 -0
- package/tsconfig.tsbuildinfo +0 -1
package/types/convert.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
kpaToInhg: (kpa: number) => number;
|
|
11
|
-
kphToMps: (kph: number) => number;
|
|
12
|
-
mpsToKts: (mps: number) => number;
|
|
13
|
-
ktsToMps: (kts: number) => number;
|
|
14
|
-
};
|
|
1
|
+
export declare function celsiusToFahrenheit(celsius: number): number;
|
|
2
|
+
export declare function feetToMeters(feet: number): number;
|
|
3
|
+
export declare function milesToMeters(miles: number): number;
|
|
4
|
+
export declare function metersToMiles(meters: number): number;
|
|
5
|
+
export declare function inhgToKpa(inHg: number): number;
|
|
6
|
+
export declare function kpaToInhg(kpa: number): number;
|
|
7
|
+
export declare function kphToMps(kph: number): number;
|
|
8
|
+
export declare function mpsToKts(mps: number): number;
|
|
9
|
+
export declare function ktsToMps(kts: number): number;
|
|
15
10
|
//# sourceMappingURL=convert.d.ts.map
|
package/types/convert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,UAElD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,UAE1C;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,UAE3C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,UAErC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,UAEpC;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAEnC;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAEnC;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAEnC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MetarVisibility, MetarCloudCode, MetarCloud, MetarTemperature, MetarCeiling, MetarFlightCategory as MetarUsFlightCategory, MetarIcaoFlightCategory, MetarHumidity } from "./metar-parser.type.js";
|
|
2
|
+
/**
|
|
3
|
+
* @param {Number} value dito
|
|
4
|
+
* @param {Number} toNext round to next full xxxx
|
|
5
|
+
* @returns {Number} rounded value
|
|
6
|
+
*/
|
|
7
|
+
export declare function round(value: number, toNext?: number): number;
|
|
8
|
+
export declare function metarVisibility(visibility_miles: number, visibility_meters: number): MetarVisibility;
|
|
9
|
+
export declare function metarCloud(code: MetarCloudCode, hundredFeet: string): MetarCloud;
|
|
10
|
+
export declare function metarTemperature(temperatureString: string): MetarTemperature | null;
|
|
11
|
+
/**
|
|
12
|
+
* @see http://andrew.rsmas.miami.edu/bmcnoldy/Humidity.html
|
|
13
|
+
*/
|
|
14
|
+
export declare function relativeHumidity(temp: MetarTemperature | null, dew: MetarTemperature | null): MetarHumidity | null;
|
|
15
|
+
export declare function flightCategoryUs(visibility: MetarVisibility | null, ceiling: MetarCeiling | null): MetarUsFlightCategory | null;
|
|
16
|
+
export declare function flightCategoryIcao(visibility: MetarVisibility | null, ceiling: MetarCeiling | null): MetarIcaoFlightCategory | null;
|
|
17
|
+
/**
|
|
18
|
+
* @see findCeiling
|
|
19
|
+
* @returns the ceiling by looking for the lowest cloud layer reporting `BKN`
|
|
20
|
+
* or `OVC`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function metarCeiling(clouds: MetarCloud[]): MetarCeiling | null;
|
|
23
|
+
/**
|
|
24
|
+
* @return METAR string split along its white spaces. Will convert fractional
|
|
25
|
+
* visibility values into one concatenated value.
|
|
26
|
+
*/
|
|
27
|
+
export declare function metarSplit(metarString: string): string[];
|
|
28
|
+
export declare function date(date: number, hours: number, minutes: number): Date;
|
|
29
|
+
//# sourceMappingURL=metar-parser-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metar-parser-helpers.d.ts","sourceRoot":"","sources":["../src/metar-parser-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,IAAI,qBAAqB,EAC5C,uBAAuB,EACvB,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAY,GAAG,MAAM,CAEjE;AAED,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,eAAe,CAOpG;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAOhF;AAED,wBAAgB,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CASnF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAAE,GAAG,EAAE,gBAAgB,GAAG,IAAI,GAAG,aAAa,GAAG,IAAI,CAWlH;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,eAAe,GAAG,IAAI,EAClC,OAAO,EAAE,YAAY,GAAG,IAAI,GAC3B,qBAAqB,GAAG,IAAI,CAa9B;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,eAAe,GAAG,IAAI,EAClC,OAAO,EAAE,YAAY,GAAG,IAAI,GAC3B,uBAAuB,GAAG,IAAI,CAMhC;AAYD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,GAAG,IAAI,CAWtE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CASxD;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAgBvE"}
|
package/types/metar-parser.d.ts
CHANGED
|
@@ -1,64 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
code: string;
|
|
3
|
-
}
|
|
4
|
-
export interface MetarWind {
|
|
5
|
-
degrees: number | null;
|
|
6
|
-
speed_kts: number;
|
|
7
|
-
speed_mps: number;
|
|
8
|
-
gust_kts: number | null;
|
|
9
|
-
gust_mps: number | null;
|
|
10
|
-
degrees_from: number | null;
|
|
11
|
-
degrees_to: number | null;
|
|
12
|
-
}
|
|
13
|
-
export interface MetarVisibility {
|
|
14
|
-
miles: number;
|
|
15
|
-
miles_text: string;
|
|
16
|
-
meters: number;
|
|
17
|
-
meters_text: string;
|
|
18
|
-
}
|
|
19
|
-
export type MetarCloudCode = "FEW" | "SCT" | "BKN" | "OVC";
|
|
20
|
-
export interface MetarCloud {
|
|
21
|
-
code: MetarCloudCode;
|
|
22
|
-
feet: number;
|
|
23
|
-
meters: number;
|
|
24
|
-
}
|
|
25
|
-
export interface MetarCeiling {
|
|
26
|
-
feet: number | null;
|
|
27
|
-
meters: number | null;
|
|
28
|
-
}
|
|
29
|
-
export interface MetarTemperature {
|
|
30
|
-
celsius: number | null;
|
|
31
|
-
fahrenheit: number | null;
|
|
32
|
-
}
|
|
33
|
-
export interface MetarHumidity {
|
|
34
|
-
percent: number | null;
|
|
35
|
-
}
|
|
36
|
-
export interface MetarPressure {
|
|
37
|
-
hg: number | null;
|
|
38
|
-
kpa: number | null;
|
|
39
|
-
mb: number | null;
|
|
40
|
-
}
|
|
41
|
-
export type MetarIcaoFlightCategory = "VFR" | "IFR";
|
|
42
|
-
export type MetarFlightCategory = MetarIcaoFlightCategory | "MVFR" | "LIFR";
|
|
43
|
-
export interface Metar {
|
|
44
|
-
raw_text: string;
|
|
45
|
-
raw_parts: string[];
|
|
46
|
-
icao: string;
|
|
47
|
-
observed: Date;
|
|
48
|
-
forecastFrom: Date | null;
|
|
49
|
-
forecastTo: Date | null;
|
|
50
|
-
wind: MetarWind;
|
|
51
|
-
visibility: MetarVisibility;
|
|
52
|
-
conditions: MetarCode[];
|
|
53
|
-
clouds: MetarCloud[];
|
|
54
|
-
ceiling: MetarCeiling;
|
|
55
|
-
temperature: MetarTemperature;
|
|
56
|
-
dewpoint: MetarTemperature;
|
|
57
|
-
humidity: MetarHumidity;
|
|
58
|
-
barometer: MetarPressure;
|
|
59
|
-
flight_category: MetarFlightCategory | null;
|
|
60
|
-
icao_flight_category: MetarIcaoFlightCategory | null;
|
|
61
|
-
}
|
|
1
|
+
import type { Metar } from "./metar-parser.type.js";
|
|
62
2
|
/**
|
|
63
3
|
* Convert METAR string into structured object.
|
|
64
4
|
* @see https://api.checkwx.com/#31-single
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metar-parser.d.ts","sourceRoot":"","sources":["../src/metar-parser.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"metar-parser.d.ts","sourceRoot":"","sources":["../src/metar-parser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAepE;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,aAAa,MAAM,KAAG,KAmEjD,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export interface MetarCode {
|
|
2
|
+
code: string;
|
|
3
|
+
}
|
|
4
|
+
export interface MetarWind {
|
|
5
|
+
degrees: number | null;
|
|
6
|
+
speed_kts: number | null;
|
|
7
|
+
speed_mps: number | null;
|
|
8
|
+
gust_kts: number | null;
|
|
9
|
+
gust_mps: number | null;
|
|
10
|
+
degrees_from: number | null;
|
|
11
|
+
degrees_to: number | null;
|
|
12
|
+
}
|
|
13
|
+
export interface MetarVisibility {
|
|
14
|
+
miles: number;
|
|
15
|
+
miles_text: string;
|
|
16
|
+
meters: number;
|
|
17
|
+
meters_text: string;
|
|
18
|
+
}
|
|
19
|
+
export type MetarCloudCode = "FEW" | "SCT" | "BKN" | "OVC" | "VV";
|
|
20
|
+
export interface MetarCloud {
|
|
21
|
+
code: MetarCloudCode;
|
|
22
|
+
feet: number;
|
|
23
|
+
meters: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Ceiling values of lowest cloud layer reporting `BKN`, `OVC` or `VV`.
|
|
27
|
+
* Values will be `null` if no such layer was found.
|
|
28
|
+
*/
|
|
29
|
+
export interface MetarCeiling {
|
|
30
|
+
/**
|
|
31
|
+
* Ceiling in feet of lowest cloud layer reporting `BKN`, `OVC` or `VV`.
|
|
32
|
+
* Ceiling in feet will be `null` if no such layer was found.
|
|
33
|
+
*/
|
|
34
|
+
feet: number;
|
|
35
|
+
/**
|
|
36
|
+
* Ceiling in meters of lowest cloud layer reporting `BKN`, `OVC` or `VV`.
|
|
37
|
+
* Ceiling in meters will be `null` if no such layer was found.
|
|
38
|
+
*/
|
|
39
|
+
meters: number;
|
|
40
|
+
}
|
|
41
|
+
export interface MetarTemperature {
|
|
42
|
+
celsius: number;
|
|
43
|
+
fahrenheit: number;
|
|
44
|
+
}
|
|
45
|
+
export interface MetarHumidity {
|
|
46
|
+
percent: number;
|
|
47
|
+
}
|
|
48
|
+
export interface MetarPressure {
|
|
49
|
+
hg: number;
|
|
50
|
+
kpa: number;
|
|
51
|
+
mb: number;
|
|
52
|
+
}
|
|
53
|
+
export type MetarIcaoFlightCategory = "VFR" | "IFR";
|
|
54
|
+
export type MetarFlightCategory = MetarIcaoFlightCategory | "MVFR" | "LIFR";
|
|
55
|
+
export interface Metar {
|
|
56
|
+
raw_text: string;
|
|
57
|
+
raw_parts: string[];
|
|
58
|
+
icao: string;
|
|
59
|
+
observed: Date;
|
|
60
|
+
forecastFrom: Date | null;
|
|
61
|
+
forecastTo: Date | null;
|
|
62
|
+
wind: MetarWind;
|
|
63
|
+
visibility: MetarVisibility | null;
|
|
64
|
+
conditions: MetarCode[];
|
|
65
|
+
clouds: MetarCloud[];
|
|
66
|
+
ceiling: MetarCeiling | null;
|
|
67
|
+
temperature: MetarTemperature | null;
|
|
68
|
+
dewpoint: MetarTemperature | null;
|
|
69
|
+
humidity: MetarHumidity | null;
|
|
70
|
+
barometer: MetarPressure | null;
|
|
71
|
+
flight_category: MetarFlightCategory | null;
|
|
72
|
+
icao_flight_category: MetarIcaoFlightCategory | null;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=metar-parser.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metar-parser.type.d.ts","sourceRoot":"","sources":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