Skip to main content

Parser and client utilities for the Universal ASCII Lightning Format (UALF)

Project description

ualf

PyPI version CI

Parser and client utilities for the Universal ASCII Lightning Format (UALF), including:

  • parse_ualf_line and parse_ualf to convert UALF text into structured Lightning events
  • fetch_lightning_events helper to call the Norwegian Meteorological Institute (met.no) Frost API lightning endpoint and parse into events
  • Optional DataFrame support via to_dataframe (install with pip 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


Download files

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

Source Distribution

ualf-0.1.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

ualf-0.1.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

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

Hashes for ualf-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6a18483a2572068eff281f0141dc239220f790ed858d6f36027a2f994961ab85
MD5 263d45cfd5e7cb2d28cd5ee20707ad83
BLAKE2b-256 1819f5019466c3acd2fb2cc0fc8b43a0ecb1e6d3f72c45bd89d49d27075eee21

See more details on using hashes here.

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

Hashes for ualf-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a46aeeb23504885e85eaec4a71ac499ae1a7de39c51aa98e88d9ad22bdb0e9a
MD5 c9c6e13df04a1434f334403fcc04de69
BLAKE2b-256 086d56b604047a1a393a5cc4bdfc1209cf5a1afaaeedd92352d7540a58339ea4

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