<div dir="ltr"><div><div><div><div>Some general commens:<br><br>[1] <br></div><div><br>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><br></div>A coordinate variable uses the {...} syntax. It would look like look like:<br><br>lat_select = 0 <br>wind2 = uclm(:,:,{lat_select},:) ; this would select 0.9473684210526364 <br><br></div>or<br>lat_select = -0.001 <br>wind2 = uclm(:,:,{lat_select},:) ; this would select -0.9473684210526364<br><br></div>One advantage of using CVs is that you can use a different resolution without having to change a specific index.<br><br>[2]<br></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><br><pre> 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><div><div><div><div><div><div><div><pre> symMinMaxPlt(uwind, 21, False, res) ; contributed.ncl<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/symMinMaxPlt.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Contributed/<wbr>symMinMaxPlt.shtml</a><br></pre></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 19, 2016 at 10:07 AM, Mark Branson <span dir="ltr"><<a href="mailto:mark@atmos.colostate.edu" target="_blank">mark@atmos.colostate.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello.<br><br>I'm running ncl v6.2.1 and here is what I'm doing in the attached script:<br><br>1) read in a long time series of zonal wind and surface pressure data from CAM output.<br>2) interpolate them to constant pressure levels using vinth2p.<br>3) compute long-term monthly means with clmMonTLLL.<br>4) compute the annual mean of the monthly means.<br>5) subtract off the annual mean from the monthly means.<br>6) select one latitude (the equator), and then take the mean of all longitudes.<br>6) make a color-filled height versus time cross section plot.<br><br>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><br>Any ideas?<br><br>Thanks,<br>Mark Branson<br><br><br>begin<br> a = addfile("/pool/mark/spcam_<wbr>nlev51/<a href="http://spcam_nlev51.cam.h0.0003-01.nc" target="_blank">spcam_nlev51.cam.h0.<wbr>0003-01.nc</a>","r")<br> hyam = a->hyam<br> hybm = a->hybm<br><br> b = addfile("/pool/mark/spcam_<wbr>nlev51/<a href="http://uandps.nc" target="_blank">uandps.nc</a>","r")<br> u = b->U ;u = [time | 338] x [lev | 53] x [lat | 96] x [lon | 144]<br> ps = b->PS ;ps = [time | 338] x [lat | 96] x [lon | 144]<br> u@_FillValue = default_fillvalue("float")<br><br> if (any(ismissing(u))) then<br> print("### original u array contains some missing data ###")<br> end if<br><br>; interpolation variables<br> plvlM = (/ 30.,50.,70.,100.,150.,200.,<wbr>250.,300.,350.,400.,450.,500.,<wbr>550., \<br> 600.,650.,700.,750.<wbr>,800.,850./)<br> plvlM@units = "mb"<br> nplvlM = dimsizes(plvlM)<br><br> p0 = 1000. ; mb required by vinth2p<br> interp = 2 ; log interpolation<br> extrap = False ; no extrapolation past psfc.<br><br> tmp = vinth2p(u,hyam,hybm,plvlM,ps,<wbr>interp,p0,1,extrap)<br> if (typeof(tmp).eq."double") then<br> uwind1 = dble2flt(tmp)<br> else<br> uwind1 = tmp<br> end if<br><br>; compute long-term monthly means<br> uclm = clmMonTLLL(uwind1) ;uclm = [month | 12] x [lev_p | 33] x [lat | 96] x [lon | 144]<br><br>; annual mean of monthly means<br> uann = dim_avg_n_Wrap(uclm,0) ;uann = [lev_p | 33] x [lat | 96] x [lon | 144]<br><br>; subtract off annual mean from monthly means<br> do i = 0,11<br> uclm(i,:,:,:) = (/ uclm(i,:,:,:) - uann(:,:,:) /)<br> end do<br><br> uwind2 = uclm(:,:,47,:) ; select the equator for the latitude<br> uwind3 = dim_avg_Wrap(uwind2) ; mean of all longitudes<br> uwind = uwind3(lev_p|:,month|:) ; swap the array dimensions: month,level --> level,month<br><br> printMinMax(uwind,False)<br><br> if (any(ismissing(uwind))) then<br> print("### uwind array contains some missing data ###")<br> end if<br> if (any(isnan_ieee(uwind))) then<br> print("### uwind array contains some NaNs ###")<br> end if<br><br> uwind@long_name = "SP-CAM, 51 levels, Monthly Means"<br><br> wks = gsn_open_wks ("eps", "test1") ; send graphics to EPS file<br> gsn_define_colormap(wks,"<wbr>BlRe")<br><br> res = True <br> res@cnFillOn = True <br> res@cnLinesOn = True <br> res@lbLabelBarOn = True <br> res@cnInfoLabelOn = False<br><br>; change labels for monthly mean plot<br> res@tmXBMode = "Explicit"<br> res@tmXBLabelFontHeightF = 0.015<br> res@tmXBLabels=(/"Jan","Feb",<wbr>"Mar","Apr","May","Jun","Jul",<wbr>"Aug","Sep", \<br> "Oct","Nov",<wbr>"Dec","Jan"/)<br> res@tmXBValues = ispan(0,12,1)<br><br> plot = gsn_csm_pres_hgt (wks,uwind,res) <br>end<br><br>** OUTPUT FROM THE SCRIPT **<br><br>/Users/mark/mmf/SPCAM5/<wbr>stratosphere_gwdrag/spcam_<wbr>nlev51> ncl hvstime.ncl<br>Copyright (C) 1995-2014 - All Rights Reserved<br>University Corporation for Atmospheric Research<br>NCAR Command Language Version 6.2.1<br>The use of this software is governed by a License Agreement.<br>See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> <wbr>for more details.<br>(0)<span style="white-space:pre-wrap">        </span>min=-9.835 max=6.77056<br><br></div><br><div style="word-wrap:break-word"></div><br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>