metar-taf-parser 1.0.0 → 1.0.1

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/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Alexander Harding
3
+ Copyright (c) 2022 Alexander Harding
4
+ Copyright 2021 Jean-Kevin KPADEY
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,11 +1,9 @@
1
1
  # metar-taf-parser
2
2
 
3
- This is a port of [python-metar-taf-parser](https://github.com/mivek/python-metar-taf-parser) to typescript. It's fully typed and tested with i18n support, and can run on Node or the browser.
3
+ This is a port of [python-metar-taf-parser](https://github.com/mivek/python-metar-taf-parser) to Typescript. It's fully typed and tested with i18n support, and can run on Node or the browser.
4
4
 
5
5
  ## Example
6
6
 
7
- ⚠️ This project is an active work in progress. These examples do not currently work.
8
-
9
7
  ### Parse METAR
10
8
 
11
9
  ```ts
@@ -13,7 +11,7 @@ import { parseMetar } from 'metar-taf-parser'
13
11
 
14
12
  // Get the raw METAR/TAF strings in your preferred way
15
13
  // For example: https://www.aviationweather.gov/dataserver
16
- const { metar } = await myService.getAirportData('KMSN')
14
+ // const { metar } = await myService.getAirportData('KMSN')
17
15
 
18
16
  // Readily serializable
19
17
  const metarResult = parseMetar(metar)
@@ -28,7 +26,7 @@ import { parseTAF } from 'metar-taf-parser'
28
26
 
29
27
  // Get the raw METAR/TAF strings in your preferred way
30
28
  // For example: https://www.aviationweather.gov/dataserver
31
- const { taf } = await myService.getAirportData('KMSN')
29
+ // const { taf } = await myService.getAirportData('KMSN')
32
30
 
33
31
  // Readily serializable
34
32
  const tafResult = parseTAF(taf)
@@ -47,8 +45,16 @@ const { metar } = await myService.getAirportData('KMSN')
47
45
  const metarResult = parseMetar(metar, { locale: de })
48
46
  ```
49
47
 
48
+ ## Contributing
49
+
50
+ This project is intended to provide feature parity with [python-metar-taf-parser](https://github.com/mivek/python-metar-taf-parser) and will only accept PRs to maintain feature parity or to fix inconsistencies with that project.
51
+
50
52
  ## Development
51
53
 
52
54
  ### Example site
53
55
 
54
- Please see [the example site README.md](example/README.md).
56
+ Please see [the example site README.md](example/README.md).
57
+
58
+ ## Acknowledgment
59
+
60
+ This software port was made possible due to the fantastic work of [@mivek](https://github.com/mivek) in [python-metar-taf-parser](https://github.com/mivek/python-metar-taf-parser). If you like this project, please [consider buying @mivek a coffee](https://ko-fi.com/mivek).
@@ -84,9 +84,9 @@ export interface IAbstractWeatherCode extends IAbstractWeatherContainer, ITime {
84
84
  trends: IAbstractTrend[];
85
85
  }
86
86
  export interface IMetar extends IAbstractWeatherCode {
87
- temperature: number;
88
- dewPoint: number;
89
- altimeter: number;
87
+ temperature?: number;
88
+ dewPoint?: number;
89
+ altimeter?: number;
90
90
  nosig: boolean;
91
91
  auto: boolean;
92
92
  runwaysInfo: IRunwayInfo[];
@@ -49,8 +49,6 @@ function parseDeliveryTime(timeString) {
49
49
  hour: +timeString.slice(2, 4),
50
50
  minute: +timeString.slice(4, 6),
51
51
  };
52
- // TODO
53
- // abstractWeatherCode.time = new Date()
54
52
  }
55
53
  /**
56
54
  * This function parses the array containing the remark and concat the array into a string
@@ -224,7 +222,6 @@ class MetarParser extends AbstractParser {
224
222
  trendParts[i].startsWith(this.AT)) {
225
223
  const trendTime = {
226
224
  type: enum_1.TimeIndicator[trendParts[i].slice(0, 2)],
227
- // TODO implement time
228
225
  hour: +trendParts[i].slice(2, 4),
229
226
  minute: +trendParts[i].slice(4, 6),
230
227
  };
@@ -244,18 +241,7 @@ class MetarParser extends AbstractParser {
244
241
  */
245
242
  parse(input) {
246
243
  const metarTab = this.tokenize(input);
247
- const metar = Object.assign(Object.assign({}, parseDeliveryTime(metarTab[1])), { station: metarTab[0], message: input,
248
- // wind: IWind,
249
- // visibility?: Visibility,
250
- // verticalVisibility: number,
251
- // windShear: IWindShear,
252
- cavok: false, remark: "", remarks: [], clouds: [], weatherConditions: [],
253
- // airport: IAirport,
254
- trends: [],
255
- // temperature: number,
256
- // dewPoint: number,
257
- // altimeter: number,
258
- nosig: false, auto: false, runwaysInfo: [] }); // TODO remove cast
244
+ const metar = Object.assign(Object.assign({}, parseDeliveryTime(metarTab[1])), { station: metarTab[0], message: input, cavok: false, remark: "", remarks: [], clouds: [], weatherConditions: [], trends: [], nosig: false, auto: false, runwaysInfo: [] });
259
245
  let index = 2;
260
246
  while (index < metarTab.length) {
261
247
  if (!super.generalParse(metar, metarTab[index])) {
@@ -272,8 +258,8 @@ class MetarParser extends AbstractParser {
272
258
  weatherConditions: [],
273
259
  clouds: [],
274
260
  times: [],
261
+ remarks: [],
275
262
  };
276
- // TODO - remove casting
277
263
  index = this.parseTrend(index, trend, metarTab);
278
264
  metar.trends.push(trend);
279
265
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metar-taf-parser",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Parse METAR and TAF files",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",