<div dir="ltr"><div class="gmail_default" style="font-size:small">Hello,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm not sure I understand. You said you didn't have any data from 355 to 0, so I believe that's exactly what the plot is showing you.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">When you plot data over a global map, we sometimes see this kind of thing because the longitude point doesn't go all the way from -180 to 180, or from 0 to 360. In that case, we set a special resource:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> res@gsnAddCyclic = True</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">which simply creates a new data array that has more more element in the longitude direction (nlat x (nlon+1)) and we copy the first data point at the first longitude point to the end of this array, so you are effectively closing the gap.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">gsnAddCyclic is only for map plots, but you could do something similar for your contour plot. Here's what the "add cyclic point" code looks like:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> dims = dimsizes(pr)</font></div><div class="gmail_default"><font face="monospace, monospace"> ny = dims(0)</font></div><div class="gmail_default"><font face="monospace, monospace"> mx = dims(1)</font></div><div class="gmail_default"><font face="monospace, monospace"> mx1 = mx+1</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> pr_cyclic = new((/ny, mx1/),typeof(pr))</font></div><div class="gmail_default"><font face="monospace, monospace"> pr_cyclic(:,0:mx-1) = pr ; pass everything </font></div><div class="gmail_default"><font face="monospace, monospace"> pr_cyclic(:,mx) = (/ pr(:,0) /) ; value only</font></div><div class="gmail_default"><br></div><div class="gmail_default">You will need to do the same thing for x and y, so I suggest making a function, like "make _cyclic" and calling it for pr, x, and y.</div><div class="gmail_default"><br></div><div class="gmail_default">By the way, if you have NCL V6.1.0 or later, You don't need to use NhlNewColor. You can now use named colors directly. So, instead of this:</div><div class="gmail_default"><br></div><div class="gmail_default"><div style="color:rgb(0,0,0);font-family:arial"> cnres@cnMissingValFillColor = NhlNewColor(wks,.7,.7,.7)</div><div><br></div><div>you can use this:</div><div><br></div><div><div style="color:rgb(0,0,0)"><font face="monospace, monospace"> cnres@cnMissingValFillColor = "gray"</font></div></div></div><div class="gmail_default"><br></div><div class="gmail_default">You can see all the named colors at:</div><div class="gmail_default"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Graphics/named_colors.shtml">http://www.ncl.ucar.edu/Document/Graphics/named_colors.shtml</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 24, 2017 at 2:46 AM, wen <span dir="ltr"><<a href="mailto:wenguanhuan@163.com" target="_blank">wenguanhuan@163.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="line-height:1.7;color:#000000;font-size:10px;font-family:Arial"><br><br><br><div>hi all,</div><div> I am ploting r-theta data. Theta is from 0 to 355 at an interval of 5. However, the there is blank at the angular of 355-0. Do anybody know why. My script is attached bellow. </div><div><div>;*****************************<wbr>******************</div><div>; radar_1.ncl</div><div>;</div><div>; Concepts illustrated:</div><div>; - Plotting radar (r,theta) data</div><div>; - Adding shading or color fill to areas on a contour plot with missing data</div><div>; - Drawing raster contours</div><div>; - Drawing cell-filled contours</div><div>; - Using triangular meshes to create contours</div><div>;*****************************<wbr>******************</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"</div><div><br></div><div>begin</div><div><span class="m_-974354147950016633Apple-tab-span" style="white-space:pre-wrap">        </span></div><div><span class="m_-974354147950016633Apple-tab-span" style="white-space:pre-wrap">        </span>pi = 4.0*atan(1.)</div><div> deg2rad = pi/180.</div><div> rad2deg = 45./atan(1.)</div><div><br></div><div> </div><div> a = 6371.</div><div> </div><div> r = ispan(0,500,10) </div><div> theta = ispan(0,355,5)</div><div><br></div><div> y = conform_dims((/dimsizes(r),<wbr>dimsizes(theta)/),r,0)*cos(<wbr>conform_dims((/dimsizes(r),<wbr>dimsizes(theta)/),theta,1)*<wbr>deg2rad)</div><div> x = conform_dims((/dimsizes(r),<wbr>dimsizes(theta)/),r,0)*sin(<wbr>conform_dims((/dimsizes(r),<wbr>dimsizes(theta)/),theta,1)*<wbr>deg2rad)</div><div><br></div><div>; x = r*sin(theta*deg2rad)</div><div> </div><div> </div><div> </div><div>;print(lat+" "+lon )</div><div> </div><div> <span class="m_-974354147950016633Apple-tab-span" style="white-space:pre-wrap">        </span>tcnum = systemfunc("cut -d ' ' -f 1 land_tcnum_time.dat")</div><div><span class="m_-974354147950016633Apple-tab-span" style="white-space:pre-wrap">        </span>ltime = systemfunc("cut -d ' ' -f 2 land_tcnum_time.dat")</div><div><br></div><div> i = 3</div><div><br></div><div> tcdir = "land_gd_tc/"</div><div> tcfile = tcnum(i)+".dat"</div><div> tmp = asciiread(tcdir+tcfile,-1,"<wbr>integer")</div><div> ntime = dimsizes(tmp)/6</div><div> data = onedtond(tmp,(/ntime,6/))</div><div> </div><div> index = ind(ltime(i).eq.data(:,0))</div><div> lat0 = data(index,2)*0.01</div><div> lon0 = data(index,3)*0.01</div><div> </div><div> a0 = a*cos(lat0*deg2rad)</div><div> </div><div> </div><div> lat = y/(a*deg2rad)+lat0</div><div> lon = x/(a0*deg2rad)+lon0</div><div> </div><div> </div><div> fd = "/gza/g3/wengh/TC/TRMM/"+<wbr>tcnum(i)+"/"</div><div> fn = systemfunc("ls "+fd+"3B42."+str_get_cols(<wbr>ltime(i),0,7)+"."+str_get_<wbr>cols(ltime(i),8,9)+"*.HDF")</div><div> f = addfile(fn,"r") </div><div> pre = f->precipitation</div><div> </div><div> latgrid = fspan(-49.875,49.875,400)</div><div> longrid = fspan(-179.875,179.875,1440)</div><div> </div><div> pre!0 = "lon"</div><div> pre!1 = "lat"</div><div> </div><div> pre&lon = longrid</div><div> pre&lat = latgrid</div><div> </div><div><br></div><div>pr = new((/dimsizes(r),dimsizes(<wbr>theta)/),typeof(pre))</div><div><br></div><div>do i=0,dimsizes(r)-1</div><div> do j=0,dimsizes(theta)-1</div><div> nlat = ind_nearest_coord(lat(i,j),<wbr>latgrid,0)</div><div> nlon = ind_nearest_coord(lon(i,j),<wbr>longrid,0)</div><div> pr(i,j) = (/pre(nlon,nlat)/)</div><div> end do</div><div>end do</div><div> </div><div> </div><div>;print(pr(0,0)+" "+x(0,0)+" "+y(0,0))</div><div><br></div><div>;exit</div><div> </div><div><br></div><div>graphicname = get_script_prefix_name() </div><div>wks = gsn_open_wks("eps" ,graphicname) </div><div>;gsn_define_colormap(wks,"gui_<wbr>default")</div><div>gsn_define_colormap(wks,"<wbr>precip2_15lev")</div><div>;gsn_define_colormap(wks,"<wbr>radar")</div><div>;gsn_define_colormap(wks,"<wbr>precip2_17lev")</div><div>colors = ispan(4,17,1)</div><div>;colors(0) = 2</div><div><br></div><div><br></div><div> cnres = True</div><div>; cnres@gsnMaximize = True</div><div><br></div><div> cnres@sfXArray = x </div><div> cnres@sfYArray = y</div><div> cnres@cnFillOn = True</div><div> cnres@cnLinesOn = False</div><div>; cnres@cnFillMode = "RasterFill" ; this mode is fastest</div><div> cnres@trGridType = "TriangularMesh"</div><div> cnres@lbLabelAutoStride = True</div><div>; contour = gsn_csm_contour(wks,pr,cnres)</div><div><br></div><div>; The CellFill mode is slower but draws more outlying data</div><div>; and lets you fill in the missing value arrays, giving a good</div><div>; sense of the circular extent of the plot.</div><div><br></div><div> cnres@cnFillMode = "CellFill"</div><div> cnres@cnMissingValFillColor = NhlNewColor(wks,.7,.7,.7)</div><div> cnres@cnLevelSelectionMode = "ExplicitLevels" ; set manual contour levels</div><div> cnres@cnLevels = ispan(1,13,1) ; set min contour level</div><div> cnres@cnFillColors = colors</div><div><br></div><div><br></div><div> contour = gsn_csm_contour(wks,pr,cnres)</div><div>end</div><div><br></div></div><img src="cid:427c9e42$1$15b9f239410$Coremail$wenguanhuan$163.com" style="width:780px;height:1008px;border:none"><br><div style="zoom:1">--<br><div>Best regards,</div><div>Guanhuan Wen</div><div style="clear:both"></div></div></div><br><br><span title="neteasefooter"><p> </p></span><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>