npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

ualf

3.0.0 • Public • Published

ualf

LLPS/CGLSS (UALF) data parser

Package status Build status Code coverage License

A tiny package for parsing LLPS/CGLSS (UALF) strings.

Getting started

Installing

Use the following command to add it to your dependencies:

npm install --save ualf

Usage

var ualf = require('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:

({
  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:

var ualf = require('ualf').asNumbers;
 
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:

({
  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
})

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.

{
  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

npm install

in the package's folder. This will install tap, the only direct dependency.

Run the command

npm test

to run unit tests.

Compatibility

This package is compatible all the way down to Node 4 and IE9.

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.

install

npm i ualf

Downloadsweekly downloads

252

version

3.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability