<div dir="ltr"><div>To compute average wind direction</div><div>[1] compute average zonal [u] and meridional [v] components</div><div>[2] use the u and v component averages as input to <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml"><b>wind_direction</b></a> to commute the average direction(s)<br></div><div>---<br></div><div>NCL also has a function <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/wind_stats.shtml"><b>wind_stats</b></a></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 11, 2019 at 3:24 AM Kunal Dayal 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"><span style="background-color:rgb(255,255,255)"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">Hi,</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">I working on mapping wind resources from WRFOUT files.</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">I can easily plot contour maps of average wind speed for a month but I am unable to represent average wind direction in the form of wind barbs.</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">The code I am using for the average wind speed contour maps is as follows:</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">"</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">begin</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">a = addfile("/scale_wlg_persistent/filesets/project/uoa02450/wrf-topo2sstpblmix/wrfout_d03_2017-06-28_00:00:<a href="http://00.nc" target="_blank">00.nc</a>","r")</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">type = "pdf"</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">wks = gsn_open_wks(type,"Average Wind Speed - Jul 2017")</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">opts = True</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">opts@MainTitle = "WIND SPEED"</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">pltres = True</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">mpres = True</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">times = wrf_user_getvar(a,"times",-1)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">ntimes = dimsizes(times)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">u = wrf_user_getvar(a,"ua",-1)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">v = wrf_user_getvar(a,"va",-1)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">spd = (u*u + v*v)^(0.5)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">spd@description = "Wind Speed"</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">spd@units = "m s-1"</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">spd_avg = dim_avg_n(spd(0:30,:,:,:),0)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">spd_avg@description = "Average Wind Speed"</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">spd_avg@units = "m s-1"</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">res = True</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">opts = res</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">opts@cnFillOn = True</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">opts@cnLinesOn = True</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">opts@ContourParameters = (/ 0., 12., 0.5/)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">opts@gsnSpreadColorEnd = -3</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">contour_spd_avg = wrf_contour(a,wks,spd_avg(0,:,:),opts)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">delete(opts)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">plot = wrf_map_overlays(a,wks,(/contour_spd_avg/),pltres,mpres)</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">end</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">"</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">I wish to add monthly average wind direction to the same maps in the form of wind barbs.</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">Appreciate your assistance and advice.</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">Regards</span><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(51,51,51);font-family:"Lucida Grande","Trebuchet MS",Verdana,Helvetica,Arial,sans-serif;font-size:13px">Kunal</span>  </span><br></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>