Parser and client utilities for the Universal ASCII Lightning Format (UALF)
Project description
ualf
Parser and client utilities for the Universal ASCII Lightning Format (UALF), including:
parse_ualf_lineandparse_ualfto convert UALF text into structuredLightningeventsfetch_lightning_eventshelper to call the Norwegian Meteorological Institute (met.no) Frost API lightning endpoint and parse into events- Optional DataFrame support via
to_dataframe(install withpip install ualf[pandas])
Install
pip install ualf
Or for DataFrame support:
pip install "ualf[pandas]"
Usage (Parser)
from ualf import parse_ualf_line
line = "0 2025 08 15 12 54 11 233363712 64.2117 10.5121 25 0 18 33 117.17 0.23 0.11 0.97 16.8 14.6 2.8 0 1 0 1"
event = parse_ualf_line(line)
print(event.timestamp, event.lat, event.lon)
Usage (Client)
Set credentials for Frost API (Basic auth) and fetch recent strikes:
# .env
FROST_CLIENT_ID=your-id
from ualf import fetch_lightning_events, to_dataframe
lat_lon = (60.0000, 10.0000)
events = fetch_lightning_events(lat_lon, size=1.0, max_age="P1D")
print(len(events))
# Optional pandas
df = to_dataframe(events)
CLI
ualf-cli --lat 60.0000 --lon 10.0000 --size 1 --max-age P1D --format json --client-id your-id
Unit Tests
- Run unit tests:
python -m unittest discover -s tests -p "test_*py" -v
Development
python -m pip install -e .[dev,pandas]
ruff check . && mypy ualf
python -m unittest -v
See CHANGELOG.md for release notes.
License
MIT
Credits
Data from The Norwegian Meteorological Institute API usage
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
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 ualf-0.1.1.tar.gz.
File metadata
- Download URL: ualf-0.1.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a18483a2572068eff281f0141dc239220f790ed858d6f36027a2f994961ab85
|
|
| MD5 |
263d45cfd5e7cb2d28cd5ee20707ad83
|
|
| BLAKE2b-256 |
1819f5019466c3acd2fb2cc0fc8b43a0ecb1e6d3f72c45bd89d49d27075eee21
|
File details
Details for the file ualf-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ualf-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a46aeeb23504885e85eaec4a71ac499ae1a7de39c51aa98e88d9ad22bdb0e9a
|
|
| MD5 |
c9c6e13df04a1434f334403fcc04de69
|
|
| BLAKE2b-256 |
086d56b604047a1a393a5cc4bdfc1209cf5a1afaaeedd92352d7540a58339ea4
|