Commit 00d01b25 authored by Purves, Murray's avatar Purves, Murray
Browse files

Fixing math fail in radixsnd2arl example

parent e912ee83
Pipeline #16714 passed with stages
in 16 minutes and 34 seconds
......@@ -9,6 +9,7 @@
#include "radixcommand/commandline.hh"
#include "radixcore/stringfunctions.hh"
#include "radixmath/util.hh"
#include "radixio/arldatastream.hh"
#include "radixio/csvfile.hh"
......@@ -388,13 +389,16 @@ int main(int argc, char **argv)
// Write wind data
// Need to calculate wind u and v components from direction/speed
float thisWindU =
(float)(acos(90.0 - (inputWDirs[level] - 180.0)) * inputWSpds[level]);
(float)(toRadians(cos(90.0 - (inputWDirs[level] - 180.0))) *
inputWSpds[level] * 0.51444444444);
float thisWindV =
(float)(asin(90.0 - (inputWDirs[level] - 180.0)) * inputWSpds[level]);
(float)(toRadians(sin(90.0 - (inputWDirs[level] - 180.0))) *
inputWSpds[level] * 0.51444444444);
std::cout << " Initial wspd = " << inputWSpds[level]
<< ", wdir: " << inputWDirs[level] << std::endl;
<< " knots, wdir: " << inputWDirs[level] << " degrees"
<< std::endl;
std::cout << " Converted wind components: u = " << thisWindU
<< ", v = " << thisWindV << std::endl;
<< " m/s, v = " << thisWindV << "m/s" << std::endl;
{
thisRecordHeader.kvar = "UWND";
thisRecordHeader.var1 = thisWindU;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment