当前位置:网站首页>平均风向风速计算(单位矢量法)
平均风向风速计算(单位矢量法)
2022-06-27 02:08:00 【这被禁忌的游戏】

单位矢量法计算公式:

C# 代码
static void Main(string[] args)
{
int[] Met_Dir_Test = {
259, 259, 259, 259, 259, 259, 259, 259, 259, 259 };
int[] Met_Dir = {
297, 317, 356, 23, 21, 19, 26, 32, 28, 30 };
double[] Met_Speed = {
2.5, 1.8, 2.9, 4.4, 4.5, 4.6, 4.0, 3.7, 4.3, 4.3 };
for (int i = 0; i < 360; i++)
{
for (int j = 0; j < Met_Dir_Test.Length; j++)
{
Met_Dir_Test[j] = i;
}
int Dir_Avg = Met_Dir_Average(Met_Dir_Test, Met_Speed);
Console.WriteLine(i + " 平均风向:" + Dir_Avg);
}
Console.WriteLine("平均风向:" + Met_Dir_Average(Met_Dir, Met_Speed));
Console.Read();
}
static int Met_Dir_Average(int[] Dir_Buf,double[] Speed_Buf)
{
double Dir_Avg = 0;
double SinSum = 0;
double CosSum = 0;
for (int i = 0; i < Dir_Buf.Length; i++)
{
if (Dir_Buf[i] == 0 && Speed_Buf[i] == 0)
continue;
SinSum += Math.Sin(Dir_Buf[i] / 180.0f * Math.PI);//将角度转换为弧度角再代入计算
CosSum += Math.Cos(Dir_Buf[i] / 180.0f * Math.PI);//将角度转换为弧度角再代入计算
}
Dir_Avg = SinSum / CosSum;
Dir_Avg = Math.Atan(SinSum / CosSum) / Math.PI * 180.0;
Dir_Avg = Math.Round(Dir_Avg);
/* 方位角还原 数学中根据象限对角度进行划分。分别通过计算所得的东西方位平均分量u与南北方位平均分量v的正负数值判断真实的角度所处的象限在根据象限属性进行角度修正即可获得正式的角度。 经过计算与事例论证现给出各个方位计算结果的修正值: ①u > 0; v > 0:真实角度处于第一象限修正值为 + 0°; ②u > 0; v < 0:真实角度处于第二象限修正值为 + 180°; ③u < 0; v < 0:真实角度处于第三象限修正值为 + 180°; ④u < 0; v > 0:真实角度处于第四象限修正值为 + 360°。 简单分析 当角度处于一象限时无需修正,计算值即使真值;角度处于第二、三象限时根据正切函数特性,可通过将计算值向右平移一个正切函数周期计算获得,即向正方向修正180°;角度处于第四象限时,正切函数的定义域在(-3π / 2,2π)上,实际通过反正切求得值域(即为正切的定义域)为(-π / 2,0)上,,根据正切函数周期、对称特性可知此时应在计算值上向正向修正 + 360°可还原数据。*/
if (SinSum > 0 && CosSum > 0) Dir_Avg += 0;
else if (SinSum > 0 && CosSum < 0) Dir_Avg += 180;
else if(SinSum < 0 && CosSum < 0) Dir_Avg += 180;
else if(SinSum < 0 && CosSum > 0) Dir_Avg += 360;
return (int)Dir_Avg;
}
风向平均值采样单位矢量法计算,风速平均值直接用算术平均方法计算就好了
边栏推荐
- 我靠副业一个月挣了3W块:你看不起的行业,真的很挣钱!
- “所有专业都在劝退”,对大学生最友好的竟然是它?
- Press key to control LED status reversal
- memcached基础11
- Cookie, sessionstorage, localstorage differences
- paddlepaddle 20 指数移动平均(ExponentialMovingAverage,EMA)的实现与使用(支持静态图与动态图)
- Oracle/PLSQL: Ltrim Function
- Learn the most basic operation of discodiffusion
- Oracle/PLSQL: Upper Function
- Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
猜你喜欢
随机推荐
memcached基础11
Cookie, sessionstorage, localstorage differences
Oracle/PLSQL: From_Tz function
Oracle/PLSQL: Lpad Function
Learn the most basic operation of discodiffusion
我靠副业一个月挣了3W块:你看不起的行业,真的很挣钱!
Flink学习3:数据处理模式(流批处理)
Why pass SPIF_ Sendchange flag systemparametersinfo will hang?
Parameter estimation -- Chapter 7 study report of probability theory and mathematical statistics (point estimation)
Oracle/PLSQL: Cast Function
Oracle/PLSQL: Rpad Function
Memcached basics 15
学习DiscoDiffusion的最基础操作
CVPR2022 | PointDistiller:面向高效紧凑3D检测的结构化知识蒸馏
mmdetection ValueError: need at least one array to concatenate解决方案
二叉樹oj題目
Why divide the training set and the test set before normalization?
Flink学习2:应用场景
Oracle/PLSQL: Upper Function
“所有专业都在劝退”,对大学生最友好的竟然是它?









