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));
    }
}

 

相关文章:

  • 2021-10-17
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2021-08-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-10-29
  • 2021-05-17
相关资源
相似解决方案