<div dir="ltr">Hi Rick, <div><br><div>Thank for suggestion. after I modify my code, the two plot are overlaid now (see attached) but since I use my own defined projection, the contour plot match well but the vector cannot. Do you have any suggest to fix this problem? I've tried assign mp resource to vector but it conflicts. Thx in advance.</div><div><br></div><div>Joe</div><div>The revised code is as follows</div><div><br></div><div><div> u = f1->UWIND(0,0,:,:) ;U at timestep 0 135x90</div><div> v = f1-> VWIND(0,0,:,:) ;V at timestep 0 135x90</div><div> ox = f3->O3(0,0,:,:) ;ozone concentration at timestep 0 135x90</div></div><div><div><br></div><div> wks = gsn_open_wks("png","overlay")</div><div> sfile ="/nas02/depts/ese/chaq/ckliang/TWN/shape/TWN_adm2.shp"</div><div> gsn_define_colormap(wks,"cmp_haxby")</div><div><br></div><div>;Map============================================</div><div> mpres = True</div><div> mpres@gsnDraw = False</div><div> mpres@gsnFrame = False</div><div> mpres@mpProjection = "LambertConformal"</div><div> mpres@mpLambertParallel1F = 10.0</div><div> mpres@mpLambertParallel2F = 40.0</div><div> mpres@mpLambertMeridianF = 120.0</div><div> mpres@tfDoNDCOverlay = True</div><div> mpres@mpLimitMode = "Corners"</div><div> mpres@mpLeftCornerLonF = LON(0,0,0,0)</div><div> mpres@mpLeftCornerLatF = LAT(0,0,0,0)</div><div> mpres@mpRightCornerLonF = LON(0,0,dimsizes(LAT(0,0,:,0))-1,dimsizes(LAT(0,0,0,:))-1)</div><div> mpres@mpRightCornerLatF = LAT(0,0,dimsizes(LAT(0,0,:,0))-1,dimsizes(LAT(0,0,0,:))-1)</div><div><br></div><div> mpres@mpDataSetName = "Earth..4" ; This new database contains</div><div> mpres@mpDataBaseVersion = "MediumRes" ; Medium resolution database</div><div> mpres@mpOutlineOn = True ; Turn on map outlines</div><div> mpres@mpFillOn = True ; Turn on map fill</div><div> mpres@mpOutlineBoundarySets = "AllBoundaries"</div><div> mpres@mpGridAndLimbOn = True</div><div> mpres@mpGridLineDashPattern = 2</div><div> mpres@mpCenterRotF = 90.0</div><div> mpres@gsnSpreadColors = True ; use full colormap</div><div>;;Contour=============================================================</div></div><div><div> mpres@cnFillOn = True</div><div> mpres@cnFillMode = "RasterFill" ; use raster mode</div><div> mpres@cnLinesOn = False</div><div> mpres@gsnMaximize = True ; Maximize the plot where it is drawn</div><div> mpres@gsnSpreadColors = True ; use full colormap</div><div> mpres@cnLevelSelectionMode = "ManualLevels"</div><div> mpres@cnMinLevelValF = 5. ; set the minimum contour level</div><div> mpres@cnMaxLevelValF = 100. ; set the maximum contour level</div><div> mpres@cnLevelSpacingF = 5 ; set the contour interval</div><div> mpres@lbLabelStride = 1</div><div> mpres@lbLabelFont = "times-roman"</div><div><br></div><div>;;set vector==========================================================</div><div> vcres = True</div><div> vcres@gsnDraw = False</div><div> vcres@gsnFrame = False</div><div> vcres@vcMinFracLengthF = 0.0 ;-- length of min vector as</div><div> vcres@vcRefMagnitudeF = 10.0 ;-- make vectors larger</div><div> vcres@vcRefLengthF = 0.045 ;-- ref vec length</div><div> vcres@vcMinDistanceF = 0.01 ;-- thin out vectors</div><div> vcres@gsnLeftString = ""</div><div> vcres@gsnRightString = ""</div><div> vcres@tiMainString = "Wind profile October 1 2010 00:00"; vector curly</div><div> vcres@vcGlyphStyle = "CurlyVector"</div></div><div><div>;;plot====================================================================</div><div> contour = gsn_csm_contour_map(wks,ox*1000.,mpres)</div><div> vector = gsn_csm_vector(wks,u,v,vcres)</div><div> ;shapefile<br></div><div> lnres = True</div><div> lnres@gsLineColor = "gray25"</div><div> lnres@gsLineThicknessF = 1.0</div><div> twn_id1 = gsn_add_shapefile_polylines(wks,contour,sfile,lnres)</div><div> twn_id2 = gsn_add_shapefile_polylines(wks,vector,sfile,lnres)</div><div><br></div><div> draw(contour) ; This will draw the map and the shapefile outlines.</div><div> draw(vector)</div><div> frame(wks) ; Advance the frame</div><div>end</div></div><div><br></div><div> </div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-08 23:44 GMT+08:00 Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br><br></div>Looking at your plot, the reference vector generated by the vector plot and the label bar generated by the contour plot are both present on the map. I'd recommend taking a close look at the underlying data to make sure units, values, and spatial extent is what you think it is. <br><br></div>Hope that helps...<br></div>Rick<br><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Fri, Jul 8, 2016 at 1:16 AM, Ciao Kai Liang <span dir="ltr"><<a href="mailto:ciaokailiang@gmail.com" target="_blank">ciaokailiang@gmail.com</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"><div dir="ltr"><div>Dear alll ncl users, </div><div><br></div><div>I try to make a plot of overlaying the wind speed (vector) and the ozone concentration (contour) on the map. The wind speed vector is from MCIP output and ozone concentration from CMAQ model. No error message occurs but I get blank on the map(attached). Is something wrong in my script? Thx in advance.</div><div><br></div><div>Joe</div><div><br></div><div><div>;read files=============================================================</div><div>f1 = addfile("METDOT3D","r")<br></div><div>f2 = addfile("<a href="http://CCTM_D502a_Linux2_x86_64ifort.ACONC.CMAQ20101001.nc" target="_blank">CCTM_D502a_Linux2_x86_64ifort.ACONC.CMAQ20101001.nc</a>","r")</div><div><br></div><div>u = f1->UWINDC(0,0,:,:) ;U at timestep 0 by 90X135</div><div>v = f1->VWINDC(0,0,:,:) ;V at timestep 0 by 90X135</div><div>ox = f2->O3(0,0,:,:) ;ozone concentration at timestep 0 by 90X135</div></div><div><br></div><div>;set evn===============================================================</div><div><div>wks = gsn_open_wks("png","overlay")</div><div>gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")</div></div><div><br></div><div><div>vcres = True ;Vector</div><div><div>vcres@gsnDraw = False</div><div>vcres@gsnFrame = False</div></div><div>cnres = vcres ;Contour<br></div><div>mpres = vcres ;Map</div></div><div><br></div><div><div>;Contour===============================================================</div><div> cnres@gsnDraw = False</div><div> cnres@gsnFrame = False</div><div><br></div><div> cnres@cnFillOn = True</div><div> cnres@cnFillMode = "RasterFill" ; use raster mode</div><div> cnres@cnLinesOn = False</div><div> cnres@tmYROn = False ; Turn off right tickmarks.</div><div> cnres@tmXTOn = False ; Turn off top tickmarks.</div><div> cnres@tmXBLabelFont = "times-roman"</div><div> cnres@tmYLLabelFont = "times-roman"</div><div> cnres@gsnMaximize = True ; Maximize the plot where it is drawn</div><div> cnres@gsnSpreadColors = True ; use full colormap</div><div><br></div><div> cnres@cnLevelSelectionMode = "ManualLevels"</div><div> cnres@cnMinLevelValF = 10. ; set the minimum contour level</div><div> cnres@cnMaxLevelValF = 120. ; set the maximum contour level</div><div> cnres@cnLevelSpacingF = 10. ; set the contour interval</div><div> cnres@lbLabelStride = 1</div></div><div><div> cnres@lbLabelFont = "times-roman"</div><div><br></div><div> cnres@tmXBLabelFontHeightF = 0.015</div><div> cnres@tmYLLabelFontHeightF = 0.015</div></div><div><br></div><div><div>;Vector=============================================</div><div> vcres@vcLevelSelectionMode = "ManualLevels"</div><div> vcres@vcMinLevelValF = -20.0</div><div> vcres@vcMaxLevelValF = 100.0</div><div> vcres@vcLevelSpacingF = 10.0</div><div> vcres@vcLevelPalette = "amwg_blueyellowred" ; assign color map to vectors</div><div><br></div><div> vcres@vcGlyphStyle = "LineArrow"</div><div> vcres@vcLineArrowThicknessF = 5</div><div> vcres@vcMinDistanceF = 0.01</div><div> vcres@vcRefLengthF = 0.03</div><div><br></div><div> vcres@vcGlyphStyle = "WindBarb"</div><div> vcres@vcWindBarbLineThicknessF = 5</div><div> vcres@vcWindBarbColor = "Gray40"</div><div><br></div><div> vcres@vcRefAnnoOn = True</div><div> vcres@vcRefMagnitudeF = 30</div><div> vcres@vcRefAnnoString1 = "30"</div><div> vcres@vcRefAnnoSide = "Top"</div></div><div><div> vcres@vcRefAnnoString2On = False</div><div> vcres@vcRefAnnoPerimOn = False</div><div> vcres@vcRefAnnoOrthogonalPosF = -0.12</div><div> vcres@vcRefAnnoParallelPosF = 0.999</div><div> vcres@vcRefAnnoBackgroundColor = "Purple"</div><div> vcres@vcVectorDrawOrder = "PostDraw"</div><div> vcres@gsnRightString = "Wind"</div></div><div><br></div><div><div>;Map============================================</div><div> mpres@mpProjection = "LambertConformal"</div><div> mpres@mpLambertParallel1F = 10.0</div><div> mpres@mpLambertParallel2F = 40.0</div><div> mpres@mpLambertMeridianF = 120.0</div><div> mpres@tfDoNDCOverlay = True</div><div> mpres@mpLimitMode = "Corners"</div><div> mpres@mpLeftCornerLonF = LON(0,0,0,0)</div><div> mpres@mpLeftCornerLatF = LAT(0,0,0,0)</div><div> mpres@mpRightCornerLonF = LON(0,0,dimsizes(LAT(0,0,:,0))-1,dimsizes(LAT(0,0,0,:))-1)</div><div> mpres@mpRightCornerLatF = LAT(0,0,dimsizes(LAT(0,0,:,0))-1,dimsizes(LAT(0,0,0,:))-1)</div><div><br></div><div> mpres@mpDataSetName = "Earth..4" ; This new database contains</div><div> mpres@mpDataBaseVersion = "MediumRes" ; Medium resolution database</div><div> mpres@mpOutlineOn = True ; Turn on map outlines</div><div> mpres@mpFillOn = True </div></div><div><div> mpres@mpOutlineBoundarySets = "AllBoundaries"</div><div> mpres@mpGridAndLimbOn = True</div><div> mpres@mpGridLineDashPattern = 2</div><div> mpres@mpCenterRotF = 90.0</div><div><br></div><div> mpres@mpLabelsOn = False</div><div> mpres@mpPerimOn = True</div><div> mpres@mpGridAndLimbOn = False</div><div> mpres@mpOutlineDrawOrder = "PostDraw"</div><div> mpres@mpFillDrawOrder = "Predraw"</div><div> mpres@mpOceanFillColor = "lightskyblue1"</div><div> mpres@mpLandFillColor = "gray"</div><div><br></div><div> mpres@mpGridAndLimbDrawOrder = "Predraw"<br></div><div> mpres@tiMainString = "October 1 2010 ozone concentration(ppm)"</div></div><div><br></div><div><div><div>;=====================================================================</div><div> vcid = gsn_csm_vector(wks,u,v,vcres)</div><div> cnid = gsn_csm_contour(wks,ox*1000.,cnres)</div><div> mpid = gsn_csm_map(wks,mpres)</div><div><br></div><div>;---Attach the shapefile polylines using files read off <a href="http://gadm.org/country" target="_blank">gadm.org/country</a>.</div><div> lnres = True</div><div> lnres@gsLineColor = "gray25"</div><div> lnres@gsLineThicknessF = 1.0</div><div> twn_id = gsn_add_shapefile_polylines(wks,mpid,sfile,lnres)</div></div><div><br></div><div>;---Overlay contour, streamline, and vector plots on the map plot.</div><div> overlay(mpid,cnid)</div><div> overlay(mpid,vcid)</div><div><br></div><div> draw(mpid)</div><div> frame(wks)</div><div><br></div><div> maximize_output(wks,True)</div><div>end</div></div><div><br></div>
</div>
<br></div></div>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>---------------------------------------------------------------------------------------------------------</div>CiaoKai Liang<div>919-808-8069</div><div><a href="mailto:ckliang@live.unc.edu" target="_blank">ckliang@live.unc.edu</a></div><div>University of North Carolina, Gillings School of Global Public Health<br>170 Rosenau Hall, CB #7400 | 135 Dauer Drive | Chapel Hill, NC 27599-7400</div><div>------------------------------------------------------------------------------------------------------------</div><div><br></div></div></div>
</div>