SignalK / specification

Signal K is a JSON-based format for storing and sharing marine data from different sources (e.g. nmea 0183, 2000, seatalk, etc)
Other
92 stars 69 forks source link

metadata: no way to describe the type of scale for a gauge (logarithmic/linear) #418

Closed bkp7 closed 6 years ago

bkp7 commented 6 years ago

Some values really need to be shown on a logarithmic rather than linear scale eg. luminosity, depth, signal strength. There are also some which work better on a squareroot scale eg. depth, windspeed.

Suggest within meta we add:

"gaugeScale": {
  "lower": 10,
  "upper": 15,
  "type": "linear"
}

where type can be linear, logarithmic, squareroot or power with a default of linear if not present. See also #406 where this layout is suggested for gauge limits but not implemented at present. If power is specified then an additional property must be present to define the power:

"gaugeScale": {
  "lower": 10,
  "upper": 15,
  "type": "power",
  "power": 2
}

Note that a power of 0.5 is equivalent to squareroot, and a power of 1 is equivalent to linear.

In using these scales the type just defines the function which is applied to all values in order to calculate % deflection of the pointer/needle.

For linear: % deflection = (V - L) / (U - L) For logarithmic: % deflection = (log(V) - log(L)) / (log(U) - log(L)) For squareroot: % deflection = (√V - √L) / (√U - √L) For power: % deflection = (Vᴾ - Lᴾ) / (Uᴾ - Lᴾ) Where: V = value, L = lower bound of the gauge, U = upper bound of the gauge and P = power

Note that on a logarithmic scale neither L nor U can be zero.

Are there any others?

tkurki commented 6 years ago

I think you've covered everything we should cover at this stage. I browsed through https://github.com/d3/d3-scale, but I don't think we need to cover all the different cases that a graphing library module needs.