<div dir="ltr"><div class="gmail_default" style="font-size:small">I think you simply need to set these two resources:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">
<p class="gmail-p1"><span class="gmail-s1"> res@</span><span class="gmail-s2">trXMaxF</span><span class="gmail-s1"> = nfiles-0.5</span></p>
<p class="gmail-p1"><span class="gmail-s1"> res@</span><span class="gmail-s2">trXMinF</span><span class="gmail-s1"> = -0.5</span></p><p class="gmail-p1"><span class="gmail-s1">Those two lines you see are the "xc" and "yc" being plotted, and they don't match the axis because NCL chose a different X min/max for the X axis. </span></p><p class="gmail-p1">By setting those two resources, you are forcing the X axis to have the same min/max as the "xc" array.</p><p class="gmail-p1">--Mary</p><p class="gmail-p1"><br></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 1, 2016 at 4:00 AM, <a href="mailto:dyjbean@gmail.com">dyjbean@gmail.com</a> <span dir="ltr"><<a href="mailto:dyjbean@gmail.com" target="_blank">dyjbean@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>
<div><span></span><br></div>
<div>hi,</div><div> when i plotted wind barb, i consulted the <a href="http://www.ncl.ucar.edu/Applications/Scripts/barb_6.ncl" style="font-size:10.5pt;line-height:1.5;background-color:window" target="_blank">barb_6.ncl</a> , the following is the figure:</div><div> <img src="cid:_Foxmail.1@612859e5-7626-6406-3e86-9a7439065186" border="0" style="font-size:10.5pt;line-height:1.5;background-color:window"></div><div>there are 48 times every day including missing value, i extract some times from on day for testing,but i cannot get rid of the two vertical lines,</div><div>according to the barb_6.ncl example, there is no vertical line.</div><div><br></div><div>the following is my script:</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;</div><div> <span style="background-color:rgba(0,0,0,0);font-size:10.5pt;line-height:1.5">load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl" </span></div><span style="color:rgb(0,0,0);background-color:rgba(0,0,0,0)">load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl" <br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/shea_util.ncl"<br><br>begin<br>ymin = 150. ; min <wbr>height to be plotted<br> ymax = 3030. ; <wbr>max height to be plotted<br> ncol = 3 ; <wbr>number of columns of data (<wbr>Each ascii file has the same <wbr>number of columns)<br> wbcrit = 100. ; <wbr>minimum distance in meters <wbr>between wind barbs <br><br> fils = systemfunc("ls test*.txt")<br> nfiles = dimsizes(fils)<br> print(nfiles)<br> <br> wks = gsn_open_wks("png","<wbr>barb_test_jsy") ; send <wbr>graphics to PNG file<br> gsn_define_colormap(wks,"<wbr>WhBlGrYeRe")<br> do gg = 0,nfiles-1<br> t = asciiread(fils(gg) ,(<wbr>/-1/), "float")<br> nlvl = dimsizes(t)/ncol <wbr> ; figure out number <wbr>of levels in the ascii file<br> delete(t)<br> TestData = asciiread(<wbr>fils(gg) ,(/nlvl,ncol/), "<wbr>float")<br> z = TestData (:,0) ; <wbr>1200<br> wspd = TestData (:,2)<br> wdir = TestData (:,1)<br> wspd@_FillValue = -999.0<br> wdir@_FillValue = -999.0<br> delete(TestData)<br><br> ;printMinMax(wspd, 0)<br> ;printMinMax(wdir, 0)<br><br> rad = 4.0*atan(1.0)/180.<br> u = -wspd*sin(rad*wdir)<br> v = -wspd*cos(rad*wdir)<br> u@_FillValue = -999.0<br> v@_FillValue = -999.0<br> printMinMax(u, 0)<br> printMinMax(v, 0)<br> <br> if (gg.eq.0) then<br> res = True<br> res@gsnDraw = False<br> res@gsnFrame = False<br> res@vpWidthF = 0.7<br> res@vpHeightF = 0.5<br> res@vpXF = 0.15<br> res@vpYF = 0.9<br> res@trYMinF = ymin<br> res@trYMaxF = ymax<br> res@tmXBMode = "<wbr>Explicit"<br> res@tmXBValues = <wbr>ispan(0,nfiles-1,1)<br> ; res@tmXBValues = <wbr>ispan(0,47,1);ispan(0,nfiles-<wbr>1,1)<br> ; res@tmXBLabels = (/"<wbr>00Z","0:30Z","01Z","01:30Z","<wbr>02Z","02:30Z","03Z","03:30Z","<wbr>04Z","04:30Z","05Z","05:30Z","<wbr>06Z",\<br> ; "06:<wbr>30Z","07Z","07:30Z","08Z","08:<wbr>30Z","09Z","09:30Z","10Z","10:<wbr>30Z","11Z","11:30Z","12Z","12:<wbr>30Z","13Z",\<br> ; "13:<wbr>30Z","14Z","14:30Z","15Z","15:<wbr>30Z","16Z","16:30Z","17Z","17:<wbr>30Z","18Z","18:30Z","19Z","19:<wbr>30Z","20Z",\<br> ; "20:<wbr>30Z","21Z","21:30Z","22Z","22:<wbr>30Z","23Z","23:30Z"/)<br> res@tmXBLabels = (/"<wbr>00Z","0:30Z","01Z","01:30Z","<wbr>02Z","02:30Z","03Z","03:30Z", <wbr>\<br> "<wbr>04Z","04:30Z","05Z","05:30Z","<wbr>06Z", "06:30Z","07Z","07:30Z"/<wbr>)<br> res@<wbr>tmXBLabelFontHeightF = 0.008<br><br> res@tiYAxisString = "<wbr>height (m)"<br> res@tiXAxisString = "<wbr>time"<br> res@tiMainString = "<wbr>Wind Profile"<br> xc = (/-0.5,nfiles-0.<wbr>5,nfiles-0.5,-0.5,-0.5/)<br> yc = (/ymin,ymin,ymax,<wbr>ymax,ymin/)<br> <br> plot = gsn_csm_xy(wks,<wbr>xc,yc,res) <wbr> ; draw blank xy plot by <wbr>outlining min/max of X/Y axes<br> contours = ispan(1,14,<wbr>1)*1. <wbr> ; set contours used to <wbr>define barb color <br> colors = (/10,20,30,<wbr>40,45,50,55,60,65,70,75,80,85,<wbr>90,95/) ; set colors<br> end if<br> <br> wmsetp ("wdf", 1) <wbr> ; meteorological dir<br> wmsetp("wbs",0.025)<br> wmsetp ("blw",2.0) ; <wbr>increase line thickness of <wbr>wind barbs<br> ;drawNDCGrid(wks)<br> do hh = 0,dimsizes(z)-1<br> print(u(hh)+" "+v(hh))<br> if(.not.ismissing(<wbr>wspd(hh))) then<br> wmsetp("col", <wbr>GetFillColorIndex(contours,<wbr>colors,wspd(hh)))<br> iFlag = True <br> else<br> continue<br> end if<br><br><br> if (z(hh).lt.ymax) <wbr>then<br> if (hh.eq.0) then <wbr> <wbr> ; always draw the first <wbr>wind barb <br> wmbarb(wks, gg*<wbr>1., z(hh), u(hh), v(hh)) <br> iFlag = True <wbr> <wbr> ; iFlag = True denotes <wbr>that a barb has been drawn<br> else<br> if (z(hh)-zsave.<wbr>ge.wbcrit) then <wbr> ; if the current height is <wbr>beyond wbcrit from<br> if ((u(hh).ne.<wbr>wspd@_FillValue).and.(v(hh).<wbr>ne.wspd@_FillValue)) then<br> wmbarb(wks, <wbr>gg*1., z(hh), u(hh), v(hh)) <wbr> ; previous barb height, <wbr>draw barb<br> iFlag = True<br> else<br> iFlag = False<br> end if<br><br> else<br> if (.not.<wbr>iFlag) then <wbr> ; if the previous barb <wbr>has not been drawn,<br> if (z(hh)-<wbr>zsave.ge.wbcrit) then <wbr> ; and if the last drawn <wbr>barb was more than wbcrit <wbr>away,<br> if ((<wbr>u(hh).ne.wspd@_FillValue).and.<wbr>(v(hh).ne.wspd@_FillValue)) <wbr>then<br> <wbr>wmbarb(wks, gg*1., z(hh), u(<wbr>hh), v(hh)) ; draw a barb<br> <wbr>iFlag = True<br> else<br> <wbr>iFlag = False<br> end if<br> else<br> iFlag =<wbr> False <wbr> ; set iFlag to False, <wbr>denoting the barb wasn't drawn<br> end if<br> else <br> iFlag = <wbr>False<br> end if<br> end if<br> end if<br> else <br> iFlag = False<br> end if<br> if (iFlag) then<br> zsave = z(hh) <wbr> <wbr> ; save the height of the <wbr>drawn wind barb<br> end if<br> end do<br> delete([/z,wspd,wdir,u,v/<wbr>])<br> end do<br><br>;-----------------------------<wbr>------------------------------<wbr>---------------<br>; Draw Labelbar<br>;-----------------------------<wbr>------------------------------<wbr>--------------- <br> lbres =<wbr> True<br> lbres@lbPerimOn =<wbr> False ; no <wbr>label bar box<br> lbres@lbOrientation =<wbr> "Horizontal" ; <wbr>orientation<br> lbres@vpWidthF =<wbr> 0.5 ; size<br> lbres@vpHeightF =<wbr> 0.075<br> lbres@lbLabelFontHeightF =<wbr> 0.015 ; label <wbr>font height<br> lbres@lbLabelAlignment =<wbr> "InteriorEdges" ; where <wbr>to label<br> lbres@lbMonoFillPattern =<wbr> True ; fill <wbr>sold<br> lbres@lbFillColors =<wbr> colors<br> gsn_labelbar_ndc (wks,<wbr>dimsizes(contours)+1,sprintf("<wbr>%3.0f",contours),0.25,0.30,<wbr>lbres)<br> <br> draw(plot) <wbr> ; draw the plot<br> frame(wks) <wbr> ; advance the frame<br><br><br>end<br></span><div> </div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;</div><div><br></div><div>i don't know how to get rid of this two lines on figure. i changed number in <span style="font-size:10.5pt;line-height:1.5;background-color:window"> xc = (/-0.5,nfiles-0.5,<wbr>nfiles-0.5,-0.5,-0.5/) , but it cannot take effect.</span></div><div><br></div><div>the attachment is my test data intercepted from a daily file for this checkout.</div><div><br></div><div>any help will be appreciated!</div><div><span style="font-size:10.5pt;line-height:1.5;background-color:window"><br></span></div><div><span style="font-size:10.5pt;line-height:1.5;background-color:window">thanks</span></div><span class="HOEnZb"><font color="#888888"><div><br></div>
<div><span><div style="MARGIN:10px;FONT-FAMILY:verdana;FONT-SIZE:10pt"><div><a href="mailto:dyjbean@gmail.com" target="_blank">dyjbean@gmail.com</a></div></div></span></div>
</font></span></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>