<div dir="ltr"><div class="gmail_default" style="font-size:small">Jesus,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I don't see where you are defining "dum3". You are treating it as an array, but you haven't defined its size. You should have gotten an error message like:</div><div class="gmail_default" style="font-size:small">
<p class=""><span class="">fatal:Undefined identifier: (dum3) is undefined, can't continue</span></p>
<p class=""><span class="">and then:</span></p><p class="">warning:TransformPostDraw: tfPolyDrawList element 0 is invalid</p><p class="">I modified your script to define "dum3", and then I just drew the map and added the markers, since I don't have the data. It worked just fine for me. See the attached script and image.</p><p class="">--Mary</p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 5, 2015 at 2:02 PM, 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"><div>Hi ncl users,</div><div>I have a problem to display my stations' position with differents colors, using gsn_add_polymarker. When I use:</div><div><br></div><div> mkres@gsMarkerColor = colors</div><div>dum3 = gsn_add_polymarker(wks,plot,lon,lat,mkres)</div><div><br></div><div>It works, but only displays the stations with one color.</div><div>My script is the next:</div><div><br></div><div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div><div><br></div><div>begin</div><div>;---Open WRF output file.</div><div> dir = "/media/usuario/TOSHIBA/WRF_alan/9km/"</div><div> filename = "wrfout_d01_2010F.nc"</div><div> a = addfile(dir + filename,"r")</div><div><br></div><div>;---Read terrain height and lat/lon off file.</div><div> it = 0 ; first time step</div><div> hgt = wrf_user_getvar(a,"HGT",it) ; Terrain elevation</div><div> hgt@lat2d = wrf_user_getvar(a,"XLAT",it) ; latitude/longitude</div><div> hgt@lon2d = wrf_user_getvar(a,"XLONG",it) ; required for plotting</div><div><br></div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Grafico</div><div>;;;;;;;;;;;;; Salida</div><div> type = "x11"</div><div> ;type = "pdf"</div><div> ;type = "ps"</div><div>; type = "ncgm" </div><div><br></div><div><br></div><div> wks = gsn_open_wks(type,"graficas/topografia_cuenca")</div><div><br></div><div>;---Set some basic plot options</div><div> res = True</div><div><br></div><div> res@gsnMaximize = True ; maximize plot in frame</div><div> res@gsnDraw = False</div><div> res@gsnFrame = False</div><div><br></div><div> res@tiMainString = filename</div><div><br></div><div> res@cnFillOn = True </div><div> res@cnFillPalette = "OceanLakeLandSnow"</div><div> res@cnLinesOn = False</div><div><br></div><div> res@mpProjection = "CylindricalEquidistant" ; The default</div><div><br></div><div>;---Zoom in on plot</div><div> res@mpMinLatF = -13.8</div><div> res@mpMaxLatF = -10.5</div><div> res@mpMinLonF = -77</div><div> res@mpMaxLonF = -73.6</div><div><br></div><div>;---Additional resources desired</div><div> res@pmTickMarkDisplayMode = "Always" ; nicer tickmarks</div><div><br></div><div> res@mpDataBaseVersion = "MediumRes" ; better and more map outlines</div><div> res@mpDataSetName = "Earth..4"</div><div> res@mpOutlineBoundarySets = "AllBoundaries"</div><div> res@mpOutlineOn = True</div><div><br></div><div> res@lbOrientation = "Vertical"</div><div> res@tiMainOffsetYF = -0.03 ; Move the title down</div><div><br></div><div>;---Change contour levels to better match the color map being used</div><div> res@cnLevelSelectionMode = "ExplicitLevels"</div><div> res@cnLevels = (/2,100,200,400,600,800,1000,1200,1400,1600,1800,2000,\</div><div> 2200,2400,2800,3000,3200,3400,3600,3800,4000,4200,4400,4600,4800,5000,\</div><div> 5200,5400/)</div><div><br></div><div><br></div><div> res@gsnAddCyclic = False</div><div><br></div><div> plot = gsn_csm_contour_map(wks,hgt,res)</div><div><br></div><div> cuenca_mantaro_shp_name = "/home/usuario/Escritorio/alan/cuencas/UH.shp"</div><div><br></div><div> lnres = True</div><div> lnres@gsLineColor = "black"</div><div> lnres@gsLineThicknessF = 4 </div><div><br></div><div> can_id = gsn_add_shapefile_polylines(wks,plot,cuenca_mantaro_shp_name,lnres)</div><div><br></div><div> ; Coordenadas de cada estación que se quiere ubicar</div><div><br></div><div> lat=(/-12.04, -10.69, -11.4, -11.33, -12.25, -12.12, -11.4, -11.75, -11.88, -11.62, \</div><div> -11.78, -12, -12.16, -12.38, -12.35, -12.58, -12.78, -12.98, -13.06, -12.84/)</div><div><br></div><div> lon=(/-75.32, -76.26, -76.33, -76.4, -75.36, -75.43, -75.69, -75.13, -75.27, -75.01,\</div><div> -75.47, -75.22, -75.23, -74.85, -75.08, -75.24, -75.01, -74.72, -74.14, -74.57/)</div><div><br></div><div><br></div><div> </div><div> colors = (/"orange2","forestgreen","dodgerblue2","forestgreen","orange2","orange2","forestgreen","dodgerblue2",\</div><div> "dodgerblue2","olivedrab2","forestgreen","orange2","orange2","olivedrab2","darkorchid2","olivedrab2",\</div><div> "forestgreen","darkorchid2","olivedrab2","darkorchid2"/)</div><div><br></div><div><br></div><div> labels = (/"Huayao","Cerro de Pasco","Marcapomacocha","Yantac","Laive","Jarpa","Tarma","Comas"\</div><div> ,"Ingenio","Ricran","Jauja","Santa Ana","Viques","Pampas","Pilchaca","Huancalpi"\</div><div> ,"Huancavelica","Lircay","Quinua","Acobamba"/)</div><div><br></div><div>; Manually specify location of legends</div><div> </div><div> 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> 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> 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> 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><br></div><div> mkres = True</div><div> mkres@gsMarkerIndex = 17 ; Filled circle</div><div> mkres@gsMarkerSizeF = 0.05 ;0.03</div><div><br></div><div> txres = True</div><div> txres@txFontHeightF = 0.014</div><div><br></div><div><br></div><div> do i = 0,19</div><div> </div><div> mkres@gsMarkerColor = colors(i)</div><div> dum3(i)= gsn_add_polymarker(wks,plot,lon(i),lat(i),mkres)</div><div> ; gsn_polymarker_ndc(wks,xleg(i),yleg(i),mkres)</div><div> ; gsn_text_ndc (wks,labels(i),xtxt(i),ytxt(i),txres)</div><div> </div><div><br></div><div> end do</div><div> </div><div> ;mkres@gsMarkerColor = colors</div><div><br></div><div>; dum3 = gsn_add_polymarker(wks,plot,lon,lat,mkres)</div><div><br></div><div><br></div><div> draw(plot)</div><div> frame(wks)</div><div><br></div><div><br></div><div> end</div></div><div><br></div><div><br></div><div>Thanks for your time,</div><div><br></div><div>Jesus</div><div><br></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>