Skip to main content

Lightweight Python library for official weather warnings

Project description

wevva-warnings

wevva-warnings is a small Python library and CLI for looking up official weather warnings for a single point.

It pulls from official CAP feeds and national meteorological APIs, normalizes the results into a compact Alert model, and filters them to the coordinates you asked about.

The project is intentionally narrow:

  • you supply lat, lon, and a country_code
  • the registry picks the right official source or sources for that country
  • alerts are matched by native point query or by geometry
  • the output stays close to what the provider actually published

It is not trying to infer countries from coordinates, invent a cross-provider severity model, or aggressively merge alerts that happen to look similar.

Install

pip install wevva-warnings

Quick start

Python

from wevva_warnings import get_alerts_for_point

alerts = get_alerts_for_point(
    lat=40.71,
    lon=-74.00,
    country_code="US",
    active_only=True,
)

for alert in alerts:
    print(alert.headline)
    print(alert.severity)
    print(alert.url)

If a country publishes multiple language-specific feeds, you can steer source selection with lang:

german_alerts = get_alerts_for_point(
    lat=49.8,
    lon=7.67,
    country_code="DE",
    lang="de",
)

Command line

The CLI has three commands: point for coordinate lookups, source for inspecting one registered source, and sources for the built-in registry.

wevva-warnings point 40.71 -74.00 US

If you want a particular source language when a country has multiple feeds:

wevva-warnings point 49.8 7.67 DE --lang de

If you only want alerts that are active right now:

wevva-warnings point 28.12 -17.24 ES --active

If you want progress output while a query is running:

wevva-warnings point 40.71 -74.00 US --debug

To inspect the built-in source registry:

wevva-warnings sources

To fetch alerts from one specific source:

wevva-warnings source fmi_en

By default, source pretty-prints compact Alert objects. To render one source as a table instead:

wevva-warnings source fmi_en --formatted

You can also run the CLI as a module:

python -m wevva_warnings point 40.71 -74.00 US

Human CLI output is deliberately compact and readable: headline, event, severity, times, and description. If you need structured output, use the Python API.

What You Get

  • Normalized Alert model, including source alert URLs when available
  • Point-based warning queries
  • CAP parsing
  • Polygon, MultiPolygon, and CAP circle matching
  • Official API backends for NWS and GeoMet
  • Dedicated provider backends for AEMET, ANMETEO, Bahrain Meteorological Directorate, Belgidromet, Belize National Meteorological Service, BMKG, BoM and CMA via the WMO SWIC mirror, Botswana Department of Meteorological Services, CAPEWS Caribbean feeds, Cameroon National Meteorology, Chad, Comoros, Congo, Curaçao Meteorological Department, Djibouti, DMH Myanmar, DMH Paraguay, DR Congo, DWD, Ecuador INAMHI, Ethiomet, FMI, Ghana Meteorological Agency, Hong Kong Observatory, HydroMet Guyana, Hydrometcenter, IGBU, Icelandic Meteorological Office, India Meteorological Department, INAM Mozambique, INDOMET, INMET Brazil, INMET Guinea-Bissau, INUMET, Jordan Meteorological Department, KMA, Kazhydromet, Kyrgyzhydromet, Kenya Meteorological Department, Maldives Meteorological Service, MET Norway, METEO-BENIN, Meteorological Service of Jamaica, Met Eireann, MetService New Zealand, MeteoBurkina, MeteoChile, MeteoGambia, MeteoLiberia, MeteoMauritanie, MetMalawi, MeteoSC, MeteoSouthSudan, MeteoSudan, MeteoTogo, Mexico SMN, NAMEM Mongolia, Nigerian Meteorological Agency, NVE, PAGASA, Qatar Civil Aviation Authority, Saint Lucia, SLMET, SMG, SMN, Solomon Islands Meteorological Service, TCI Emergency Alerts, Thai Meteorological Department, TMA, Trinidad and Tobago Meteorological Service, Uzhydromet, Vanuatu Meteorology and Geo-Hazards Department, WeatherZW, and ZMD
  • Reusable generic CAP feed backend
  • Dedicated Meteoalarm Atom backend for Meteoalarm feeds
  • Static curated source registry

The wevva-warnings sources table includes a V2 column marking sources that have had the newer provider-specific parsing pass.

Public API

from wevva_warnings import get_alerts_for_point, get_alerts_for_source, list_sources

get_alerts_for_point(lat, lon, country_code, lang=None, debug=False, active_only=False) is the primary API. It:

  1. finds the matching source or sources for the supplied country code
  2. optionally narrows source selection by language metadata
  3. dispatches to the right backend
  4. filters alerts by native point query or geometry
  5. returns normalized Alert objects

get_alerts_for_source(source_id, active_only=False) is a lower-level helper for debugging or source-specific use.

list_sources() returns the built-in source registry as WarningSource objects.

get_alerts_for_point(...) raises:

  • UnsupportedCountryError when no sources are registered for the supplied country_code

The caller is responsible for supplying the correct country_code. The library does not infer country from coordinates.

If a country has multiple language-specific feeds and you do not pass lang, the library prefers English-capable sources when available. Otherwise it uses the first declared source for that country. If you request a language that is not supported for that country, get_alerts_for_point(...) emits a warning and falls back to the default source selection.

CLI summary

  • wevva-warnings point LAT LON COUNTRY_CODE
  • wevva-warnings point LAT LON COUNTRY_CODE --lang de
  • wevva-warnings point LAT LON COUNTRY_CODE --active
  • wevva-warnings point LAT LON COUNTRY_CODE --debug
  • wevva-warnings source SOURCE_ID
  • wevva-warnings source SOURCE_ID --active
  • wevva-warnings source SOURCE_ID --formatted
  • wevva-warnings source SOURCE_ID --debug
  • wevva-warnings sources

If you request an unsupported country code, the CLI exits with an error. If you request an unsupported language for a supported country, it warns and falls back to the default source selection.

Source model

The package is built around two concepts:

  • backends are ingestion strategies such as nws, geomet, generic_cap, meteoalarm_atom, and a small number of provider-specific backends where the source shape or behavior justifies it
  • sources are static definitions that point at real official warning feeds or APIs for a given country code and language

Most CAP sources still go through shared ingestion paths, but providers with useful quirks or special behavior can have their own modules without changing the public API.

Testing

Running an individual test module directly is useful while developing, for example:

uv run python tests/test_query.py

Source registry

There are currently 151 enabled sources in the built-in registry.

Some provider backends have been migrated structurally, but could not be fully validated against live alerts because the feed was empty when checked. These should be revisited later:

Source ID Provider Checked Note
nms_belize Belize National Meteorological Service 2026-04-17 RSS feed was empty
meteo_cameroon_en Cameroon National Meteorology 2026-04-17 English feed was empty; French feed was live
vedur Icelandic Meteorological Office 2026-04-17 RSS feed was empty
qatar_caa_en Qatar Civil Aviation Authority 2026-04-17 RSS feed was empty
qatar_caa_ar Qatar Civil Aviation Authority 2026-04-17 RSS feed was empty
imd_india India Meteorological Department 2026-04-17 RSS feed was empty
inam_mz INAM Mozambique 2026-04-17 RSS feed was empty
eswatini_met Eswatini Meteorological Service 2026-04-17 RSS feed was empty
msj Meteorological Service of Jamaica 2026-04-17 Atom feed had no active advisories
dma_anguilla Disaster Management Anguilla 2026-04-17 Atom feed was empty
antigua_met Antigua and Barbuda Meteorological Service 2026-04-17 Atom feed was empty
dem_barbados Department of Emergency Management Barbados 2026-04-17 Atom feed was empty
dmh_myanmar Department of Meteorology and Hydrology Myanmar 2026-04-17 Atom feed was empty
meteo_cw_en Meteorological Department Curaçao 2026-04-17 English feed was empty
meteoalarm_atom_andorra Meteoalarm 2026-04-17 Atom feed was empty
pagasa PAGASA 2026-04-17 Atom feed was empty
ametvigilance_dz AmetVigilance Algeria 2026-04-17 Candidate feed URL returned the web app shell, not a usable RSS or CAP feed
kuwait_met Kuwait Meteorology 2026-04-17 Host did not resolve from this environment
saudi_ncm_en Saudi NCM (English) 2026-04-17 Feed request hung or returned 503 while checking
saudi_ncm_ar Saudi NCM (Arabic) 2026-04-17 Feed request hung while checking
svg_met Saint Vincent and the Grenadines Meteorological Services 2026-04-17 Atom feed was empty
tmd_en Thai Meteorological Department 2026-04-17 RSS feed was empty
tmd_th Thai Meteorological Department 2026-04-17 RSS feed was empty

For the full current list, use:

wevva-warnings sources

The source definitions themselves live in wevva_warnings/sources.py. The looser all_sources.txt file is kept as a broader reference and backlog.

WMO Gap Tracker

The sources.csv file is a local snapshot of the WMO source list. Compared with the current registry, the remaining gaps fall into four useful categories.

Genuinely new providers

At the moment there are no remaining clean WMO-mirror provider gaps in this table. The remaining expansion work is mostly in the revisit-later queue, language variants we skipped deliberately, or special cases like Australia and China.

Intentionally skipped language variants

These are additional language feeds or mirror variants for countries already in the registry. We skipped them deliberately rather than because they were missed.

Country / provider Missing variant Current support Note
Cameroon cm-meteo-ha meteo_cameroon_en, meteo_cameroon_fr Hausa mirror feed not enabled
Curaçao and Sint Maarten cw-meteo-es meteo_cw_en, meteo_cw_nl, meteo_cw_pap Spanish WMO mirror not enabled
India NDMA sachet RSS imd_india Separate provider family from IMD
Mongolia mn-namem-mn namem_en Mongolian feed not enabled
Nigeria ng-nimet-ha nimet_en Hausa feed not enabled

Good next candidates

There are no remaining top-priority candidates in this bucket right now. The main unfinished work is the revisit-later queue and the intentionally skipped language variants.

Notes

CAP feed entries are curated manually from authoritative official sources, including the WMO SWIC sources table as a maintainer reference.

BMKG requires downstream applications to credit BMKG as the data source when using its CAP feeds.

Meteoalarm support is registered broadly through the Atom backend, but the usefulness of individual country feeds still depends on the linked CAP alerts carrying point-matchable geometry.

Some CAP feeds, such as Bahrain, are published through the WMO Alert Hub mirror URLs listed in the SWIC catalogue rather than a provider-hosted domain.

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

wevva_warnings-0.2.1.tar.gz (77.0 kB view details)

Uploaded Source

Built Distribution

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

wevva_warnings-0.2.1-py3-none-any.whl (130.5 kB view details)

Uploaded Python 3

File details

Details for the file wevva_warnings-0.2.1.tar.gz.

File metadata

  • Download URL: wevva_warnings-0.2.1.tar.gz
  • Upload date:
  • Size: 77.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for wevva_warnings-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8162b2d606c8a81f25e7045790b82c003ace13f4a16cd03b499fce82549217c5
MD5 259eb0d174ddc8195083fcba86498b7f
BLAKE2b-256 ccaed0eb31f8f880f6043556ffd5683c7f8e2da6fe2ab3ab327d68842f71e85e

See more details on using hashes here.

File details

Details for the file wevva_warnings-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: wevva_warnings-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 130.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for wevva_warnings-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da76677b2184f8283718c53193cb14578979af53e1cb23d2dd04dce91ec453ec
MD5 b004f16839e3d3a1a9c83f6a26850c79
BLAKE2b-256 25b73789796dbdcacf42113a70a485fe07ed51d4bc646d1739e47e0831030098

See more details on using hashes here.

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