C#实现方法:
(26条消息) 关于风向的u、v分量,及根据uv计算风向公式_GISlqj的专栏-CSDN博客_风的uv分量含义
torch实现方法(实现torch方法主要是为了训练 网络时使用,需要传入tensor类型数据):
#定义一个函数将UV分量转换成风速和风向 def transUV(u, v): #获取满足条件的下标 index_udayu0 = u > 0 index_vdayu0 = v > 0 index_uxiaoyu0 = u < 0 index_vxiaoyu0 = v < 0 index_udengyu0 = u == 0 index_vdengyu0 = v == 0 dir_temp = torch.zeros_like(u) #u > 0 and v > 0 index = index_udayu0 * index_vdayu0 dir_temp = torch.where(index == True,270 - torch.atan(v / u) * 180 / Math.pi,dir_temp) #u < 0 and v > 0 index = index_uxiaoyu0 * index_vdayu0 dir_temp = torch.where(index == True, 90 - torch.atan(v / u) * 180 / Math.pi, dir_temp)