ualf


Nameualf JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryParser and client utilities for the Universal ASCII Lightning Format (UALF)
upload_time2025-08-16 15:05:55
maintainerNone
docs_urlNone
authorcolaflaske
requires_python>=3.9
licenseMIT License Copyright (c) 2025 UALF Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords frost lightning met.no parser ualf weather
VCS
bugtrack_url
requirements requests python-dotenv pandas
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ualf

[![PyPI version](https://img.shields.io/pypi/v/ualf.svg)](https://pypi.org/project/ualf/)
[![CI](https://github.com/colaflaske/ualf/actions/workflows/ci.yml/badge.svg)](https://github.com/colaflaske/ualf/actions/workflows/ci.yml)

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

```sh
pip install ualf
```

Or for DataFrame support:

```sh
pip install "ualf[pandas]"
```

## Usage (Parser)

```python
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:

```sh
# .env
FROST_CLIENT_ID=your-id
```

```python
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

```sh
ualf-cli --lat 60.0000 --lon 10.0000 --size 1 --max-age P1D --format json --client-id your-id
```

## Unit Tests

- Run unit tests:

```sh
python -m unittest discover -s tests -p "test_*py" -v
```

## Development

```sh
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](https://frost.met.no/howto.html)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ualf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "frost, lightning, met.no, parser, ualf, weather",
    "author": "colaflaske",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/18/19/f5019466c3acd2fb2cc0fc8b43a0ecb1e6d3f72c45bd89d49d27075eee21/ualf-0.1.1.tar.gz",
    "platform": null,
    "description": "# ualf\n\n[![PyPI version](https://img.shields.io/pypi/v/ualf.svg)](https://pypi.org/project/ualf/)\n[![CI](https://github.com/colaflaske/ualf/actions/workflows/ci.yml/badge.svg)](https://github.com/colaflaske/ualf/actions/workflows/ci.yml)\n\nParser and client utilities for the Universal ASCII Lightning Format (UALF), including:\n\n- `parse_ualf_line` and `parse_ualf` to convert UALF text into structured `Lightning` events\n- `fetch_lightning_events` helper to call the Norwegian Meteorological Institute (met.no) Frost API lightning endpoint and parse into events\n- Optional DataFrame support via `to_dataframe` (install with `pip install ualf[pandas]`)\n\n## Install\n\n```sh\npip install ualf\n```\n\nOr for DataFrame support:\n\n```sh\npip install \"ualf[pandas]\"\n```\n\n## Usage (Parser)\n\n```python\nfrom ualf import parse_ualf_line\n\nline = \"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\"\nevent = parse_ualf_line(line)\nprint(event.timestamp, event.lat, event.lon)\n```\n\n## Usage (Client)\n\nSet credentials for Frost API (Basic auth) and fetch recent strikes:\n\n```sh\n# .env\nFROST_CLIENT_ID=your-id\n```\n\n```python\nfrom ualf import fetch_lightning_events, to_dataframe\n\nlat_lon = (60.0000, 10.0000)\nevents = fetch_lightning_events(lat_lon, size=1.0, max_age=\"P1D\")\nprint(len(events))\n\n# Optional pandas\ndf = to_dataframe(events)\n```\n\n## CLI\n\n```sh\nualf-cli --lat 60.0000 --lon 10.0000 --size 1 --max-age P1D --format json --client-id your-id\n```\n\n## Unit Tests\n\n- Run unit tests:\n\n```sh\npython -m unittest discover -s tests -p \"test_*py\" -v\n```\n\n## Development\n\n```sh\npython -m pip install -e .[dev,pandas]\nruff check . && mypy ualf\npython -m unittest -v\n```\n\nSee `CHANGELOG.md` for release notes.\n\n## License\n\nMIT\n\n## Credits\nData from The Norwegian Meteorological Institute\n[API usage](https://frost.met.no/howto.html)\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 UALF Authors\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Parser and client utilities for the Universal ASCII Lightning Format (UALF)",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/colaflaske/ualf",
        "Issues": "https://github.com/colaflaske/ualf/issues"
    },
    "split_keywords": [
        "frost",
        " lightning",
        " met.no",
        " parser",
        " ualf",
        " weather"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "086d56b604047a1a393a5cc4bdfc1209cf5a1afaaeedd92352d7540a58339ea4",
                "md5": "c9c6e13df04a1434f334403fcc04de69",
                "sha256": "1a46aeeb23504885e85eaec4a71ac499ae1a7de39c51aa98e88d9ad22bdb0e9a"
            },
            "downloads": -1,
            "filename": "ualf-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c9c6e13df04a1434f334403fcc04de69",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9900,
            "upload_time": "2025-08-16T15:05:54",
            "upload_time_iso_8601": "2025-08-16T15:05:54.641618Z",
            "url": "https://files.pythonhosted.org/packages/08/6d/56b604047a1a393a5cc4bdfc1209cf5a1afaaeedd92352d7540a58339ea4/ualf-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1819f5019466c3acd2fb2cc0fc8b43a0ecb1e6d3f72c45bd89d49d27075eee21",
                "md5": "263d45cfd5e7cb2d28cd5ee20707ad83",
                "sha256": "6a18483a2572068eff281f0141dc239220f790ed858d6f36027a2f994961ab85"
            },
            "downloads": -1,
            "filename": "ualf-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "263d45cfd5e7cb2d28cd5ee20707ad83",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6520,
            "upload_time": "2025-08-16T15:05:55",
            "upload_time_iso_8601": "2025-08-16T15:05:55.630020Z",
            "url": "https://files.pythonhosted.org/packages/18/19/f5019466c3acd2fb2cc0fc8b43a0ecb1e6d3f72c45bd89d49d27075eee21/ualf-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-16 15:05:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "colaflaske",
    "github_project": "ualf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "python-dotenv",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        }
    ],
    "lcname": "ualf"
}
        
Elapsed time: 1.79402s