Simple equations for conversion of vector wind components, speed and direction.

### Trig Conventions

In this document it is assumed that all trig functions use or return angles in radians. However, angles are converted to degrees to simplify the discussion.

Radians are converted to degrees by multiplying by DperR (180 / π = 57.29578), and degrees are converted to radians by multiplying by RperD (π / 180 = 0.01745329).

### Two Argument Arctangent Function

This discussion assumes that the two-argument arctangent function, `atan2(y,x),` returns the arctangent of `y/x` in the range -π to π radians, -180 to 180 degrees. C, C++, Python, Fortran, Java, IDL, MATLAB and R all follow this convention.

Warning: Spreadsheets, including Microsoft Excel, LibreOffice Calc and Google Docs switch the arguments, so that `atan2(x,y)` is the arctangent of `y/x`.

To check your software, compute `atan2(1,-1)`. If it equals 2.36 radians (135 degrees) then your software uses the programming language convention and you can use these formulas unchanged. If it equals -0.79 radians (-45 degrees) then your software follows the spreadsheet convention and you must switch the arguments of atan2 in the following equations.

### Geographic wind coordinate system: U_{geo}, V_{geo}

A positive U_{geo} component represents wind blowing **to** the East (confusingly known as a "westerly"). +V_{geo} is wind to the North (a "southerly" ). This is right handed with respect to an upward +W_{geo}.

### Geographic wind direction: Dir_{geo}

Dir_{geo} is the direction with respect to true north, (0=north,90=east,180=south,270=west) that the wind is coming **from**.

Dir_{geo}= atan2(-U_{geo},-V_{geo}) * DperR = 270 - (atan2(V_{geo},U_{geo}) * DperR)

Spd is the horizontal wind speed:

Spd = sqrt(U_{geo}^{2}+ V_{geo}^{2})

To convert from Dir_{geo} and Spd to U_{geo} and V_{geo}:

U_{geo}= -Spd * sin(Dir_{geo}* RperD) V_{geo}= -Spd * cos(Dir_{geo}* RperD)

### Instrument Wind Coordinates: U_{inst}, V_{inst}

Sonic anemometers measure wind vector components which are relative to the orientation of the sonic array. Therefore, the orientation of the array must be determined, usually with a theodolite or compass, before the wind vectors can be rotated into geographic coordinates. The following discussion assumes that the sonic anemomenter is level, so that W_{inst}= W_{geo}.

### ATI Sonic

+U_{inst} represents wind into the array, parallel to the support boom (usually toward the tower), i.e. wind from the un-obstructed direction. If you're looking into the array, along the boom, toward the tower, then +V_{inst} is to your left. These are right handed with an upward +W_{inst}.

### Campbell CSAT3 Sonic

CSAT3 coordinates are like ATIs. +U_{inst} represents wind into the array from the un-obstructed direction, parallel to the support boom. U,V and W are right handed.

### GILL R2 Sonic

The R2 V_{inst} direction is 120 deg counter-clockwise from N arrow on top of the array (or the front support arm). V_{inst} is 90 degrees counter-clockwise from the pointing direction of the upper, front transducer arm. U_{inst} and V_{inst} are left handed with an upward W, so software must flip the sign of one of them to get a right handed system. If one flips V_{insti}, then these coordinates are 30 deg c-c-wise from ATI coords (if N arrow is aligned parallel to ATI boom), but 180 deg from Gill R3 coords.

### Gill R3

The R3 U_{inst} direction is antiparallel to the unflipped U_{inst} on the R2, and so UVW are right handed. The +V_{inst} direction is 120 deg c-c-wise from the N arrow on top of the array. The R3 V_{inst} direction is 90 degrees c-c-wise from the pointing direction of the upper, front transducer.

### Gill WindMaster/WindObserver

The +U axis is aligned with the N indicator. The +V direction is 90 deg c-c-wise from the N indicator.

### METEK USA-1

The +U axis is aligned with the N arrow. The +V direction is 90 deg c-wise (yes, clockwise) from the N indicator.

### Converting between Instrument and Geographic Coordinates

Determine the angle with respect to true north, (0=N, 90=E) of the +V_{inst} direction. Call this angle `V _{az}`. Looking from above, the instrument coordinate system is therefore rotated

`V`degrees clockwise from geographic coordinates.

_{az}Dir_{inst}= atan2(-U_{inst},-V_{inst}) * DperR Dir_{geo}= Dir_{inst}+ V_{az}

For ATI and Campbell CSAT3 sonics, `V _{az}` is the direction relative to true north, straight into the array from the un-obstructed direction, minus 90 degrees.

For Gill R2 sonics, if the sign of V is flipped, then `V _{az}` is the angle of the N arrow + 60. If the sign of U is flipped, then

`V`is the N arrow direction + 240.

_{az}For Gill R3s, `V _{az}` is the N arrow direction + 240 degrees.

For Gill Windmasters, Vaz is the N arrow or dot direction + 270 degrees.

For Gill WindObservers (2D), the ISFS mount places the north dot facing the mast, thus the angle entered into the calibration file as a bias for the Dir variable is the direction relative to true north from the sensor to the mast.

### Horizontal Wind Rotation from Instrument to Geographic coordinates

U_{geo}= U_{inst}* cos(V_{az}*RperD) + V_{inst}* sin(V_{az}*RperD) Vgeo = -U_{inst}* sin(V_{az}*RperD) + V_{inst}* cos(V_{az}*RperD)

### Horizontal Wind Rotation from Geographic to Instrument coordinates

U_{inst}= U_{geo}* cos(V_{az}*RperD) - V_{geo}* sin(V_{az}*RperD) V_{inst}= U_{geo}* sin(V_{az}*RperD) + V_{geo}* cos(V_{az}*RperD)

### Converting Winds to Streamwise Coordinates

The U axis (U_{stream}) of streamwise coordinates is defined to be the mean wind direction. To rotate wind vectors to streamwise coordinates, first determine the the average wind vector,`U _{av}, V_{av}`, in the same coordinate system as the data to be rotated, which could be instrument or geographic coordinates. The rotation angle is the angle of this wind vector from the U axis, measured positive counter-clockwise.

D = atan2(V_{av},U_{av}) * DperR U_{stream}= U * cos(D*RperD) + V * sin(D*RperD) V_{stream}= -U * sin(D*RperD) + V * cos(D*RperD)

As expected, if `U=U _{av}` and

`V=V`then

_{av}`U`=

_{stream}`Spd`, and

`V`.

_{stream}= 0