https://github.com/gipphe/ualf
A tiny package for parsing LPSS/CGLSS (UALF) strings.
https://github.com/gipphe/ualf
cglss lightning lpss string-parser ualf
Last synced: 2 months ago
JSON representation
A tiny package for parsing LPSS/CGLSS (UALF) strings.
- Host: GitHub
- URL: https://github.com/gipphe/ualf
- Owner: Gipphe
- License: mit
- Created: 2017-10-17T22:32:02.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2023-07-20T10:48:35.000Z (over 2 years ago)
- Last Synced: 2025-06-24T23:03:14.909Z (6 months ago)
- Topics: cglss, lightning, lpss, string-parser, ualf
- Language: TypeScript
- Homepage:
- Size: 248 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ualf
> LLPS/CGLSS (UALF) data parser
[](https://www.npmjs.com/package/ualf)
[](https://circleci.com/gh/Gipphe/ualf)
[](https://coveralls.io/github/Gipphe/ualf)
[](https://opensource.org/licenses/MIT)
A tiny package for parsing LLPS/CGLSS (UALF) strings.
- [Getting Started](#getting-started)
- [Installing](#installing)
- [Usage](#usage)
- [Specification](#specification)
- [Contribution](#contribution)
- [Compatibility](#compatibility)
- [Changelog](#changelog)
- [Versioning](#versioning)
- [License](#license)
- [Further reading](#further-reading)
## Getting started
### Installing
Use the following command to add it to your `dependencies`:
```shell
npm install --save ualf
```
### Usage
```javascript
import ualf from "ualf";
ualf(
"0 2017 10 16 16 01 07 345596160 65.5204 12.7377 -87 " +
"0 12 17 134.27 0.40 0.40 0.72 13.1 10.0 -0.0 1 1 0 1"
);
```
output is an object with the following key-value pairs for the given string
above:
```javascript
({
version: "0",
date: Date,
year: "2017",
month: "10",
day: "16",
hour: "16",
hours: "16",
minutes: "01",
seconds: "07",
nanoseconds: "345596160",
nano: "345596160",
latitude: "65.5204",
lat: "65.5204",
longitude: "12.7377",
long: "12.7377",
lng: "12.7377",
peakCurrent: "-87",
multiplicity: "0",
numSensors: "12",
numberOfSensors: "12",
freedom: "17",
degreesOfFreedom: "17",
ellipseAngle: "134.27",
semiMajorAxis: "0.40",
semiMinorAxis: "0.40",
chiSquareValue: "0.72",
riseTime: "13.1",
peakToZeroTime: "10.0",
maxRateOfRise: "-0.0",
cloudIndicator: "1",
angleIndicator: "1",
signalIndicator: "0",
timingIndicator: "1",
});
```
For numerical output, use the attached `asNumbers` function:
```javascript
import * as ualf from "ualf";
ualf(
"0 2017 10 16 16 01 07 345596160 65.5204 12.7377 -87 " +
"0 12 17 134.27 0.40 0.40 0.72 13.1 10.0 -0.0 1 1 0 1"
);
```
output is an object with the following key-value pairs for the given string
above:
```javascript
({
version: 0,
date: Date,
year: 2017,
month: 10,
day: 16,
hour: 16,
hours: 16,
minutes: 01,
seconds: 07,
nanoseconds: 345596160,
nano: 345596160,
latitude: 65.5204,
lat: 65.5204,
longitude: 12.7377,
long: 12.7377,
lng: 12.7377,
peakCurrent: -87,
multiplicity: 0,
numSensors: 12,
numberOfSensors: 12,
freedom: 17,
degreesOfFreedom: 17,
ellipseAngle: 134.27,
semiMajorAxis: 0.4,
semiMinorAxis: 0.4,
chiSquareValue: 0.72,
riseTime: 13.1,
peakToZeroTime: 10.0,
maxRateOfRise: -0.0,
cloudIndicator: 1,
angleIndicator: 1,
signalIndicator: 0,
timingIndicator: 1,
});
```
## Specification
The UALF "specification" looks something like [this]. Each of these named
segments have been extracted as their own key-value pair of the resulting object
returned from calling this package. All values are kept as strings to retain
leading zeroes.
```text
{
version,
date, // Date object with the passed date and time
year,
month,
day,
hour,
hours, // alias for `hour`
minutes,
seconds,
nanoseconds,
nano, // alias for `nanoseconds`
latitude,
lat, // alias for `latitude`
longitude,
long, // alias for `longitude`
lng, // alias for `longitude`
peakCurrent,
multiplicity,
numberOfSensors,
numSensors, // alias for `numberOfSensors`
degreesOfFreedom,
freedom, // alias for `degreesOfFreedom`
ellipseAngle,
semiMajorAxis,
semiMinorAxis,
chiSquareValue,
riseTime,
peakToZeroTime,
maxRateOfRise,
cloudIndicator,
angleIndicator,
signalIndicator,
timingIndicator;
}
```
## Contribution
This package is open to pull requests. To set up the test environment, fork it,
clone it, and run
```bash
npm install
```
in the package's folder.
To run unit tests:
```bash
npm test
```
To build:
```bash
npm build
```
## Compatibility
This package is compatible with Node versions 14 and up.
## Changelog
Changelog is available at [the repository].
## Versioning
We use [SemVer] for versioning. For the versions available, see the
[tags on this repository].
## License
This project is licensed under the MIT License - see the [LICENSE.md] file for
details
## Further reading
For more information on the specifics of LLPS/CGLSS, and their data format UALF,
check [this document] or [this abstract].
[SemVer]: http://semver.org/
[tags on this repository]: https://github.com/Gipphe/ualf/tags
[this document]: http://www.gentoogeek.org/files/lightning_MARSS_poster.pdf
[this abstract]: https://ams.confex.com/ams/Annual2005/webprogram/Paper85823.html
[LICENSE.md]: LICENSE.md
[the repository]: http://github.com/Gipphe/ualf/blob/master/CHANGELOG.md
[this]: https://beta.api.met.no/images/UALF_format.png