[ncl-talk] unexpected white contours in color filled plot
Mark Branson
mark at atmos.colostate.edu
Fri Aug 19 10:07:21 MDT 2016
Hello.
I'm running ncl v6.2.1 and here is what I'm doing in the attached script:
1) read in a long time series of zonal wind and surface pressure data from CAM output.
2) interpolate them to constant pressure levels using vinth2p.
3) compute long-term monthly means with clmMonTLLL.
4) compute the annual mean of the monthly means.
5) subtract off the annual mean from the monthly means.
6) select one latitude (the equator), and then take the mean of all longitudes.
6) make a color-filled height versus time cross section plot.
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.
Any ideas?
Thanks,
Mark Branson
begin
a = addfile("/pool/mark/spcam_nlev51/spcam_nlev51.cam.h0.0003-01.nc","r")
hyam = a->hyam
hybm = a->hybm
b = addfile("/pool/mark/spcam_nlev51/uandps.nc","r")
u = b->U ;u = [time | 338] x [lev | 53] x [lat | 96] x [lon | 144]
ps = b->PS ;ps = [time | 338] x [lat | 96] x [lon | 144]
u at _FillValue = default_fillvalue("float")
if (any(ismissing(u))) then
print("### original u array contains some missing data ###")
end if
; interpolation variables
plvlM = (/ 30.,50.,70.,100.,150.,200.,250.,300.,350.,400.,450.,500.,550., \
600.,650.,700.,750.,800.,850./)
plvlM at units = "mb"
nplvlM = dimsizes(plvlM)
p0 = 1000. ; mb required by vinth2p
interp = 2 ; log interpolation
extrap = False ; no extrapolation past psfc.
tmp = vinth2p(u,hyam,hybm,plvlM,ps,interp,p0,1,extrap)
if (typeof(tmp).eq."double") then
uwind1 = dble2flt(tmp)
else
uwind1 = tmp
end if
; compute long-term monthly means
uclm = clmMonTLLL(uwind1) ;uclm = [month | 12] x [lev_p | 33] x [lat | 96] x [lon | 144]
; annual mean of monthly means
uann = dim_avg_n_Wrap(uclm,0) ;uann = [lev_p | 33] x [lat | 96] x [lon | 144]
; subtract off annual mean from monthly means
do i = 0,11
uclm(i,:,:,:) = (/ uclm(i,:,:,:) - uann(:,:,:) /)
end do
uwind2 = uclm(:,:,47,:) ; select the equator for the latitude
uwind3 = dim_avg_Wrap(uwind2) ; mean of all longitudes
uwind = uwind3(lev_p|:,month|:) ; swap the array dimensions: month,level --> level,month
printMinMax(uwind,False)
if (any(ismissing(uwind))) then
print("### uwind array contains some missing data ###")
end if
if (any(isnan_ieee(uwind))) then
print("### uwind array contains some NaNs ###")
end if
uwind at long_name = "SP-CAM, 51 levels, Monthly Means"
wks = gsn_open_wks ("eps", "test1") ; send graphics to EPS file
gsn_define_colormap(wks,"BlRe")
res = True
res at cnFillOn = True
res at cnLinesOn = True
res at lbLabelBarOn = True
res at cnInfoLabelOn = False
; change labels for monthly mean plot
res at tmXBMode = "Explicit"
res at tmXBLabelFontHeightF = 0.015
res at tmXBLabels=(/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", \
"Oct","Nov","Dec","Jan"/)
res at tmXBValues = ispan(0,12,1)
plot = gsn_csm_pres_hgt (wks,uwind,res)
end
** OUTPUT FROM THE SCRIPT **
/Users/mark/mmf/SPCAM5/stratosphere_gwdrag/spcam_nlev51> ncl hvstime.ncl
Copyright (C) 1995-2014 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.2.1
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ <http://www.ncl.ucar.edu/> for more details.
(0) min=-9.835 max=6.77056
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160819/e34caaae/attachment-0002.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test1.eps
Type: application/postscript
Size: 228641 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160819/e34caaae/attachment-0001.eps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160819/e34caaae/attachment-0003.html
More information about the ncl-talk
mailing list