<div dir="ltr"><div><div><div>Hi Mira,<br></div>I responded to your query on Monday:<br><a href="http://mailman.ucar.edu/pipermail/ncl-talk/2015-August/003463.html">http://mailman.ucar.edu/pipermail/ncl-talk/2015-August/003463.html</a><br></div>If the suggested modifications do not work out let the ncl-talk email list know.<br></div>Adam<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 5, 2015 at 7:41 PM, <span dir="ltr"><<a href="mailto:mberdahl@envsci.rutgers.edu" target="_blank">mberdahl@envsci.rutgers.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
I'm having trouble using overlays within panel plots. I would like to<br>
have three panel plots, each with a map overlaid with a filled contour and<br>
wind vectors. However, when I try to do so, I do not see the map - only<br>
the contours and wind vectors. I can make the plot I'd like (with the<br>
map) when just trying a single figure instead of panel plots. Does anyone<br>
see what might be wrong with my code, copied below?<br>
Thanks in advance,<br>
Mira<br>
<br>
<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>
;************************************************<br>
begin<br>
;************************************************<br>
; read in netCDF file s<br>
;************************************************<br>
a = addfile("<a href="http://uwnd.mon.mean.alllevels.nc" rel="noreferrer" target="_blank">uwnd.mon.mean.alllevels.nc</a>","r") ; u winds<br>
b = addfile("<a href="http://vwnd.mon.mean.alllevels.nc" rel="noreferrer" target="_blank">vwnd.mon.mean.alllevels.nc</a>","r") ; v winds<br>
<br>
c = addfile("../Geopotential/<a href="http://hgt.mon.mean.nc" rel="noreferrer" target="_blank">hgt.mon.mean.nc</a>","r") ; geopotential heights.<br>
<br>
;************************************************<br>
; read in zonal [u] and meridional [v] winds (July)<br>
;************************************************<br>
<br>
u = a->uwnd(0:803,{500},{45:90},{270:357.5})<br>
v = b->vwnd(0:803,{500},{45:90},{270:357.5}) ; Get u, v, time (1),level<br>
(1000hpa),latitude(-90:90) and longitude(0:360) data.<br>
z = c->hgt(0:803,{500},{45:90},{270:357.5}) ; get geopotenial heights...<br>
<br>
printVarSummary(u)<br>
printVarSummary(v)<br>
printVarSummary(z)<br>
<br>
; Calculate the seasonal averages.<br>
uDJF = month_to_season(u, "DJF")<br>
vDJF = month_to_season(v, "DJF")<br>
zDJF = month_to_season(z, "DJF")<br>
<br>
printVarSummary(uDJF)<br>
printVarSummary(vDJF)<br>
printVarSummary(zDJF)<br>
<br>
; from the matlab script i wrote: findExtremeYrs, i pulled out the extreme<br>
years (> or < 1std) that i want to average and plot here.<br>
<br>
; for ans = 4 (NAO)<br>
; yearList_hi = 1973 1975 1983 1989 1995<br>
2000 2007 2012<br>
; yearList_lo = 1963 1964 1965 1969 1977<br>
1979 1996 1997 2010 2011<br>
<br>
<br>
; this data starts at 1948 (this is index 0), so 1953=5, 1963=15 etc.<br>
<br>
uDJF_NAO_hi = uDJF((/25,27,35,41,47,52,59,64/),:,:)<br>
uDJF_NAO_lo = uDJF((/15,16,17,21,29,31,48,49,62,63/),:,:)<br>
<br>
vDJF_NAO_hi = vDJF((/25,27,35,41,47,52,59,64/),:,:)<br>
vDJF_NAO_lo = vDJF((/15,16,17,21,29,31,48,49,62,63/),:,:)<br>
<br>
zDJF_NAO_hi = zDJF((/25,27,35,41,47,52,59,64/),:,:)<br>
zDJF_NAO_lo = zDJF((/15,16,17,21,29,31,48,49,62,63/),:,:)<br>
<br>
<br>
uAvgTime_hi = dim_avg_n_Wrap(uDJF_NAO_hi,0)<br>
uAvgTime_lo = dim_avg_n_Wrap(uDJF_NAO_lo,0)<br>
<br>
printVarSummary(uAvgTime_hi)<br>
printVarSummary(uAvgTime_lo)<br>
<br>
vAvgTime_hi = dim_avg_n_Wrap(vDJF_NAO_hi,0)<br>
vAvgTime_lo = dim_avg_n_Wrap(vDJF_NAO_lo,0)<br>
<br>
printVarSummary(vAvgTime_hi)<br>
printVarSummary(vAvgTime_lo)<br>
<br>
zAvgTime_hi = dim_avg_n_Wrap(zDJF_NAO_hi,0)<br>
zAvgTime_lo = dim_avg_n_Wrap(zDJF_NAO_lo,0)<br>
<br>
printVarSummary(zAvgTime_hi)<br>
printVarSummary(zAvgTime_lo)<br>
<br>
; dirty way to copy metadata over first.<br>
diff_u = uAvgTime_hi;<br>
diff_v = vAvgTime_hi;<br>
diff_z = zAvgTime_hi;<br>
<br>
diff_u = uAvgTime_hi - uAvgTime_lo<br>
diff_v = vAvgTime_hi - vAvgTime_lo<br>
diff_z = zAvgTime_hi - zAvgTime_lo<br>
<br>
printVarSummary(diff_u)<br>
printVarSummary(diff_v)<br>
printVarSummary(diff_z)<br>
<br>
;************************************************<br>
; create plot<br>
;************************************************<br>
wks = gsn_open_wks("ps","Panel_NAO_z_500") ; open a ps file<br>
gsn_define_colormap(wks,"temp1")<br>
<br>
plot = new(3,graphic) ; create a plot array<br>
<br>
;---- set common resources for all plots<br>
res = True<br>
res@gsnDraw = False ; dont draw<br>
res@gsnFrame = False ; dont advance frame<br>
res@cnInfoLabelOn = False ; trn off cn info label<br>
res@gsnAddCyclic = False ; has to do with wrapping the longitude at 0/360<br>
res@cnFillPalette = "matlab_jet"<br>
;************************************************<br>
; Choose a subregion<br>
;************************************************<br>
res@mpMaxLatF = 90 ;maximum latitude<br>
res@mpMinLatF = 45 ;minimum latitude<br>
;res@mpMaxLonF = 357.5 ; ;maximum longitude<br>
;res@mpMinLonF = 270 ;minimum longitude<br>
res@mpMaxLonF = 0<br>
res@mpMinLonF = -90<br>
;res@mpFillBoundarySets = AllBoundaries<br>
res@mpOutlineBoundarySets = "National"<br>
res@mpOutlineOn = True<br>
res@mpOutlineDrawOrder = "PostDraw"<br>
<br>
mpid = gsn_csm_map(wks,res)<br>
<br>
;***********************************************<br>
; ----wind vector plot<br>
;***********************************************<br>
vcres = res<br>
vcres@vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector up<br>
vcres@vcRefMagnitudeF = 10.0 ; define vector ref mag<br>
vcres@vcRefLengthF = 0.045 ; define length of vec ref<br>
vcres@vcGlyphStyle = "CurlyVector" ; turn on curly vectors<br>
vcres@vcMinDistanceF = 0.017<br>
vcres@mpFillOn = False ; turn off gray fill<br>
vcres@mpOutlineBoundarySets = "National" ; turn on country boundaries<br>
;vcres@mpFillBoundarySets = AllBoundaries<br>
vcres@mpGeophysicalLineColor = "Navy" ; color of cont. outlines<br>
vcres@mpGeophysicalLineThicknessF = 1.5 ; thickness of outlines<br>
<br>
<br>
;vcres@gsnLeftString = "DJF High NAO"<br>
; was previously winds_hi =<br>
gsn_csm_vector_map_ce(wks,uAvgTime_hi,vAvgTime_hi,vcres)<br>
winds_hi = gsn_csm_vector(wks,uAvgTime_hi,vAvgTime_hi,vcres)<br>
;vcres@gsnLeftString = "DJF Low NAO"<br>
winds_lo = gsn_csm_vector(wks,uAvgTime_lo,vAvgTime_lo,vcres)<br>
;vcres@gsnLeftString = "Difference of High - Low"<br>
winds_diff = gsn_csm_vector(wks, diff_u, diff_v,vcres)<br>
;************************************************<br>
;---- geopotential height filled contour plot<br>
;***********************************************<br>
zfres = res<br>
zfres@cnFillOn = True<br>
;zfres@cnLevelSelectionMode = "ExplicitLevels<br>
;zfres@cnLevels = ispan(-20,90,5)<br>
zfres@lbLabelFontHeightF = 0.015<br>
zfres@lbOrientation = "Vertical"<br>
zfres@pmLabelBarOrthogonalPosF = -0.005<br>
zfres@cnFillPalette = "BlWhRe"<br>
<br>
contour_zf_hi = gsn_csm_contour(wks,zAvgTime_hi,zfres)<br>
contour_zf_lo = gsn_csm_contour(wks,zAvgTime_lo,zfres)<br>
contour_zf_diff = gsn_csm_contour(wks,diff_z,zfres)<br>
<br>
plot(0) = gsn_csm_contour(wks,zAvgTime_hi,zfres)<br>
plot(1) = gsn_csm_contour(wks,zAvgTime_lo,zfres)<br>
plot(2) = gsn_csm_contour(wks,diff_z,zfres)<br>
<br>
;overlay(plot(0),winds_hi)<br>
overlay(mpid,plot(0))<br>
overlay(mpid,winds_hi)<br>
<br>
;overlay(plot(1),winds_lo)<br>
overlay(mpid,plot(1))<br>
overlay(mpid,winds_lo)<br>
<br>
;overlay(plot(2),winds_diff)<br>
overlay(mpid,plot(2))<br>
overlay(mpid,winds_lo)<br>
<br>
draw(mpid)<br>
frame(wks)<br>
<br>
;************************************************<br>
; create panel<br>
;************************************************<br>
resP = True ; modify the panel plot<br>
resP@txString = "NAO 500mb"<br>
gsn_panel(wks,plot,(/3,1/),resP) ; now draw as one plot;<br>
<br>
<br>
end<br>
<br>
<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>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>