Skip to content

Commit

Permalink
Bugfix in calculating missing sounding wind data
Browse files Browse the repository at this point in the history
Resolves #79
  • Loading branch information
chird committed Oct 23, 2023
1 parent 437c590 commit ac27b39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/meteoJS/Sounding.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ export class Sounding {
d.v === undefined &&
d.wdir !== undefined &&
d.wspd !== undefined) {
d.u = d.wspd * Math.sin(d.wdir / 180 * Math.PI);
d.v = d.wspd * Math.cos(d.wdir / 180 * Math.PI);
d.u = -d.wspd * Math.sin(d.wdir / 180 * Math.PI);
d.v = -d.wspd * Math.cos(d.wdir / 180 * Math.PI);
}
else if (d.u !== undefined &&
d.v !== undefined &&
d.wdir === undefined &&
d.wspd === undefined) {
d.wspd = Math.sqrt(Math.pow(d.u, 2) + Math.pow(d.v, 2));
d.wdir = Math.arctan(d.u/d.v) / Math.PI * 180;
d.wdir = 270 - (Math.atan2(d.v, d.u) / Math.PI * 180);
}

// Humidity
Expand Down

0 comments on commit ac27b39

Please sign in to comment.