Skip to content
Snippets Groups Projects

Fix meteorogram tick labels when they did not match the stored data

Merged David Hoese requested to merge davidh/MetObsSite:bugfix-buoy-wind-speed-ticks into develop
5 files
+ 39
7
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -42,6 +42,10 @@ function getSpeedMPH(val) {
// convert m/s to mph
return val * 3600 / 1608;
}
function getSpeedKnotsToMPH(val) {
// convert knots to mph
return val * 1.15078;
}
function getSpeedKTS(val) {
//m/s to knots
return val * 1.94384;
@@ -58,6 +62,10 @@ function getAccumMillimeter(val) {
// convert inches to millimeters
return val * 25.4;
}
function getAccumMillimeterToInches(val) {
// convert millimeters to inches
return val / 25.4;
}
function cardinalWDir(degrees){
@@ -83,7 +91,9 @@ var CONVERSION_FUNCTIONS = {
getF: getF,
getPresInHg: getPresInHg,
getSpeedMPH: getSpeedMPH,
getSpeedKnotsToMPH: getSpeedKnotsToMPH,
getAccumMillimeter: getAccumMillimeter,
getAccumMillimeterToInches: getAccumMillimeterToInches,
cardinalWDir: cardinalWDir,
getSpeedKTS:getSpeedKTS
};
@@ -197,9 +207,26 @@ function getTickVals(min, max, bump) {
}
function preConvertValue(values, axis_info) {
/**
* Convert values before inserting them into the final storage array.
*/
if (!('preconvert_value' in axis_info)) {
return;
}
var val;
for (var i=0; i < values.length; i++) {
val = CONVERSION_FUNCTIONS[axis_info.preconvert_value](values[i]);
val = (val.toFixed)?val.toFixed(axis_info.precision):val;
values[i] = val;
}
}
module.exports.getTickVals = getTickVals;
module.exports.getProbeText = getProbeText;
module.exports.getTickText = getTickText;
module.exports.preConvertValue = preConvertValue;
Loading