<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. I modified my code to use the lat_select lines that you sent. It’s a good reminder to use the coordinate variables in that way instead of just a simple array index. Unfortunately, I'm still getting the white areas in the contours. :(<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. 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 <<a href="mailto:shea@ucar.edu" class="">shea@ucar.edu</a>> 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 -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 <br class="">wind2 = uclm(:,:,{lat_select},:) ; this would select 0.9473684210526364 <br class=""><br class=""></div>or<br class="">lat_select = -0.001 <br class="">wind2 = uclm(:,:,{lat_select},:) ; this would select -0.9473684210526364<br class=""><br class=""></div>One 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 (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=""><<a href="mailto:mark@atmos.colostate.edu" target="_blank" class="">mark@atmos.colostate.edu</a>></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. 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=""> 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=""> hyam = a->hyam<br class=""> hybm = a->hybm<br class=""><br class=""> b = addfile("/pool/mark/spcam_<wbr class="">nlev51/<a href="http://uandps.nc/" target="_blank" class="">uandps.nc</a>","r")<br class=""> u = b->U ;u = [time | 338] x [lev | 53] x [lat | 96] x [lon | 144]<br class=""> ps = b->PS ;ps = [time | 338] x [lat | 96] x [lon | 144]<br class=""> u@_FillValue = default_fillvalue("float")<br class=""><br class=""> if (any(ismissing(u))) then<br class=""> print("### original u array contains some missing data ###")<br class=""> end if<br class=""><br class="">; interpolation variables<br class=""> plvlM = (/ 30.,50.,70.,100.,150.,200.,<wbr class="">250.,300.,350.,400.,450.,500.,<wbr class="">550., \<br class=""> 600.,650.,700.,750.<wbr class="">,800.,850./)<br class=""> plvlM@units = "mb"<br class=""> nplvlM = dimsizes(plvlM)<br class=""><br class=""> p0 = 1000. ; mb required by vinth2p<br class=""> interp = 2 ; log interpolation<br class=""> extrap = False ; no extrapolation past psfc.<br class=""><br class=""> tmp = vinth2p(u,hyam,hybm,plvlM,ps,<wbr class="">interp,p0,1,extrap)<br class=""> if (typeof(tmp).eq."double") then<br class=""> uwind1 = dble2flt(tmp)<br class=""> else<br class=""> uwind1 = tmp<br class=""> end if<br class=""><br class="">; compute long-term monthly means<br class=""> uclm = clmMonTLLL(uwind1) ;uclm = [month | 12] x [lev_p | 33] x [lat | 96] x [lon | 144]<br class=""><br class="">; annual mean of monthly means<br class=""> uann = dim_avg_n_Wrap(uclm,0) ;uann = [lev_p | 33] x [lat | 96] x [lon | 144]<br class=""><br class="">; subtract off annual mean from monthly means<br class=""> do i = 0,11<br class=""> uclm(i,:,:,:) = (/ uclm(i,:,:,:) - uann(:,:,:) /)<br class=""> end do<br class=""><br class=""> uwind2 = uclm(:,:,47,:) ; select the equator for the latitude<br class=""> uwind3 = dim_avg_Wrap(uwind2) ; mean of all longitudes<br class=""> uwind = uwind3(lev_p|:,month|:) ; swap the array dimensions: month,level --> level,month<br class=""><br class=""> printMinMax(uwind,False)<br class=""><br class=""> if (any(ismissing(uwind))) then<br class=""> print("### uwind array contains some missing data ###")<br class=""> end if<br class=""> if (any(isnan_ieee(uwind))) then<br class=""> print("### uwind array contains some NaNs ###")<br class=""> end if<br class=""><br class=""> uwind@long_name = "SP-CAM, 51 levels, Monthly Means"<br class=""><br class=""> wks = gsn_open_wks ("eps", "test1") ; send graphics to EPS file<br class=""> gsn_define_colormap(wks,"<wbr class="">BlRe")<br class=""><br class=""> res = True <br class=""> res@cnFillOn = True <br class=""> res@cnLinesOn = True <br class=""> res@lbLabelBarOn = True <br class=""> res@cnInfoLabelOn = False<br class=""><br class="">; change labels for monthly mean plot<br class=""> res@tmXBMode = "Explicit"<br class=""> res@tmXBLabelFontHeightF = 0.015<br class=""> res@tmXBLabels=(/"Jan","Feb",<wbr class="">"Mar","Apr","May","Jun","Jul",<wbr class="">"Aug","Sep", \<br class=""> "Oct","Nov",<wbr class="">"Dec","Jan"/)<br class=""> res@tmXBValues = ispan(0,12,1)<br class=""><br class=""> plot = gsn_csm_pres_hgt (wks,uwind,res) <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> 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 <a href="http://www.ncl.ucar.edu/" target="_blank" class="">http://www.ncl.ucar.edu/</a> <wbr class="">for more details.<br class="">(0)<span style="white-space:pre-wrap" class="">        </span>min=-9.835 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>