[ncl-talk] Problem of using "get_isolines"

王淼 miaowang2015 at pku.edu.cn
Tue May 30 20:17:32 MDT 2017


Hi Ncl Talk,
   I used get_isolines to get 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!


Here is the code and resluts:


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"


begin


f1=addfile("pt.nc","r")         ;pt(time,lat,lon)
pt=short2flt(f1->pt)              
pt=lonFlip(pt)                  ;lon=0~360degrees   


n=dimsizes(pt&time)




  wks = gsn_open_wks("pdf","sypt_all")        
  
  res                      = True         
  res at gsnDraw              = False
  res at gsnFrame             = False


  res at cnFillOn             = False         
  res at cnLinesOn            = True      


  res at cnLevelSelectionMode   = "ExplicitLevels"   
  res at cnLevels              = (/350,360/) 


  
  res at mpMinLatF            = 0         
  res at mpCenterLonF         =180           
res at trGridType = "TriangularMesh"   




do i = 0, n-1                                           ;time
    plot=gsn_csm_contour_map_ce(wks, pt(i,:,:), res)  
    
     isolines = get_isolines(plot at contour,"plot")   
     
    do j= 0, ListCount(isolines) - 1
      iso := isolines[j]             
      
      idx=maxind(iso at n_points)
      b = iso at start_point(idx)          
      e = b + iso at n_points(idx) - 1       
      y := iso(0,b:e)                  
      x := iso(1,b:e)                   ;y=lat,x=lon
      print(x)
    end do
end do
end 


| result1 | result2 |
| 0 | 0 |
| -1.8 | -1.3 |
| -2.5 | -2.5 |
|      … |      … |
| -358.9 | -339.8 |
| -359.7 | -340 |
| -360 |      … |
| | 20 |
| | 18.6 |
| |      … |
| | 2.5 |
| | 0.5 |
| | 0 |





ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170531/246c8662/attachment.html 


More information about the ncl-talk mailing list