making windrose from my own data
Question: I am trying to make a wind rose from a series of windspeed and direction
values. I have an idea of how to write the raw program for doing this as shown
below:

    
    
    from windrose import WindroseAxes
    from matplotlib import pyplot as plt
    import matplotlib.cm as cm
    import numpy as np
    ws=[2.6,2.3,2.1,2.0,2.1,2.2,2.9,2.8,2.39,1.90,1.54,1.29,0.72,0.18,1.08]
    wd=[207,208,215,217,213,209,203,195,187,179,164,139,117,101,280]
    print "WD is ",wd
    print "WS is ",ws
    ax = WindroseAxes.from_ax()
    ax.bar(wd,ws, normed=True, opening=0.8, edgecolor='white')
    ax.set_legend()
    plt.show()
    

The only issue is is how can I have the program reading my data into the
arrays ws (windspeed) and wd (wind direction) in the above program.

The data is in an ascii file with two columns separated by a space. The first
column is wind speed and the second column is wind direction.

With wind speed in the first column and wind direction in the second column.
Do you know how to read this type of wind using python so that column one
occupies the ws array and column two occupies the wd array in the script
above?


Answer: You can use `np.loadtxt`:

    
    
    data = np.loadtxt('data.txt')
    ws = data[:, 0]
    wd = data[:, 1]
    

