Skip to main content

A Python parser for converting WAFS IWXXM SIGWX XML files into GeoJSON, WKT, or WKB feature collections.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

sigwx-parser

A Python parser for converting WAFS IWXXM SIGWX XML files into GeoJSON, WKT, or WKB feature collections.

SIGWX (Significant Weather) charts are issued by the World Area Forecast System (WAFS) and contain information about meteorological hazards for aviation — things like icing, turbulence, jet streams, and tropical cyclones. This library parses the IWXXM XML format of those files and outputs structured geometry data in your choice of format.

Installation

pip install sigwx-parser

Usage

from sigwx_parser import SigwxParser

# From a file
parser = SigwxParser(file_path="sigwx_output.xml")

# From a raw XML string
parser = SigwxParser(file_path=None, xml_content=xml_string)

forecasts = parser.parse()

The output_format parameter controls the geometry representation. It defaults to "geojson", but "wkt" and "wkb" are also supported:

forecasts = parser.parse(output_format="geojson")  # default
forecasts = parser.parse(output_format="wkt")
forecasts = parser.parse(output_format="wkb")

The top-level key of the feature collection in each result dict matches the chosen format.


GeoJSON output (output_format="geojson")

[
    {
        "valid_time": "2024-02-22T12:00:00Z",
        "issue_time": "2024-02-21T18:00:00Z",
        "geojson": {
            "type": "FeatureCollection",
            "features": [
                {
                    "type": "Feature",
                    "geometry": {
                        "type": "Polygon",
                        "coordinates": [ [ [lon, lat], ... ] ]
                    },
                    "properties": {
                        "feature_id": "uuid.12345...",
                        "phenomenon": "AIRFRAME_ICING",
                        "upper_fl": "240",
                        "lower_fl": "100"
                    }
                }
            ]
        }
    }
]

WKT output (output_format="wkt")

[
    {
        "valid_time": "2024-02-22T12:00:00Z",
        "issue_time": "2024-02-21T18:00:00Z",
        "wkt": {
            "features": [
                {
                    "geometry": "POLYGON ((lon lat, lon lat, ...))",
                    "properties": {
                        "feature_id": "uuid.12345...",
                        "phenomenon": "AIRFRAME_ICING",
                        "upper_fl": "240",
                        "lower_fl": "100"
                    }
                }
            ]
        }
    }
]

WKB output (output_format="wkb")

[
    {
        "valid_time": "2024-02-22T12:00:00Z",
        "issue_time": "2024-02-21T18:00:00Z",
        "wkb": {
            "features": [
                {
                    "geometry": "0103000000...",
                    "properties": {
                        "feature_id": "uuid.12345...",
                        "phenomenon": "AIRFRAME_ICING",
                        "upper_fl": "240",
                        "lower_fl": "100"
                    }
                }
            ]
        }
    }
]

WKB geometries are returned as hex-encoded strings so they remain JSON-serializable. To get raw bytes for direct database insertion:

raw_bytes = bytes.fromhex(feature["geometry"])

Most databases (PostGIS, SpatiaLite, etc.) also accept the hex string directly via their ST_GeomFromWKB / GeomFromWKB functions, so in practice you often don't need to convert.


Excluding feature types

You can skip specific phenomenon types by passing an exclude set to parse():

forecasts = parser.parse(exclude={"CLOUD", "RADIATION"})

Valid values for exclude:

Value Description
AIRFRAME_ICING Airframe icing areas
CLOUD Significant cloud (e.g. CB, TCU)
JETSTREAM Jet stream axes
TROPOPAUSE Tropopause height
TURBULENCE Turbulence areas
RADIATION Radiation hazards
TROPICAL_CYCLONE Tropical cyclone positions
VOLCANO Volcanic ash areas

Notes

  • Polygon winding order is corrected automatically using Shapely.
  • Geometries that cross the antimeridian are split correctly using the antimeridian library.
  • Namespaces are stripped from the XML before parsing, so the XPath queries stay clean.

Dependencies

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sigwx_parser-1.5.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sigwx_parser-1.5.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file sigwx_parser-1.5.1.tar.gz.

File metadata

  • Download URL: sigwx_parser-1.5.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sigwx_parser-1.5.1.tar.gz
Algorithm Hash digest
SHA256 4121ee440621ed77433e9f8e9db5655fbc422de5ab2a75342431e14b072c7849
MD5 0bfd4bf1ec9605ec379d2ac7ac5682b6
BLAKE2b-256 3388821e9d6736a0006ec633ed3cc578fc16a1d548d703f01a86ddb3c996d3db

See more details on using hashes here.

Provenance

The following attestation bundles were made for sigwx_parser-1.5.1.tar.gz:

Publisher: publish.yml on miguel-pub/sigwx-parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sigwx_parser-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: sigwx_parser-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sigwx_parser-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 25990234ef8050e30f728c2a1749121eb6af31cab24a4e79de288ccb463b6b12
MD5 6d59f7e5cbbf17a2ad0eee91a65b38e0
BLAKE2b-256 addda07943038cbf928106db69475f7661b880557501e73cbbf9deacc5340933

See more details on using hashes here.

Provenance

The following attestation bundles were made for sigwx_parser-1.5.1-py3-none-any.whl:

Publisher: publish.yml on miguel-pub/sigwx-parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page