{"id":9937,"library":"metar","title":"Metar - Python METAR report parser","description":"Metar is a Python package designed to parse METAR-coded weather reports, providing easy access to various meteorological data points such as wind, temperature, visibility, and cloud conditions. The project recently settled on the package name `metar` (previously `python-metar`). It is currently at version 2.0.1, with an active release cadence, and requires Python >=3.10.","status":"active","version":"2.0.1","language":"en","source_language":"en","source_url":"https://github.com/python-metar/python-metar/","tags":["weather","aviation","METAR","parser","meteorology"],"install":[{"cmd":"pip install metar","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The package was historically known as `python-metar`. Ensure you use `metar` for imports with recent versions.","wrong":"from python_metar.Metar import Metar","symbol":"Metar","correct":"from metar.Metar import Metar"}],"quickstart":{"code":"from metar.Metar import Metar\n\n# Example METAR string\nmetar_string = \"METAR KSLK 200853Z AUTO 09006KT 10SM CLR 02/M01 A2999 RMK AO2\"\n\n# Parse the METAR report\nm = Metar(metar_string)\n\n# Access parsed data\nprint(f\"Station: {m.station_id}\")\nprint(f\"Time: {m.time}\")\nprint(f\"Wind: {m.wind_dir}{m.wind_speed}KT\")\nprint(f\"Temperature: {m.temp}°C\")\nprint(f\"Dew Point: {m.dewpt}°C\")\nprint(f\"Visibility: {m.vis.value}{m.vis.units}\")\n\n# Print a formatted report\nprint(\"\\n--- Formatted Report ---\")\nprint(m.string())\n","lang":"python","description":"Parse a sample METAR string and access its attributes, then print a human-readable summary."},"warnings":[{"fix":"Remove the `utcdelta` argument when instantiating `Metar`. The library now handles UTC offsets internally or expects UTC input.","message":"The `utcdelta` argument was removed from the `Metar` constructor in version 2.0.0. This was a breaking change.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"If you were using `position.getdistance`, you will need to implement custom distance calculation or find an alternative method. The library no longer provides this functionality.","message":"The `position.getdistance` API was removed in version 1.9.0 as it was unused and broken.","severity":"breaking","affected_versions":">=1.9.0"},{"fix":"Use `pip install metar` for installation and `from metar.Metar import Metar` for imports.","message":"The package name has officially settled on `metar`. While older versions might have been installed as `python-metar`, ensure your `pip install` command and `import` statements use `metar`.","severity":"gotcha","affected_versions":"All versions, especially when upgrading from legacy setups."},{"fix":"Ensure your environment uses Python 3.10 or a newer version.","message":"The library now officially requires Python 3.10 or newer. Installing on older Python versions will likely result in compatibility errors.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure you have installed the correct package with `pip install metar` and update your import statements to `from metar.Metar import Metar`.","cause":"Attempting to import using the old package name after installing the new `metar` package, or not having the `metar` package installed.","error":"ModuleNotFoundError: No module named 'python_metar'"},{"fix":"Remove the `utcdelta` argument from the `Metar` constructor call. The library no longer uses this parameter.","cause":"You are passing the `utcdelta` argument to the `Metar` constructor, which was removed in version 2.0.0.","error":"TypeError: Metar() got an unexpected keyword argument 'utcdelta'"},{"fix":"This method is no longer available. You will need to implement a custom distance calculation if this functionality is required.","cause":"You are attempting to call the `getdistance` method on a `Position` object, which was removed in version 1.9.0.","error":"AttributeError: 'Position' object has no attribute 'getdistance'"}]}