<div dir="ltr"><div><div>Hi,<br><br></div>I am unaware of any way of doing that directly with NCL. Offhand, I'd say you'd have to treat each line from the shapefile individually, clipping each one against the shape (if this is a simple, rotated ellipse, it shouldn't be too hard to do) and draw.<br><br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 23, 2016 at 11:02 AM, Jesús Garcia Rosales <span dir="ltr"><<a href="mailto:jesus21gr@gmail.com" target="_blank">jesus21gr@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 dir="ltr"><span style="font-family:'Diaria Light Pro',sans-serif;font-size:15px;line-height:26px;background-color:rgb(245,246,245)">Hi everybody</span><div style="font-family:'Diaria Light Pro',sans-serif;font-size:15px;line-height:26px;background-image:inherit!important;background-color:rgb(245,246,245);background-repeat:inherit!important">I have a doubt about a shapefile in ncl. I want to plot only a part of the shapefile which is inside in the circle red. But I don't know how to do that. Please help me. </div><div style="font-family:'Diaria Light Pro',sans-serif;font-size:15px;line-height:26px;background-image:inherit!important;background-color:rgb(245,246,245);background-repeat:inherit!important">Greetings,</div><div style="font-family:'Diaria Light Pro',sans-serif;font-size:15px;line-height:26px;background-image:inherit!important;background-color:rgb(245,246,245);background-repeat:inherit!important">Alan</div><div><br></div><div>My script is the next:</div><div><br></div><div><div style="font-size:12.8px">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div style="font-size:12.8px">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div style="font-size:12.8px">load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div style="font-size:12.8px">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">begin</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">year= "exp_re"</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">;---Open WRF output file.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">a = addfile("/media/usuario/TOSHIBA/WRF_alan/9km/exp_re/wrfout_2002F."+year+".<a href="http://3km.nc/" target="_blank">3km.nc</a>","r")</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">;---Read terrain height and lat/lon off file.</div><div style="font-size:12.8px"> it = 0 ; first time step</div><div style="font-size:12.8px"> hgt = wrf_user_getvar(a,"HGT",it) ; Terrain elevation</div><div style="font-size:12.8px"> hgt@lat2d = wrf_user_getvar(a,"XLAT",it) ; latitude/longitude</div><div style="font-size:12.8px"> hgt@lon2d = wrf_user_getvar(a,"XLONG",it) ; required for plotting</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Grafico</div><div style="font-size:12.8px">;;;;;;;;;;;;; Salida</div><div style="font-size:12.8px"> type = "x11"</div><div style="font-size:12.8px">; type = "pdf"</div><div style="font-size:12.8px"> ;type = "ps"</div><div style="font-size:12.8px">; type = "ncgm" </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> wks = gsn_open_wks(type,"graficas/topografia_cuenca_estaciones")</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">;---Set some basic plot options</div><div style="font-size:12.8px"> res = True</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> res@gsnMaximize = True ; maximize plot in frame</div><div style="font-size:12.8px"> res@gsnDraw = False</div><div style="font-size:12.8px"> res@gsnFrame = False</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> ; res@tiMainString = filename</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> res@cnFillOn = True </div><div style="font-size:12.8px"> res@cnFillPalette = "OceanLakeLandSnow"</div><div style="font-size:12.8px"> res@cnLinesOn = False</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> res@mpProjection = "CylindricalEquidistant" ; The default</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">;---Zoom in on plot</div><div style="font-size:12.8px"> res@mpMinLatF = -13.8</div><div style="font-size:12.8px"> res@mpMaxLatF = -10.5</div><div style="font-size:12.8px"> res@mpMinLonF = -77</div><div style="font-size:12.8px"> res@mpMaxLonF = -73.6</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">;---Additional resources desired</div><div style="font-size:12.8px"> res@pmTickMarkDisplayMode = "Always" ; nicer tickmarks</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> res@mpDataBaseVersion = "MediumRes" ; better and more map outlines</div><div style="font-size:12.8px"> res@mpDataSetName = "Earth..4"</div><div style="font-size:12.8px"> res@mpOutlineBoundarySets = "AllBoundaries"</div><div style="font-size:12.8px"> res@mpOutlineOn = True</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> res@lbOrientation = "Vertical"</div><div style="font-size:12.8px"> res@tiMainOffsetYF = -0.03 ; Move the title down</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">;---Change contour levels to better match the color map being used</div><div style="font-size:12.8px"> res@cnLevelSelectionMode = "ExplicitLevels"</div><div style="font-size:12.8px"> res@cnLevels = (/10,100,200,400,600,800,1000,1200,1400,1600,1800,2000,\</div><div style="font-size:12.8px"> 2200,2400,2800,3000,3200,3400,3600,3800,4000,4200,4400,4600,4800,5000,\</div><div style="font-size:12.8px"> 5200,5400/)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> res@gsnAddCyclic = False</div><div style="font-size:12.8px"><span style="font-size:12.8px"> </span><br></div><div style="font-size:12.8px"> plot = gsn_csm_contour_map(wks,hgt,res)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">alres = True</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> latN = -10.5</div><div style="font-size:12.8px"> latS = -13.8 ;-13.58</div><div style="font-size:12.8px"> lonL = -77</div><div style="font-size:12.8px"> lonR = -73.6</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> ; Coordenadas de cada estación que se quiere ubicar</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> lat=(/-12.04, -10.69, -11.4, -11.33, -12.25, -12.12, -11.4, -11.75, -11.88, -11.62, \</div><div style="font-size:12.8px"> -11.78, -12, -12.16, -12.38, -12.35, -12.58, -12.78, -12.98, -13.06, -12.84/)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> lon=(/-75.32, -76.26, -76.33, -76.4, -75.36, -75.43, -75.69, -75.13, -75.27, -75.01,\</div><div style="font-size:12.8px"> -75.47, -75.22, -75.23, -74.85, -75.08, -75.24, -75.01, -74.72, -74.14, -74.57/)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">colors =(/"blue3"/)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> ;colors = (/"orange2","forestgreen","dodgerblue2","forestgreen","orange2","orange2","forestgreen","dodgerblue2",\</div><div style="font-size:12.8px"> ; "dodgerblue2","olivedrab2","forestgreen","orange2","orange2","olivedrab2","darkorchid2","olivedrab2",\</div><div style="font-size:12.8px"> ; "forestgreen","darkorchid2","olivedrab2","darkorchid2"/)</div><div style="font-size:12.8px"> </div><div style="font-size:12.8px">; orange2</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> labels = (/"Huayao","Cerro de Pasco","Marcapomacocha","Yantac","Laive","Jarpa","Tarma","Comas"\</div><div style="font-size:12.8px"> ,"Ingenio","Ricran","Jauja","Santa Ana","Viques","Pampas","Pilchaca","Huancalpi"\</div><div style="font-size:12.8px"> ,"Huancavelica","Lircay","Quinua","Acobamba"/)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">; Manually specify location of legends</div><div style="font-size:12.8px"> </div><div style="font-size:12.8px"> xleg = (/0.15,0.15,0.15,0.15,0.15,0.35,0.35,0.35,0.35,0.35,0.56,0.56,0.56,0.56,0.56,0.80,0.80,0.80,0.80,0.80/); Location of</div><div style="font-size:12.8px"> xtxt = (/0.22,0.225,0.225,0.225,0.225,0.44,0.44,0.44,0.44,0.44,0.65,0.66,0.66,0.66,0.66,0.88,0.88,0.88,0.88,0.88/) ; legend markers</div><div style="font-size:12.8px"> yleg = (/0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08/) ; and text</div><div style="font-size:12.8px"> ytxt = (/0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08/) ; strings.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> mkres = True</div><div style="font-size:12.8px"> mkres@gsMarkerIndex = 17 ; Filled circle</div><div style="font-size:12.8px"> mkres@gsMarkerSizeF = 0.05 ;0.03</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> txres = True</div><div style="font-size:12.8px"> txres@txFontHeightF = 0.014</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> mkres@gsMarkerColor = colors</div><div style="font-size:12.8px"> la= gsn_add_polymarker(wks,plot,lon(:),lat(:),mkres)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> cuenca_mantaro_shp_name = "/home/usuario/Escritorio/alan/cuencas/UH.shp"</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> lnres = True</div><div style="font-size:12.8px"> lnres@gsLineColor = "black"</div><div style="font-size:12.8px"> lnres@gsLineThicknessF = 4 </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> can_id = gsn_add_shapefile_polylines(wks,plot,cuenca_mantaro_shp_name,lnres)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">overlay(la,can_id)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> draw(plot)</div><div style="font-size:12.8px"> frame(wks)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> end</div></div></div>
<br>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>