mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
当前U为零,V为负值时,风向计算错误
原代码未正确判断上述情况。
This commit is contained in:
parent
0160b96542
commit
508eef029a
@ -338,18 +338,7 @@ public abstract class DataMath {
|
||||
if (windSpeed == 0) {
|
||||
windDir = 0;
|
||||
} else {
|
||||
windDir = Math.asin(U / windSpeed) * 180 / Math.PI;
|
||||
if (U < 0 && V < 0) {
|
||||
windDir = 180.0 - windDir;
|
||||
} else if (U > 0 && V < 0) {
|
||||
windDir = 180.0 - windDir;
|
||||
} else if (U < 0 && V > 0) {
|
||||
windDir = 360.0 + windDir;
|
||||
}
|
||||
windDir += 180;
|
||||
if (windDir >= 360) {
|
||||
windDir -= 360;
|
||||
}
|
||||
windDir = (180 + Math.atan2(V, U) * 180 / Math.PI) % 360;
|
||||
}
|
||||
|
||||
return new double[]{windDir, windSpeed};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user