JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 48
  • Score
    100M100P100Q72767F
  • License MIT

Parse METAR information into structured JavaScript object

Package Exports

  • aewx-metar-parser
  • aewx-metar-parser/dist/metar-parser.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aewx-metar-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

✈️ METAR parser

Parse METAR information into structured JavaScript object. The structure of the returned object is closely related to the API response of CheckWX.

Installation: npm install aewx-metar-parser --save

Functionality

This METAR parser returns the following parts of a METAR string:

  • ICAO code
  • Date / time
  • Wind speed (in knots, meters per second) & direction
  • Visibility (in meters and miles)
  • Weather phenomena
  • Clouds
  • Temperature (in °C & °F) & humidity
  • Barometer pressure (in InHg, kpa & mb)

Code example

import { metarParser } from "./metar-parser.js";

const metarObject = metarParser(
  "KSFO 070121Z 19023KT 1 1/2SM R28R/6000VP6000FT -RA BKN004 BKN013 OVC035 15/12 A2970 RMK AO2 T01500122 PNO $",
);

…returns:

{
  "raw_text": "KSFO 070121Z 19023KT 1 1/2SM R28R/6000VP6000FT -RA BKN004 BKN013 OVC035 15/12 A2970 RMK AO2 T01500122 PNO $",
  "raw_parts": [
    "KSFO",
    "070121Z",
    "19023KT",
    "3/2SM",
    "R28R/6000VP6000FT",
    "-RA",
    "BKN004",
    "BKN013",
    "OVC035",
    "15/12",
    "A2970",
    "RMK",
    "AO2",
    "T01500122",
    "PNO",
    "$"
  ],
  "icao": "KSFO",
  "observed": "2025-02-07T01:21:49.963Z",
  "wind": {
    "degrees": 190,
    "speed_kts": 23,
    "speed_mps": 11.832222176208026,
    "gust_kts": null,
    "gust_mps": null,
    "degrees_from": null,
    "degrees_to": null
  },
  "visibility": {
    "miles": 1.5,
    "miles_text": "1.5",
    "meters": 2414.016,
    "meters_text": "2500"
  },
  "conditions": [
    {
      "code": "-"
    },
    {
      "code": "RA"
    }
  ],
  "clouds": [
    {
      "code": "BKN",
      "feet": 400,
      "meters": 121.92
    },
    {
      "code": "BKN",
      "feet": 1300,
      "meters": 396.24
    },
    {
      "code": "OVC",
      "feet": 3500,
      "meters": 1066.8
    }
  ],
  "ceiling": {
    "feet": 400,
    "meters": 121.92
  },
  "temperature": {
    "celsius": 15,
    "fahrenheit": 59
  },
  "dewpoint": {
    "celsius": 12,
    "fahrenheit": 53.6
  },
  "humidity": {
    "percent": 82.26135295757305
  },
  "barometer": {
    "hg": 29.7,
    "kpa": 100.57572661390854,
    "mb": 1005.7572661390855
  },
  "flight_category": "LIFR",
  "icao_flight_category": "IFR"
}

More information on METAR

Wikipedia has an article on METAR information explaining the very basics.

These sites make METAR information publicly available:

Status

npm version devDependency Status

Author: Frank Boës

Copyright & license: See LICENSE.txt