%pylab inline import windng.io as wio import windng.plot.windplot as wplot import windng.weibull as weibull import windng.wind as wind with open('sample01.txt') as f: for i in range(10): print f.readline(), df = wio.read_wind('sample01.txt', freq='H', index_name=None) df.columns = ['s80a', 's80s', 's50a', 's50s', 'd80a', 'd50a'] df.head() df.tail() from IPython.core.display import HTML display(HTML(df.describe().to_html())) df['1-may-1999':'31-may-1999'][['s80a', 's50a']].plot(figsize=(14, 4)) plt.grid(True, which='both') monthly80 = wind.downsample(df['s80a'], freq='M') monthly50 = wind.downsample(df['s50a'], freq='M') monthly80 monthly50 monthly80.describe() monthly50.describe() wplot.plot_means(monthly80['mean'], style='-o', label='80 m') wplot.plot_means(monthly50['mean'], style='-o', label='50 m') plt.legend(loc='best') shear = wind.shear_analysis([df['s80a'], df['s50a']], [80, 50]) shear wplot.plot_shear(shear) dshear = wind.shear_analysis(series=(df['s80a'], df['s50a']), heights=(80, 50), dir=df['d80a']) dshear wplot.bar_rose(dshear['alpha'], ec='w') wplot.bar_rose(-dshear['alpha'], fc='r', ec='w') plt.title('Shear rose') wplot.plot_shear_by_sector(dshear, figsize=(12, 8)) df['s120a'] = wind.shear_extrapolation(df['s80a'], df['d80a'], 80, 120, dshear['alpha']) df['1-may-1999':'31-may-1999'][['s120a', 's80a', 's50a']].plot(figsize=(14, 4)) plt.grid(True, which='both') monthly120 = wind.downsample(df['s120a'], freq='M') monthly120 monthly120.describe() wplot.plot_means(monthly120['mean'], style='-o', label='120 m') wplot.plot_means(monthly80['mean'], style='-o', label='80 m') wplot.plot_means(monthly50['mean'], style='-o', label='50 m') plt.legend(loc='best')