Subscribe to alerts from the National Weather Service
Project description
NWS_Alert
A easy way to subscribe to National Weather Service (NWS) alerts.
Install
pip install nws_alert
Usage
from nws import NWS nws = NWS() # Subscribe to alerts in North Carolina with severity "Moderate" or "Severe" @nws.alert(state='NC', severity='Moderate') @nws.alert(state='NC', severity='Severe') def MyStateAlert(entry): print('MyStateAlert(', entry.severity, entry.title) # Subscribe to events in my "zone" with urgency "Immediate" @nws.alert(zone='NCC101', urgency='Immediate') # See https://alerts.weather.gov/ for complete zone list def MyZoneAlert(entry): print('MyZoneAlert(', entry.urgency, entry.title) # nws.NowAlerts() will return any event happening now. It will not return future or past events. # Only events from states/zones you have subscribed to with @nws.alert will be included. # This will return all events regardless of severity, certainty, or urgency nowAlerts = nws.NowAlerts() for entry in nowAlerts: print('now entry=', entry)
Notes
The @nws.alert decorator will only be triggered once per NWS alert. The alerts are logged to a JSON file in the current directory so that the code will remember which alerts have already been triggered.
Synchronous Subscriptions
You can update the subscriptions on the fly by creating a Subscription object and calling the .Update()
sub = Subscription(state='NC', severity='Moderate') entries = sub.Update() print('entries=', entries) >>> entries= [<nwscapparser3.nws_cap_parser.CAPEntry object at 0x00000225DD91C7C0>, <nwscapparser3.nws_cap_parser.CAPEntry object at 0x00000225DD91C6A0>]
Event Attributes
See https://docs.oasis-open.org/emergency/cap/v1.2/CAP-v1.2-os.pdf for more detailed CAP info
SEVERITY:
Severe: Significant threat to life or property
Moderate: Possible threat to life or property
Minor: Minimal to no known threat to life or property
Unknown: Severity unknown
CERTAINTY:
Observed: Determined to have occurred or to be ongoing
Likely: Likely (p > ~50%)
Possible: Possible but not likely (p <= ~50%)
Unlikely: Not expected to occur (p ~ 0)
Unknown: Certainty unknown
URGENCY:
Immediate: Responsive action SHOULD be taken immediately
Expected: Responsive action SHOULD be taken soon (within next hour)
Future: Responsive action SHOULD be taken in the near future
Past: Responsive action is no longer required
Unknown: Urgency not known
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file nws_alerts-1.0.1.tar.gz
.
File metadata
- Download URL: nws_alerts-1.0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 864e3a877269a27b9eda6d7181ab188aa75681c6a579032362c90b9bf3fc0251 |
|
MD5 | 6276d3d168a4333624d663ef4b08613d |
|
BLAKE2b-256 | f1afde2c082a59c0d15c39e2aa1a7fd5d79c8e2f47b12d3911d97e2feebae8f8 |
File details
Details for the file nws_alerts-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: nws_alerts-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b98bbffd12b5a795ef3f82a95a083de7d16a099d30405dfb37eadda3f8c02f1 |
|
MD5 | fa412efea6c60a254519963bced02913 |
|
BLAKE2b-256 | 2f1e8c36901bc67ff499325bcd2306ead0808e0979b1c9ad4ba2e674217430e8 |