Skip to content

About

✈️ Parse METAR information into structured JavaScript object

Topics

Resources

Contributing

Stars

23 stars

Watchers

4 watching

Forks

Repository files navigation

✈️ 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)

It also provides TypeScript type definitions.

Please be aware that some values may become null, caused by missing information in the original METAR information. This behavior is intentional and needs to be handled by your implementation.

Code example

import { metarParser } from "aewx-metar-parser";

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

…returns:

{
  "type": "METAR",
  "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": "2026-11-07T01:21:00.000Z",
  "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": [
    {
      "intensity": "-",
      "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 GitHub License

Legal stuff

Author: Frank Boës

Copyright & license: See LICENSE.txt

About

✈️ Parse METAR information into structured JavaScript object

Topics

Resources

Contributing

Stars

23 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages