Hi Dave,<div> Many thanks for the explanation of this problem . It do help me understand this function better!</div><div>Best regards,</div><div> Miao</div><div><br></div><br><br><blockquote name="replyContent" class="ReferenceQuote" style="padding-left:5px;margin-left:5px;border-left:#b6b6b6 2px solid;margin-right:0">-----原始邮件-----<br>
<b>发件人:</b><span id="rc_from">"David Brown" <dbrown@ucar.edu></span><br>
<b>发送时间:</b><span id="rc_senttime">2017-06-02 07:16:50 (星期五)</span><br>
<b>收件人:</b> "王淼" <miaowang2015@pku.edu.cn><br>
<b>抄送:</b> "ncl-talk@ucar.edu" <ncl-talk@ucar.edu><br>
<b>主题:</b> Re: [ncl-talk] Problem of using "get_isolines"<br><br><div dir="ltr">The reason get_isolines returns longitudes that vary in the longitude cycle (-180 - 180) or (0,360) or (0- -360) is so that it can avoid discontinuities in the sequence of numbers, which is important for some applications. <div>Instead of returning a sequence like (178, 179, 180, -179), it simply continues the sequence (178, 179, 180, 181). The NCL map plotting code accepts as valid longitudes any number between -540 and +540, so returning the values this way is not at all a problem for NCL plotting, although admittedly there are situations where it is best to have the numbers confined to a single longitude cycle.</div><div>If you do need to get to a single cycle you can do it using the where function. Assuming you want to confine the values to the range -180 - 180, then these two statements should do it for you, assuming that lon is assigned the x value returned from get_isolines:</div><div><br></div><div>lon = where(lon .gt. 180, lon - 360, lon) </div><div>lon = where(lon .lt. -180, lon + 360, lon)</div><div><br></div><div>Hope this helps.</div><div> -dave</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 1, 2017 at 3:16 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">We were looking into this problem using a different example, and seeing some odd results.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Is it possible for you to provide us with the <a href="http://pt.nc" target="_blank">pt.nc</a> file?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You can use our ftp, if the file is not too large:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP" target="_blank">http://www.ncl.ucar.edu/<wbr>report_bug.shtml#HowToFTP</wbr></a><br></div><div class="gmail_default"><br></div><div class="gmail_default">Thanks,</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, May 30, 2017 at 8:17 PM, 王淼 <span dir="ltr"><<a href="mailto:miaowang2015@pku.edu.cn" target="_blank">miaowang2015@pku.edu.cn</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><font style="background-color:rgb(255,255,255)" size="3" face="Courier">Hi Ncl Talk,</font><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> I used get_isolines to get<span style="color:rgb(51,51,51)"> the points that define a contour line .When I printed the longitude of these points , the distribution of the longitude wasn't the same(gonna show in the following example) ,may be [0~-360] or [20~-340],etc. I have expected the function may return the longitude as [0~360] or [-180~180]. I googled it ,but didn't help.I still don't know what caused the effect, so I ask you for help. Thanks!</span></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font color="#333333" style="background-color:rgb(255,255,255)" size="3" face="Courier">Here is the code and resluts:</font></div><div><font color="#333333"><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl"</wbr></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl"</wbr></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"</wbr></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/contrib/cd_string.ncl"</wbr></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">begin</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">f1=addfile("<a href="http://pt.nc" target="_blank">pt.nc</a>","r") ;pt(time,lat,lon)</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">pt=short2flt(f1->pt) </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">pt=lonFlip(pt) ;lon=0~360degrees </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">n=dimsizes(pt&time)</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> wks = gsn_open_wks("pdf","sypt_all") </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res = True </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res@gsnDraw = False</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res@gsnFrame = False</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res@cnFillOn = False </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res@cnLinesOn = True </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res@cnLevelSelectionMode = "ExplicitLevels" </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res@cnLevels = (/350,360/) </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res@mpMinLatF = 0 </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> res@mpCenterLonF =180 </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">res@trGridType = "TriangularMesh" </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"><br></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">do i = 0, n-1 ;time</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> plot=gsn_csm_contour_map_ce(wk<wbr>s, pt(i,:,:), res) </wbr></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> isolines = get_isolines(plot@contour,"plo<wbr>t") </wbr></font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> do j= 0, ListCount(isolines) - 1</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> iso := isolines[j] </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> idx=maxind(iso@n_points)</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> b = iso@start_point(idx) </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> e = b + iso@n_points(idx) - 1 </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> y := iso(0,b:e) </font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> x := iso(1,b:e) ;y=lat,x=lon</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> print(x)</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier"> end do</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">end do</font></div><div><font style="background-color:rgb(255,255,255)" size="3" face="Courier">end </font></div><div style="font-family:verdana,sans-serif;font-size:13.3333px"><br></div><div style="font-family:verdana,sans-serif;font-size:13.3333px"><table border="0" cellpadding="0" cellspacing="0" width="144" style="border-collapse:collapse;width:108pt"> <colgroup><col width="72" span="2" style="width:54pt"> </colgroup><tbody><tr height="19" style="height:14.25pt"> <td height="19" width="72" style="height:14.25pt;width:54pt">result1</td> <td width="72" style="width:54pt">result2</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" align="right" style="height:14.25pt">0</td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">0</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" align="right" style="height:14.25pt">-1.8</td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">-1.3</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" align="right" style="height:14.25pt">-2.5</td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">-2.5</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" style="height:14.25pt"> …</td> <td class="m_3369637111064676044m_-6371595060249658642xl65" width="72" style="width:54pt"> …</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" align="right" style="height:14.25pt">-358.9</td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">-339.8</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" align="right" style="height:14.25pt">-359.7</td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">-340</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" align="right" style="height:14.25pt">-360</td> <td class="m_3369637111064676044m_-6371595060249658642xl65" width="72" style="width:54pt"> …</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" style="height:14.25pt"></td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">20</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" style="height:14.25pt"></td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">18.6</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" style="height:14.25pt"></td> <td class="m_3369637111064676044m_-6371595060249658642xl65" width="72" style="width:54pt"> …</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" style="height:14.25pt"></td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">2.5</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" style="height:14.25pt"></td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">0.5</td> </tr> <tr height="19" style="height:14.25pt"> <td height="19" style="height:14.25pt"></td> <td class="m_3369637111064676044m_-6371595060249658642xl65" align="right" width="72" style="width:54pt">0</td> </tr></tbody></table><br></div></font></div><br><br><span><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/mailma<wbr>n/listinfo/ncl-talk</wbr></a></span><br></div></div>______________________________<wbr>_________________<span class=""><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/mailma<wbr>n/listinfo/ncl-talk</wbr></a><br>
<br></span></wbr></blockquote></div><br></div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</wbr></a><br>
<br></wbr></blockquote></div><br></div>
</blockquote>