Skip to main content
added 1 character in body
Source Link
YevKad
  • 116
  • 2

I had a similar problem and used Yamartino method: https://en.wikipedia.org/wiki/Yamartino_method which is onone pass approximation for wind direction variation. in python it something like (the code is not optimised though):

from math import *
def yamartino(thetalist):
    s=0
    c=0
    n=0.0
    for theta in thetalist:
        s=s+sin(radians(theta))
        c=c+cos(radians(theta))
        n+=1
    s=s/n
    c=c/n
    eps=(1-(s**2+c**2))**0.5
    sigma=asin(eps)*(1+(2.0/3.0**0.5-1)*eps**3)
    return degrees(sigma)

I had a similar problem and used Yamartino method: https://en.wikipedia.org/wiki/Yamartino_method which is on pass approximation for wind direction variation. in python it something like (the code is not optimised though):

from math import *
def yamartino(thetalist):
    s=0
    c=0
    n=0.0
    for theta in thetalist:
        s=s+sin(radians(theta))
        c=c+cos(radians(theta))
        n+=1
    s=s/n
    c=c/n
    eps=(1-(s**2+c**2))**0.5
    sigma=asin(eps)*(1+(2.0/3.0**0.5-1)*eps**3)
    return degrees(sigma)

I had a similar problem and used Yamartino method: https://en.wikipedia.org/wiki/Yamartino_method which is one pass approximation for wind direction variation. in python it something like (the code is not optimised though):

from math import *
def yamartino(thetalist):
    s=0
    c=0
    n=0.0
    for theta in thetalist:
        s=s+sin(radians(theta))
        c=c+cos(radians(theta))
        n+=1
    s=s/n
    c=c/n
    eps=(1-(s**2+c**2))**0.5
    sigma=asin(eps)*(1+(2.0/3.0**0.5-1)*eps**3)
    return degrees(sigma)
Source Link
YevKad
  • 116
  • 2

I had a similar problem and used Yamartino method: https://en.wikipedia.org/wiki/Yamartino_method which is on pass approximation for wind direction variation. in python it something like (the code is not optimised though):

from math import *
def yamartino(thetalist):
    s=0
    c=0
    n=0.0
    for theta in thetalist:
        s=s+sin(radians(theta))
        c=c+cos(radians(theta))
        n+=1
    s=s/n
    c=c/n
    eps=(1-(s**2+c**2))**0.5
    sigma=asin(eps)*(1+(2.0/3.0**0.5-1)*eps**3)
    return degrees(sigma)