# Is it possible to calculate the Xth percentile of a collection of wind vectors?

I have a collection of 30 weather model wind vectors (wind speed and direction) all valid at a specific point in space & time. It's fairly easy to break these apart and calculate a 75th percentile of the wind speeds; however, the wind directions pose a bit of a problem as I'm not sure if there is a mathematical approach that would provide a reasonable 75th percentile wind direction. I broke the vectors down into i and j unit vectors and took the 75th percentile of those independently and then reunited those back into a wind vector...that's about the best I could come up with. Does anyone have any better recommendations? Thanks!

• what do you mean by 75th %? Does it mean you take the average of the wind speeds and multiply with 0.75? – john Apr 24 '16 at 10:05

There are various issues, the largest of which is that a circular direction does not have a natural order. Another is whether you measure direction for example clockwise from North or anti-clockwise from East. In addition wind direction is often measured by where it is coming from rather than where it is going to. And you will have to choose degrees or radians

Assuming you have decided all these and have a list of directions translated into angles, here is a possible algorithm to consider:

• order the angles, smallest first
• repeat the first half of the ordered list, but adding the angle of a full circle ($360^\circ$ or $2\pi$ radians)
• find the angle difference between each angle and the angle further on in the list where the jump in the list corresponds to half the number of original wind directions
• find the smallest such angle distance: this will be between two angles and you could imagine the first of these corresponding to the $25\%$ direction and the second corresponding to the $75\%$ direction

As an example, suppose you decided to work in degrees clockwise from North of the direction from which the wind is coming and you had the $8$ angles $\{5^\circ, 200^\circ, 80^\circ, 250^\circ, 300^\circ, 180^\circ, 270^\circ, 210^\circ\}$. Then you list and differences might look like this:

Angle   half steps on    difference
5           210          205
80           250          170
180           270           90   <- smallest difference
200           300          100
210           365          155
250           440          190
270           540          270
300           560          260
365                             <- 360 +   5
440                             <- 360 +  80
540                             <- 360 + 180
560                             <- 360 + 200


So you could say the narrowest range with half the directions is from $180^\circ$ (South) to $270^\circ$ (West)

If you wanted then you could perhaps think that in this particular sense that West was then the $75\%$ point measuring clockwise (South would have been if measuring anti-clockwise), though you would have to explain what you had done if you wanted anybody else to understand

Unlike the univariate case, the set of point in $\mathbb{R^2}$ is not totally ordered, so there really is no unique sens of 'greater' or 'less than'.

Now, you could transform this to the univariate case by expressing each direction vector as the angle it makes with the local east vector. Then, you'd get the mapping:

$$(x,y)\mapsto \cos^{-1}(x)$$

Where $||(x,y)||_2=1$.

Now, the only issue is that "high" and "low" are somewhat arbitrary, since angles are circular, but you'd get a valid CDF via this approach.