<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks, Dennis. &nbsp;I modified my code to use the lat_select lines that you sent. &nbsp;It’s a good reminder to use the coordinate variables in that way instead of just a simple array index. &nbsp;Unfortunately, I'm still getting the white areas in the contours. &nbsp;:(<div class=""><br class=""></div><div class="">I actually did have a symmetric color bar set up using those four manual settings that you sent in a previous version of the script. &nbsp;I just removed them and a number of other things trying to simplify things to see if the problem would go away, and to make for something shorter to post to the mailing list.</div><div class=""><br class=""></div><div class="">Thanks again!</div><div class="">Mark</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 19, 2016, at 2:36 PM, Dennis Shea &lt;<a href="mailto:shea@ucar.edu" class="">shea@ucar.edu</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class="">Some general commens:<br class=""><br class="">[1] <br class=""></div><div class=""><br class="">Maybe use coordinate variable (CV) for the latitude. CV are the natural coordinate of the specific dimension. You used an index (47) which corresponds to&nbsp;&nbsp; -0.9473684210526364.<br class=""><br class=""></div>A coordinate variable uses the {...} syntax. It would look like look like:<br class=""><br class="">lat_select = 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br class="">wind2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = uclm(:,:,{lat_select},:) &nbsp; ; this would select 0.9473684210526364 <br class=""><br class=""></div>or<br class="">lat_select = -0.001&nbsp; <br class="">wind2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = uclm(:,:,{lat_select},:) &nbsp; ; this would select -0.9473684210526364<br class=""><br class=""></div>One&nbsp; advantage of using CVs is that you can use a different resolution without having to change a specific index.<br class=""><br class="">[2]<br class=""></div>Since the sign of the zonal average conveys direction (East or West), it would be best to have a symmetric label bar. Suggest&nbsp; (eg: -9 to 9). You can do this manually:<br class=""><br class=""><pre class="">  res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
  res@cnMinLevelValF       = -9.0.          ; set min contour level
  res@cnMaxLevelValF       =  9.0           ; set max contour level
  res@cnLevelSpacingF      =   1.           ; set contour spacing
</pre>or, better (?)<br class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><pre class="">  symMinMaxPlt(uwind, 21, False, res)       ; contributed.ncl<br class=""><br class=""><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/symMinMaxPlt.shtml" target="_blank" class="">http://www.ncl.ucar.edu/Docume<wbr class="">nt/Functions/Contributed/<wbr class="">symMinMaxPlt.shtml</a><br class=""></pre></div></div></div></div></div></div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Aug 19, 2016 at 10:07 AM, Mark Branson <span dir="ltr" class="">&lt;<a href="mailto:mark@atmos.colostate.edu" target="_blank" class="">mark@atmos.colostate.edu</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hello.<br class=""><br class="">I'm running ncl v6.2.1 and here is what I'm doing in the attached script:<br class=""><br class="">1) read in a long time series of zonal wind and surface pressure data from CAM output.<br class="">2) interpolate them to constant pressure levels using vinth2p.<br class="">3) compute long-term monthly means with clmMonTLLL.<br class="">4) compute the annual mean of the monthly means.<br class="">5) subtract off the annual mean from the monthly means.<br class="">6) select one latitude (the equator), and then take the mean of all longitudes.<br class="">6) make a color-filled height versus time cross section plot.<br class=""><br class="">I get the plot (see attached), but some of the contours near the top are white.&nbsp; I thought maybe it was because there were some missing or bogus values, so I inserted a check for those with the ismissing and isnan_ieee functions and it seems the data is fine.<br class=""><br class="">Any ideas?<br class=""><br class="">Thanks,<br class="">Mark Branson<br class=""><br class=""><br class="">begin<br class="">&nbsp;a = addfile("/pool/mark/spcam_<wbr class="">nlev51/<a href="http://spcam_nlev51.cam.h0.0003-01.nc/" target="_blank" class="">spcam_nlev51.cam.h0.<wbr class="">0003-01.nc</a>","r")<br class="">&nbsp;hyam = a-&gt;hyam<br class="">&nbsp;hybm = a-&gt;hybm<br class=""><br class="">&nbsp;b = addfile("/pool/mark/spcam_<wbr class="">nlev51/<a href="http://uandps.nc/" target="_blank" class="">uandps.nc</a>","r")<br class="">&nbsp;u = b-&gt;U &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;u = [time | 338] x [lev | 53] x [lat | 96] x [lon | 144]<br class="">&nbsp;ps = b-&gt;PS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;ps = [time | 338] x [lat | 96] x [lon | 144]<br class="">&nbsp;u@_FillValue = default_fillvalue("float")<br class=""><br class="">&nbsp;if (any(ismissing(u))) then<br class="">&nbsp;&nbsp;&nbsp;print("### original u array contains some missing data ###")<br class="">&nbsp;end if<br class=""><br class="">; interpolation variables<br class="">&nbsp;plvlM = (/ 30.,50.,70.,100.,150.,200.,<wbr class="">250.,300.,350.,400.,450.,500.,<wbr class="">550., \<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;600.,650.,700.,750.<wbr class="">,800.,850./)<br class="">&nbsp;plvlM@units = "mb"<br class="">&nbsp;nplvlM = dimsizes(plvlM)<br class=""><br class="">&nbsp;p0 &nbsp;&nbsp;&nbsp;&nbsp;= 1000. &nbsp;&nbsp;&nbsp;&nbsp;; mb required by vinth2p<br class="">&nbsp;interp = 2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; log interpolation<br class="">&nbsp;extrap = False &nbsp;&nbsp;&nbsp;&nbsp;; no extrapolation past psfc.<br class=""><br class="">&nbsp;tmp = vinth2p(u,hyam,hybm,plvlM,ps,<wbr class="">interp,p0,1,extrap)<br class="">&nbsp;if (typeof(tmp).eq."double") then<br class="">&nbsp;&nbsp;&nbsp;uwind1 = dble2flt(tmp)<br class="">&nbsp;else<br class="">&nbsp;&nbsp;&nbsp;uwind1 = tmp<br class="">&nbsp;end if<br class=""><br class="">; compute long-term monthly means<br class="">&nbsp;uclm = clmMonTLLL(uwind1) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;uclm = [month | 12] x [lev_p | 33] x [lat | 96] x [lon | 144]<br class=""><br class="">; annual mean of monthly means<br class="">&nbsp;uann = dim_avg_n_Wrap(uclm,0) &nbsp;&nbsp;;uann = [lev_p | 33] x [lat | 96] x [lon | 144]<br class=""><br class="">; subtract off annual mean from monthly means<br class="">&nbsp;do i = 0,11<br class="">&nbsp;&nbsp;&nbsp;uclm(i,:,:,:) = (/ uclm(i,:,:,:) - uann(:,:,:) /)<br class="">&nbsp;end do<br class=""><br class="">&nbsp;uwind2 = uclm(:,:,47,:) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; select the equator for the latitude<br class="">&nbsp;uwind3 = dim_avg_Wrap(uwind2) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; mean of all longitudes<br class="">&nbsp;uwind = uwind3(lev_p|:,month|:) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; swap the array dimensions: &nbsp;month,level --&gt; level,month<br class=""><br class="">&nbsp;printMinMax(uwind,False)<br class=""><br class="">&nbsp;if (any(ismissing(uwind))) then<br class="">&nbsp;&nbsp;&nbsp;print("### uwind array contains some missing data ###")<br class="">&nbsp;end if<br class="">&nbsp;if (any(isnan_ieee(uwind))) then<br class="">&nbsp;&nbsp;&nbsp;print("### uwind array contains some NaNs ###")<br class="">&nbsp;end if<br class=""><br class="">&nbsp;uwind@long_name = "SP-CAM, 51 levels, Monthly Means"<br class=""><br class="">&nbsp;wks &nbsp;&nbsp;= gsn_open_wks ("eps", "test1") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; send graphics to EPS file<br class="">&nbsp;gsn_define_colormap(wks,"<wbr class="">BlRe")<br class=""><br class="">&nbsp;res &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= True &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br class="">&nbsp;res@cnFillOn &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= True &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br class="">&nbsp;res@cnLinesOn &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= True &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br class="">&nbsp;res@lbLabelBarOn &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= True &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br class="">&nbsp;res@cnInfoLabelOn &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= False<br class=""><br class="">; change labels for monthly mean plot<br class="">&nbsp;res@tmXBMode = "Explicit"<br class="">&nbsp;res@tmXBLabelFontHeightF = 0.015<br class="">&nbsp;res@tmXBLabels=(/"Jan","Feb",<wbr class="">"Mar","Apr","May","Jun","Jul",<wbr class="">"Aug","Sep", \<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"Oct","Nov",<wbr class="">"Dec","Jan"/)<br class="">&nbsp;res@tmXBValues = ispan(0,12,1)<br class=""><br class="">&nbsp;plot = gsn_csm_pres_hgt (wks,uwind,res)&nbsp;<br class="">end<br class=""><br class="">** OUTPUT FROM THE SCRIPT **<br class=""><br class="">/Users/mark/mmf/SPCAM5/<wbr class="">stratosphere_gwdrag/spcam_<wbr class="">nlev51&gt; ncl hvstime.ncl<br class="">Copyright (C) 1995-2014 - All Rights Reserved<br class="">University Corporation for Atmospheric Research<br class="">NCAR Command Language Version 6.2.1<br class="">The use of this software is governed by a License Agreement.<br class="">See&nbsp;<a href="http://www.ncl.ucar.edu/" target="_blank" class="">http://www.ncl.ucar.edu/</a>&nbsp;<wbr class="">for more details.<br class="">(0)<span style="white-space:pre-wrap" class="">        </span>min=-9.835 &nbsp;&nbsp;max=6.77056<br class=""><br class=""></div><br class=""><div style="word-wrap:break-word" class=""></div><br class="">______________________________<wbr class="">_________________<br class="">
ncl-talk mailing list<br class="">
<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">
List instructions, subscriber options, unsubscribe:<br class="">
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank" class="">http://mailman.ucar.edu/<wbr class="">mailman/listinfo/ncl-talk</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></body></html>