How to calculate wind direction from U and V wind components in R

前端 未结 3 1368
一向
一向 2020-12-15 00:35

I have U and V wind component data and I would like to calculate wind direction from these values in R.

I would like to end up with wind direction data on a scale o

3条回答
  •  轮回少年
    2020-12-15 00:58

    In Python:

    Dir=np.mod(180+np.rad2deg(np.arctan2(U, V)),360)
    

    This leads to a Southerly wind (180 degrees) for a [0,1] vector, a Northerly wind (0 degrees) for a [0,-1] vector, a South Westerly wind (225 degrees) for a [1,1] vector:

    U
    Out[86]: 
    array([[ 0.  ],
           [ 0.  ],
           [ 1.  ],
           [-3.47]])
    
    V
    Out[87]: 
    array([[ 1.  ],
           [-1.  ],
           [ 1.  ],
           [-1.47]])
    
    np.mod(180+np.rad2deg(np.arctan2(U, V)),360)
    Out[89]: 
    array([[180.        ],
           [  0.        ],
           [225.        ],
           [ 67.04097233]])
    

提交回复
热议问题