<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"><style>body { line-height: 1.5; }body { font-size: 10.5pt; font-family: ????; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<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;">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>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div> <span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">load "$NCARG_ROOT/lib/ncarg/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/nclscripts/csm/gsn_csm.ncl" <br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br><br>begin<br>ymin = 150. ; min height to be plotted<br> ymax = 3030. ; max height to be plotted<br> ncol = 3 ; number of columns of data (Each ascii file has the same number of columns)<br> wbcrit = 100. ; minimum distance in meters between wind barbs <br><br> fils = systemfunc("ls test*.txt")<br> nfiles = dimsizes(fils)<br> print(nfiles)<br> <br> wks = gsn_open_wks("png","barb_test_jsy") ; send graphics to PNG file<br> gsn_define_colormap(wks,"WhBlGrYeRe")<br> do gg = 0,nfiles-1<br> t = asciiread(fils(gg) ,(/-1/), "float")<br> nlvl = dimsizes(t)/ncol ; figure out number of levels in the ascii file<br> delete(t)<br> TestData = asciiread(fils(gg) ,(/nlvl,ncol/), "float")<br> z = TestData (:,0) ; 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 = "Explicit"<br> res@tmXBValues = ispan(0,nfiles-1,1)<br> ; res@tmXBValues = ispan(0,47,1);ispan(0,nfiles-1,1)<br> ; res@tmXBLabels = (/"00Z","0:30Z","01Z","01:30Z","02Z","02:30Z","03Z","03:30Z","04Z","04:30Z","05Z","05:30Z","06Z",\<br> ; "06:30Z","07Z","07:30Z","08Z","08:30Z","09Z","09:30Z","10Z","10:30Z","11Z","11:30Z","12Z","12:30Z","13Z",\<br> ; "13:30Z","14Z","14:30Z","15Z","15:30Z","16Z","16:30Z","17Z","17:30Z","18Z","18:30Z","19Z","19:30Z","20Z",\<br> ; "20:30Z","21Z","21:30Z","22Z","22:30Z","23Z","23:30Z"/)<br> res@tmXBLabels = (/"00Z","0:30Z","01Z","01:30Z","02Z","02:30Z","03Z","03:30Z", \<br> "04Z","04:30Z","05Z","05:30Z","06Z", "06:30Z","07Z","07:30Z"/)<br> res@tmXBLabelFontHeightF = 0.008<br><br> res@tiYAxisString = "height (m)"<br> res@tiXAxisString = "time"<br> res@tiMainString = "Wind Profile"<br> xc = (/-0.5,nfiles-0.5,nfiles-0.5,-0.5,-0.5/)<br> yc = (/ymin,ymin,ymax,ymax,ymin/)<br> <br> plot = gsn_csm_xy(wks,xc,yc,res) ; draw blank xy plot by outlining min/max of X/Y axes<br> contours = ispan(1,14,1)*1. ; set contours used to define barb color <br> colors = (/10,20,30,40,45,50,55,60,65,70,75,80,85,90,95/) ; set colors<br> end if<br> <br> wmsetp ("wdf", 1) ; meteorological dir<br> wmsetp("wbs",0.025)<br> wmsetp ("blw",2.0) ; increase line thickness of wind barbs<br> ;drawNDCGrid(wks)<br> do hh = 0,dimsizes(z)-1<br> print(u(hh)+" "+v(hh))<br> if(.not.ismissing(wspd(hh))) then<br> wmsetp("col", GetFillColorIndex(contours,colors,wspd(hh)))<br> iFlag = True <br> else<br> continue<br> end if<br><br><br> if (z(hh).lt.ymax) then<br> if (hh.eq.0) then ; always draw the first wind barb <br> wmbarb(wks, gg*1., z(hh), u(hh), v(hh)) <br> iFlag = True ; iFlag = True denotes that a barb has been drawn<br> else<br> if (z(hh)-zsave.ge.wbcrit) then ; if the current height is beyond wbcrit from<br> if ((u(hh).ne.wspd@_FillValue).and.(v(hh).ne.wspd@_FillValue)) then<br> wmbarb(wks, gg*1., z(hh), u(hh), v(hh)) ; previous barb height, draw barb<br> iFlag = True<br> else<br> iFlag = False<br> end if<br><br> else<br> if (.not.iFlag) then ; if the previous barb has not been drawn,<br> if (z(hh)-zsave.ge.wbcrit) then ; and if the last drawn barb was more than wbcrit away,<br> if ((u(hh).ne.wspd@_FillValue).and.(v(hh).ne.wspd@_FillValue)) then<br> wmbarb(wks, gg*1., z(hh), u(hh), v(hh)) ; draw a barb<br> iFlag = True<br> else<br> iFlag = False<br> end if<br> else<br> iFlag = False ; set iFlag to False, denoting the barb wasn't drawn<br> end if<br> else <br> iFlag = 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) ; save the height of the drawn wind barb<br> end if<br> end do<br> delete([/z,wspd,wdir,u,v/])<br> end do<br><br>;--------------------------------------------------------------------------<br>; Draw Labelbar<br>;-------------------------------------------------------------------------- <br> lbres = True<br> lbres@lbPerimOn = False ; no label bar box<br> lbres@lbOrientation = "Horizontal" ; orientation<br> lbres@vpWidthF = 0.5 ; size<br> lbres@vpHeightF = 0.075<br> lbres@lbLabelFontHeightF = 0.015 ; label font height<br> lbres@lbLabelAlignment = "InteriorEdges" ; where to label<br> lbres@lbMonoFillPattern = True ; fill sold<br> lbres@lbFillColors = colors<br> gsn_labelbar_ndc (wks,dimsizes(contours)+1,sprintf("%3.0f",contours),0.25,0.30,lbres)<br> <br> draw(plot) ; draw the plot<br> frame(wks) ; advance the frame<br><br><br>end<br></span><div> </div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</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,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><div><br></div>
<div><span><div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt"><div>dyjbean@gmail.com</div></div></span></div>
</body></html>