Giter Club home page Giter Club logo

si's Introduction

Mascot
Système international (SI)

GoDoc License Go Report Card

Working with sensors requires some extra thought into how you report measurements. The need for this library arised when several sensors where reporting different units which was confused or hard to distinguish in the backend. E.g. one sensor reporting km/h and another m/s.

Installation

Windows, OS X & Linux:

go get github.com/gurre/si

Usage examples

Simple usage:

// Our sensor reports temperature in millidegrees celcius
mc := si.NewQuantity(si.Milli, si.Temperature)

// Make sure we never forget what unit we are measuring in
temp := si.NewUnit(24062, mc)

fmt.Println(temp)
// 24062 m°C

Combining several quantities:

// NewQuantity takes a prefix and a measure
km := si.NewQuantity(si.Kilo, si.Length)

// Hour is not a SI unit but officially accepted
h := si.NewQuantity(si.Hour, si.Time)

// Combine a value with several SI-units
kmh := si.NewUnit(100, km, h)

parsed := si.Parse(kmh.String())

fmt.Println(kmh, parsed)
// 100.0 km/h 100.0 km/h

More reading

si's People

Contributors

gurre avatar

Watchers

 avatar

si's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.