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 acountry_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-only
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_cap_en
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
Alertmodel, 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
- Reusable generic CAP feed backend
- Dedicated Meteoalarm Atom backend for Meteoalarm feeds
- Static curated source registry
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:
- finds the matching source or sources for the supplied country code
- optionally narrows source selection by language metadata
- dispatches to the right backend
- filters alerts by native point query or geometry
- returns normalized
Alertobjects
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:
UnsupportedCountryErrorwhen no sources are registered for the suppliedcountry_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_CODEwevva-warnings point LAT LON COUNTRY_CODE --lang dewevva-warnings point LAT LON COUNTRY_CODE --active-onlywevva-warnings point LAT LON COUNTRY_CODE --debugwevva-warnings source SOURCE_IDwevva-warnings source SOURCE_ID --active-onlywevva-warnings source SOURCE_ID --debugwevva-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, andmeteoalarm_atom - sources are static definitions that point at real official warning feeds or APIs for a given country code and language
This keeps the codebase small while making it easy to add future CAP-based sources through registry entries rather than new modules.
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 89 enabled sources in the built-in registry.
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.
Unsupported sources
These entries are present in the SWIC sources list but are not currently enabled in the registry. Common reasons include feeds with no point-matchable geometry, stale or empty feeds, broken TLS, DNS or reachability problems, or sources that still need a proper verification pass.
A-C: Afghanistan, Albania, Algeria, Angola, Anguilla, Antigua and Barbuda, Austria, Barbados, Belarus, Belgium, Bosnia and Herzegovina, Brazil, British Virgin Islands, Bulgaria, Central African Republic, China, Costa Rica, Côte d'Ivoire, Croatia, Cyprus, CzechiaD-M: Denmark, Egypt, France, Gabon, Greece, Hong Kong, China, Hungary, Iran, Iraq, Ireland, Israel, Italy, Jamaica, Kuwait, Latvia, Lesotho, Libya (State of), Lithuania, Luxembourg, Madagascar, Mali, Malta, Mauritius, Mexico, Montenegro, MyanmarN-S: Netherlands, Niger, North Macedonia, Oman, Panama, Philippines, Poland, Portugal, Republic of Moldova, Romania, Saint Vincent and the Grenadines, São Tomé and Príncipe, Saudi Arabia, Senegal, Serbia, Singapore, Slovakia, South Africa, SurinameT-Y: Thailand, Timor-Leste, Tunisia, Tuvalu, Uganda, United Kingdom of Great Britain and Northern Ireland, Viet Nam, Yemen
Partially supported entries
These countries are enabled, but not every feed or advertised language is currently registered:
- Cameroon:
enandfrare supported; thehafeed is not enabled. - Curaçao and Sint Maarten: Curaçao
en,nl, andpapare supported; the WMO mirroresfeed is not enabled, and Sint Maarten is not separately registered. - India: the IMD
enfeed is supported; the NDMAsachetfeed is not enabled. - Mongolia: the
enfeed is supported; themnfeed is not enabled. - Nigeria: the
enfeed is supported; thehafeed is not enabled. - Republic of Korea: the
enfeed is supported; no separate verifiedkofeed is currently registered. - Sudan: the source is enabled, but registered as
arbecause the live CAP payloads checked were Arabic-only despite the catalogue entry claiming English. - Togo: the source is enabled, but registered as
frbecause the live CAP payloads checked were French-only despite the catalogue entry advertisingen, fr. - Ukraine: the Meteoalarm
enfeed is supported; no separate verifiedukfeed is currently registered.
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 currently limited to the subset of feeds whose linked CAP alerts contain point-matchable polygon 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wevva_warnings-0.1.0.tar.gz.
File metadata
- Download URL: wevva_warnings-0.1.0.tar.gz
- Upload date:
- Size: 34.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
943531d1463b16bcae657ad4e95f4e39705a33a4a4474f2783ac86db6d361e87
|
|
| MD5 |
2f4a99ce27fa6ce41eb70b2cd65323d1
|
|
| BLAKE2b-256 |
ea2b29fbb08fbaa7b679615a3a2667494ab807eb22cb183b0a943fb70aa44084
|
File details
Details for the file wevva_warnings-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wevva_warnings-0.1.0-py3-none-any.whl
- Upload date:
- Size: 34.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0554b5a47ebd9e711ecf3251b936ccbd6d47685a758e353121efc98cf0a7429a
|
|
| MD5 |
d970a20d01456df6bbbc12731757a473
|
|
| BLAKE2b-256 |
5286854d661d4b679301213d991e467861e08869b80ea7795734104b04be050c
|