Mira,<div><br></div><div>Try this:</div><div><br></div><div><br></div><div><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">plot(0) = gsn_csm_contour(wks,zAvgTime_</span><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">hi,zfres)</span><br style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px"><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">plot(1) = gsn_csm_contour(wks,zAvgTime_</span><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">lo,zfres)</span><br style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px"><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">plot(2) = gsn_csm_contour(wks,diff_z,</span><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">zfres)</span><br style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px"><br style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px"><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">overlay(contour_zf_hi,winds_</span><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">hi)</span><br style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px"><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">overlay(contour_zf_lo,winds_</span><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">lo)</span><br style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px"><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">overlay(contour_diff,winds_</span><span style="color:rgb(34,34,34);font-size:14px;line-height:22.1200008392334px">diff)</span></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px"><br></span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px">I don't believe overlay returns anything and you are trying to save it as a graphic. The code above would replace the lines in your script.</span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px"><br></span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px">Hope that helps,</span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px"><br></span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px">-Alex</span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px"><br></span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px"><br></span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px"><br></span></font></div><div><font color="#222222"><span style="font-size:14px;line-height:22.1200008392334px"><br></span></font>On Sunday, July 26, 2015, <<a href="javascript:_e(%7B%7D,'cvml','mberdahl@envsci.rutgers.edu');" target="_blank">mberdahl@envsci.rutgers.edu</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I'm trying to adapt a working code I had that was plotting 3 panel plots<br>
of wind vectors in a certain region. Now, all I want to do is add an<br>
overlay of geopotential height (filled contours) underneath each of these<br>
plots, but the way I'm approaching it is wrong. I've tried simplifying it<br>
to do this without panels, just a single plot, but I still don't get what<br>
I need. The error message I am getting now is:<br>
<br>
fatal:syntax error: line 153 in file plotWinds_z_NAO_level.ncl before or<br>
near overlay<br>
plot(0)= overlay<br>
---------------^<br>
<br>
<br>
My code is copied below. Any suggestions are greatly appreciated.<br>
Thanks,<br>
Mira<br>
<br>
;*****************************************<br>
; ; plot average winds overlayed on geopotental filled contours for the<br>
years that are extreme<br>
; the years are found with my matlab script findExtremeYrs.m<br>
; this particlar script does the years that correspond to high correlation<br>
with DJF, SE precip and NAO<br>
;*****************************************<br>
; the original data goes from 1948 January to April 2015.<br>
; I will cut it out to 2014 December, so we have something divisible by 12<br>
so we can do seasonal averages...<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" target="_blank">uwnd.mon.mean.alllevels.nc</a>","r") ; u winds<br>
b = addfile("<a href="http://vwnd.mon.mean.alllevels.nc" target="_blank">vwnd.mon.mean.alllevels.nc</a>","r") ; v winds<br>
<br>
c = addfile("../Geopotential/<a href="http://hgt.mon.mean.nc" 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>
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 = True ; plot mods desired<br>
res@gsnAddCyclic = False ; has to do with wrapping the longitude at 0/360<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>
<br>
;***********************************************<br>
; ----wind vector plot<br>
;***********************************************<br>
vcres = True<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@mpGeophysicalLineColor = "Navy" ; color of cont. outlines<br>
vcres@mpGeophysicalLineThicknessF = 1.5 ; thickness of outlines<br>
<br>
<br>
;vcres@gsnLeftString = "DJF High NAO"<br>
winds_hi = gsn_csm_vector_map_ce(wks,uAvgTime_hi,vAvgTime_hi,vcres)<br>
;vcres@gsnLeftString = "DJF Low NAO"<br>
winds_lo = gsn_csm_vector_map_ce(wks,uAvgTime_lo,vAvgTime_lo,vcres)<br>
;vcres@gsnLeftString = "Difference of High - Low"<br>
winds_diff = gsn_csm_vector_map_ce(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>
<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) = overlay(contour_zf_hi,winds_hi)<br>
plot(1) = overlay(contour_zf_lo,winds_lo)<br>
plot(2) = overlay(contour_diff,winds_diff)<br>
<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>ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>