<div dir="ltr"><div><div><div><div><div>Dear Mr Jack Ojaga<br><br></div>I really appreciate very much for your detail explaination. Now the problem is solved. <br><br></div>THANK YOU, THANK YOU very much.<br></div>May God bless you always.<br><br></div>Best regards,<br></div>Soares<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 22, 2015 at 9:58 AM, Jack Ogaja <span dir="ltr"><<a href="mailto:jack.ogaja@gmail.com" target="_blank">jack.ogaja@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Soares,<div><br></div><div>What I’ve written in the following paragraph is not what ncl-talk was meant for(I hope), but I hope it will be helpful to you. So, please keep that in mind.</div><div><br></div><div>Your wind speeds “windspd0(it)” are calculated at each time ( time=it ) according to the time loop in your code, which means the values of the “windspd0” is likely to be different from time to time and that is what is shown in your output file. However, unlike “windspd0” which is an array of numbers or an 'indexed variable’, your wind directions "dir0" - as shown in your code - happened to be just a number or ‘a single valued dynamic variable’ which is taking a new value you pass to it at each time (time=it) but forget about what its old value was. So, at the end of your time loop, “windspd0” will be an array of rank one with “ntimes” values and “spd0” will just be a number or a single value(the last value you assigned to it). That is exactly what is shown in your output file.</div><div><br></div><div>To change your wind direction variable from a single-valued dynamic variable to an array like the wind speed variable, you can change the following part of your code as shown (only add what is not in your code);</div><div><br></div><div>;———————</div><div><div> dir0 = new(ntimes,float) ; creation of a Wind-direction array</div><div><br></div><div>…</div><span class=""><div> do it = 0,ntimes-1<span style="white-space:pre-wrap">        </span> ;Loop for the time: it= starting time</div><div><br></div></span><div>…</div><span class=""><div> </div><div> ; Wind direction at 0 Meters</div><div> <span style="white-space:pre-wrap">                </span>r2d = 45.0/atan(1.0) <span style="white-space:pre-wrap">        </span>; conversion factor (radians to degrees)</div><div> <span style="white-space:pre-wrap">                </span>dir = atan2(u_plane,v_plane) * r2d + 180</div></span><div> <span style="white-space:pre-wrap">                </span>;dir0 = dir(x,y) ;<== a single-valued dynamic variable</div><div> <span style="white-space:pre-wrap">                </span>dir0(it) = dir(x,y) ;<== changed to a single-dimesional array</div><div>…</div><div>do it = 0,ntimes-1</div><div><br></div><div> print (sprintf ("%5.0f",it) +" " \</div><div> <span style="white-space:pre-wrap">        </span> +sprintf (" %4.1f", dir0(it)) +" " \ </div><div> +sprintf("%23.2f", windspd0(it)) +" " )</div><div><br></div><div><br></div><div>end do ; end of time loop</div></div><div>;———————-</div><div><br></div><div><br></div><div>Remember, as always recommended, you should use "print statements" to debug your code. For example, by adding the following statement to your original code(after the loop);</div><div><br></div><div>;——</div><div> “print(windspd0)”</div><div> “print(dir0)”</div><div>;——</div><div><br></div><div>you would easily see the differences between the two variables.</div><div><br></div><div>Jack.</div><div><br><div><blockquote type="cite"><div>On 21 Oct 2015, at 06:09, isakhar sakhar isakhar <<a href="mailto:isakhar.inside13@gmail.com" target="_blank">isakhar.inside13@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div><div><div>Dear Mr.Jack<br><br></div>I didn't catch it. Could you please explain more detail?<br><br><br></div>Best regards,<br></div>Soares<br></div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 20, 2015 at 10:20 AM, Jack Ogaja <span dir="ltr"><<a href="mailto:jack.ogaja@gmail.com" target="_blank">jack.ogaja@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Assuming that ‘everything’ else in your code is correct, the snippet(of your code) below simply explains your concern;<br>
<br>
****<br>
do it = 0,ntimes-1 ;Loop for the time: it= starting time<br>
time = it<br>
…<br>
; Calculate Wind Speed from Vectors<br>
spd = (u_plane*u_plane + v_plane*v_plane)^(0.5)<br>
windspd0(it)=spd(x,y) ;<=== instantaneous[compare to “dir0” below]<br>
<br>
; Wind direction at 0 Meters<br>
r2d = 45.0/atan(1.0) ; conversion factor (radians to degrees)<br>
dir = atan2(u_plane,v_plane) * r2d + 180<br>
dir0 = dir(x,y) ;<=== is always overwritten[compare to “windspd0(it)” above]<br>
****<br>
i.e. your directions will always be the last direction calculated in the loop.<br>
<br>
Jack.<br>
<div><div><br>
> On 20 Oct 2015, at 08:56, isakhar sakhar isakhar <<a href="mailto:isakhar.inside13@gmail.com" target="_blank">isakhar.inside13@gmail.com</a>> wrote:<br>
><br>
> Dear NCL Team<br>
><br>
> I use the script in attachment to find Wind Speed and Wind Direction in a location. I can get the wind speed but I get odd result for wind direction because all same. The output also in the attachment.<br>
><br>
> Regards,<br>
> Soares<br>
</div></div>> <output.txt><wrf_script.ncl>_______________________________________________<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><br>
<br>
</blockquote></div><br></div>
</div></div></div></blockquote></div><br></div></div></blockquote></div><br></div>