<div dir="ltr"><div>There are obvious errors in the code...e.g.</div><div>1) I do not think that you should use function sizeof, i guess what you need is: N=dimsizes(in), please read the documents for details.<br></div><div>2) a and b were never predefined, so a(0) = 0 and b(0) = 0, would NOT work. You need to define both of them using something like: a = new(,,,)</div><div><br></div><div>Cheers,</div><div>Rashed<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 27, 2019 at 10:54 AM Md. Jalal Uddin via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I made a function in NCL that showed an error like <span style="background-color:rgb(243,243,243)"><b>fatal:Undefined identifier: (a) is undefined, can't continue. The error line highlighted in green color. Any suggestions would be appreciated.</b></span></div><div><span style="background-color:rgb(243,243,243)"><b><br></b></span></div><div><b style="background-color:rgb(255,255,255)">Code:</b></div><div><span style="background-color:rgb(243,243,243)"><b><br></b></span></div><div>undef ("fftwavenumber") <br>function fftwavenumber (in,k1,k2) <br><br>; K1, k2 are high and low-frequency wave numbers. <br>; You can determine bandpass, lowpass, highpass filtering, <br>; and in is the input data time series according to your needs.<br><br>local in,p,a,b,f,k1,k2<br><br>begin <br> N=sizeof(in)<br><br> if mod(N,2).eq.0 then<br> p=N/2 ; N even<br> else<br> p=(N-1)/2 ; N odd<br> end if<br><br>pi=3.1416<br><br>do k=0,p-1<br> <font color="#00ff00"> a(k)=0<br> b(k)=0</font><br> <br> do t=0,N-1<br> a(k)=a(k)+(2/N)*( in(t)*cos(2*pi*k*t/N) )<br> b(k)=b(k)+(2/N)*( in(t)*sin(2*pi*k*t/N) )<br> end do<br>end do<br><br>do t=0,N-1<br> do k=0,p-1<br> f(k,t)=a(k)*cos(2*pi*k*t/N)+b(k)*sin(2*pi*k*t/N)<br> end do<br> return (sum(f(k1:k2,t)))<br>end do<br><br>end <span style="background-color:rgb(243,243,243)"><b><br></b></span></div><div><b><br></b></div><div><b><br clear="all"></b><div>Jalal</div>-- <br><div dir="ltr" class="gmail-m_6330338382275390821gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr"><span style="letter-spacing:0.2px">B.Sc. in Disaster Management (Hons.) </span><br></div><div dir="ltr"><span style="letter-spacing:0.2px">Patuakhali Science and Technology University, Bangladesh.</span></div><div dir="ltr">Cell: +8613260859092, <span style="letter-spacing:0.2px">+8801792052662</span></div><div dir="ltr"><font size="2">Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-jalal-uddin-80a026b0</a> </font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>