UV数据与风速风向数据转换
程序员文章站
2022-06-29 09:42:53
package com.qr.util; import java.text.DecimalFormat; /** * //TODO UV数据与风速风向数据转换 */ public class UVAndSD { /** * UV数据计算速度 */ public static double vecto... ......
package com.qr.util; import java.text.decimalformat; /** * //todo uv数据与风速风向数据转换 */ public class uvandsd { /** * uv数据计算速度 */ public static double vectortospeed(double ums, double vms) { double windabs = math.sqrt(math.pow(ums, 2) + math.pow(vms, 2)); return windabs; } /** * uv数据计算风向 */ public static double vectortodegrees(double ums, double vms) { decimalformat df = new decimalformat("#.000"); double windabs = math.sqrt(math.pow(ums, 2) + math.pow(vms, 2)); double winddirtrigto = math.atan2(ums / windabs, vms / windabs); double winddirtrigtodegrees = winddirtrigto * 180 / math.pi; double winddirtrigfromdegrees = winddirtrigtodegrees + 180; return double.parsedouble(df.format(winddirtrigfromdegrees)); } }