In [1]:
from latex_generator.slides import *

In [2]:
s = slides(
  tex_filename= 'test_slides.tex',
  short_title = 'Uncertainty \& Wake',
  title = """Evaluation of the Wind Direction Uncertainty And Its Impact on Wake Modelling at the Horns Rev Offshore Wind Farm""",
  date = 'Windpower Monthly\'s Wind Farm Data \\\\ Management and Analysis forum \\\\ 23-25 September',
  author = "Pierre-Elouan R\\'{e}thor\\'{e}*, Mathieu Gaumond, Andreas Bechmann, Kurt Hansen, Alfredo Pena, S\\o{}ren Ott, Gunner Larsen",
  short_author = "P.-E. R\\'{e}thor\\'{e}",
  institute = "Aero-elastic Section, Wind Energy Department, DTU, Ris\\o{}"
)

In [3]:
s.f('This is a title', itemize(['item1', 'item2'], ['1-','2-']))

s.f('This is a title', itemize(['item1', 'item2']))
s.f('Tables', centered(table(zeros([5,3]), xlabel=['a','b','c'], ylabel=['l0','l1','l2','l3','l4'])))

In [4]:
s.compile()

In [ ]:
%debug


> /Users/pire/git/Python4WindEnergy/slide_generator/latex_generator/report.py(256)env_latex()
    255     """
--> 256     return '\\begin{' + env + '}' + '\n' + tostr(string) + '\n' + '\\end{' + env + '}' + '\n'
    257 

ipdb> string
[u'\\item<1-> None', u'\\item<2-> None']
ipdb> tostr(string)
ipdb> exit

In [2]:



---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-e073ca739269> in <module>()
      1 a = zeros([5,3])
      2 print a
----> 3 print table(a, xlabel=['a','b','c'], ylabel=['l0','l1','l2','l3','l4'])

TypeError: table() takes exactly 0 arguments (3 given)
[[ 0.  0.  0.]
 [ 0.  0.  0.]
 [ 0.  0.  0.]
 [ 0.  0.  0.]
 [ 0.  0.  0.]]

In [14]:


In [11]:
print table(a, xlabel=['a','b','c'], ylabel=['l0','l1','l2','l3','l4'])


\begin{tabular}{| c | c | c | c |}
\hline
 & a & b & c\hline \\
l0 & 0.0 & 0.0 & 0.0\hline \\
l1 & 0.0 & 0.0 & 0.0\hline \\
l2 & 0.0 & 0.0 & 0.0\hline \\
l3 & 0.0 & 0.0 & 0.0\hline \\
l4 & 0.0 & 0.0 & 0.0\hline \\

\hline
\end{tabular}


In [19]:
%debug


KeyboardInterrupt
> <ipython-input-14-d21e28431670>(13)__init__()
     12         for r in range(matrix.shape[0]):
---> 13             self.add(' & '.join(matrix[r,:].tolist()))
     14             self.add('\\hline \\\\')

ipdb> exit
> <ipython-input-14-d21e28431670>(13)__init__()
     12         for r in range(matrix.shape[0]):
---> 13             self.add(' & '.join(matrix[r,:].tolist()))
     14             self.add('\\hline \\\\')

ipdb> exit

Slide example


In [ ]:


In [5]:
%run wind_power_monthly.py

In [6]:
!open report.pdf

Some plots regarging the presentation


In [52]:
HR_Coordinates = array([[423974,  6151447], [424033,  6150889], [424092,  6150332], [424151,  6149774], [424210,  6149216], [424268,  6148658], [424327,  6148101], [424386,  6147543], [424534,  6151447], [424593,  6150889], [424652,  6150332], [424711,  6149774], [424770,  6149216], [424829,  6148658], [424888,  6148101], [424947,  6147543], [425094,  6151447], [425153,  6150889], [425212,  6150332], [425271,  6149774], [425330,  6149216], [425389,  6148658], [425448,  6148101], [425507,  6147543], [425654,  6151447], [425713,  6150889], [425772,  6150332], [425831,  6149774], [425890,  6149216], [425950,  6148659], [426009,  6148101], [426068,  6147543], [426214,  6151447], [426273,  6150889], [426332,  6150332], [426392,  6149774], [426451,  6149216], [426510,  6148659], [426569,  6148101], [426628,  6147543], [426774,  6151447], [426833,  6150889], [426892,  6150332], [426952,  6149774], [427011,  6149216], [427070,  6148659], [427129,  6148101], [427189,  6147543], [427334,  6151447], [427393,  6150889], [427453,  6150332], [427512,  6149774], [427571,  6149216], [427631,  6148659], [427690,  6148101], [427749,  6147543], [427894,  6151447], [427953,  6150889], [428013,  6150332], [428072,  6149774], [428132,  6149216], [428191,  6148659], [428250,  6148101], [428310,  6147543], [428454,  6151447], [428513,  6150889], [428573,  6150332], [428632,  6149774], [428692,  6149216], [428751,  6148659], [428811,  6148101], [428870,  6147543], [429014,  6151447], [429074,  6150889], [429133,  6150332], [429193,  6149774], [429252,  6149216], [429312,  6148659], [429371,  6148101], [429431,  6147543]])
M2_Coordinates = array([423412, 6153342])
hr_rel_c = HR_Coordinates - M2_Coordinates
dist_m2 = array([sqrt(hr_rel_c[c,0]**2.0 + hr_rel_c[c,1]**2.0) for c in range(hr_rel_c.shape[0])]).reshape([10,8])
plot(HR_Coordinates[:,0], HR_Coordinates[:,1],'.')
plot(M2_Coordinates[0], M2_Coordinates[1],'o');
text(M2_Coordinates[0]+100, M2_Coordinates[1]+100,'M2', fontsize=16);
savefig('Horns_rev_M2.pdf')



In [41]:
stdev = array(
        [[2.8,2.4,3.1,3.0,3.6,3.5,3.6,3.7,3.7,3.9],
		 [3.1,3.2,3.1,3.2,3.3,3.6,3.7,3.7,3.8,4.1],
		 [2.9,2.9,3.3,5.5,0.0,3.7,3.7,3.9,4.1,4.2],
		 [3.2,3.4,3.6,3.4,3.9,3.8,5.9,3.7,4.1,4.4],
		 [3.8,3.6,3.7,3.9,3.0,3.7,4.1,4.1,4.3,4.7],
		 [6.1,3.6,3.8,3.9,4.0,4.1,4.2,4.4,4.4,4.8],
		 [4.2,3.9,4.3,4.0,4.8,4.4,4.3,4.4,4.6,4.7],
		 [4.2,4.3,4.4,4.4,4.5,4.7,4.7,4.6,5.1,4.9]]).T

x, y, z = HR_Coordinates[:,0], HR_Coordinates[:,1], stdev.flatten()
xc = x[(z<5) & (z>1)]
yc = y[(z<5) & (z>1)]
zc = z[(z<5) & (z>1)]
distc = dist_m2.flatten()[(z<5) & (z>1)]

In [53]:
plot(dist_m2.flatten(), stdev.flatten(),'.', label='data')

### Function calculating the linear regression
def regress(dist, zo, text):
    di = zip(dist, ones([len(dist)]))
    w = linalg.lstsq(di, zo)[0]
    xi = linspace(0,10000)
    line = w[0]*xi+w[1]
    plot(xi, line, '-', label=text+'y = %4.2e x + %4.2f'%(w[0], w[1]))

regress(distc, zc, '')
#regress(dist_m2.flatten(), stdev.flatten(), 'Filtered')    

fs =16
xlabel('Distance from M2 [m]', fontsize=fs);
ylabel('std(M2-NPM) [$^\circ$]', fontsize=fs);
legend(loc=3, fontsize=fs);
savefig('std_increase.pdf')



In [ ]: