2022-08-07, 03:24 PM
I the haste to get the code working I mixed up Apparent and True angels... the proper code for getting the True Wind Direction in degrees based on True Wind Direction (in radians) should be:
Code:
module.exports = function (app) {
return {
group: 'wind',
optionKey: 'directionTrueDeg',
title: 'Stationary True Wind Direction in Degrees (based on AWA)',
derivedFrom: ['environment.wind.angleTrueGround'],
calculator: function (atg) {
var windHeadingDeg = 0
if (atg < 0) {
windHeadingDeg = atg * (180 / Math.PI) + 360
} else if (atg > 0) {
windHeadingDeg = atg * (180 / Math.PI)
}
return [{ path: 'environment.wind.angleTrueGroundDeg', value: windHeadingDeg, units: 'deg'}]
}
}
}