[ncl-talk] unexpected white contours in color filled plot

Mary Haley haley at ucar.edu
Sun Aug 21 22:48:50 MDT 2016


Hi Mark,

[I'm posting back to ncl-talk here.]

Thanks for providing the data file. I was able to reproduce the problem,
and unfortunately I'm not sure about a work-around at this time.

That's not entirely true: if I don't reverse the Y axis, then the bug goes
away.  But, with a pressure/height plot, you want to reverse the Y axis. I
tried a few things, like reversing the leftmost dimension of your data
(that didn't work), and reversing the Y axis myself and then just using
gsn_csm_contour (that didn't work either because then a different contour
showed up white).

I have filed a bug report using your small data file and a modified version
of your script.  The bug report is NCL-2478 for your reference. I'm sorry I
couldn't find a work-around. Hopefully this isn't a difficult bug to fix.

--Mary


On Fri, Aug 19, 2016 at 10:49 AM, Mark Branson <mark at atmos.colostate.edu>
wrote:

> Hi Mary.
>
> Wow, what a cool debugging tool.  Attached is the resulting mary_debug.nc
> file.  If need be, I can definitely upload the original data file (
> uandps.nc).  That file size is around 1GB.
>
> Thanks!
> Mark
>
>
>
> On Aug 19, 2016, at 10:41 AM, Mary Haley <haley at ucar.edu> wrote:
>
> [Offline for a bit.]
>
> Yeah, this must point to the coordinate somehow, but this is a little odd.
>
> Would you be able to provide the data? I think if you set this
> unadvertised resource before you call gsn_csm_contour:
>
> res at gsnDebugWriteFileName = "mary_debug"
>
> Then it should create a "mary_debug.nc" NetCDF file, with just the "uwnd"
> data you're plotting, along with the coordinate arrays. This way you don't
> have to provide me with the full data file if you don't want.
>
> The "mary_debug,nc" file should probably be small enough to just attach in
> an email.  I think a "mary_debug.ncl" script will also get created, and you
> can email that to me, although I don't need it since I have your original
> script.
>
> Thanks,
>
> --Mary
>
>
>
>
> On Fri, Aug 19, 2016 at 10:34 AM, Mark Branson <mark at atmos.colostate.edu>
> wrote:
>
>> Hi Mary.
>>
>> Here is that.  Interestingly, the problem has gone away.  So perhaps the
>> coordinate arrays are indeed the source of the problem?
>>
>> Mark
>>
>>
>>
>> On Aug 19, 2016, at 10:26 AM, Mary Haley <haley at ucar.edu> wrote:
>>
>> Hi Mark,
>>
>> That is a little odd. You did good work debugging the problem, so missing
>> values and nans are ruled out.
>>
>> To further debug this, can you try plotting a very basic contour plot,
>> without the pressure /height axes, and without any coordinate information
>> and send the image:
>>
>>  plot = gsn_contour (wks,uwind,res)
>>
>> The gsn_contour script ignores any coordinate arrays, which I want to
>> make sure are not the source of the problem.
>>
>> Thanks,
>>
>> --Mary
>>
>>
>>
>> On Fri, Aug 19, 2016 at 10:07 AM, Mark Branson <mark at atmos.colostate.edu>
>> wrote:
>>
>>> 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/ for more details.
>>> (0) min=-9.835   max=6.77056
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160821/849dc152/attachment.html 


More information about the ncl-talk mailing list