[ncl-talk] plot will not draw with cnSmoothingOn=True
Mary Haley
haley at ucar.edu
Wed Sep 7 23:25:24 MDT 2016
Hi Andy,
Thanks for providing a clean script and a data file.
I was able to verify the problem. I also verified that it has something to
do with setting both the smoothing, and a negative dash line pattern. I've
filed a bug report, NCL-2488.
Setting cnSmoothingOn to True is causing one of the contours to go haywire
(you can see this if you temporarily comment out the setting of gsnDraw and
gsnFrame to False), and I think trying to set the pattern for this stray
contour is causing the hang. In fact, if you draw the *positive* contours
as dashed, it works fine.
As a work-around, you can use "smth_Wrap
<http://www.ncl.ucar.edu/Document/Functions/Contributed/smth9_Wrap.shtml>"
to smooth your contours, and then plot this instead of var_filter:
var_filter_smth = smth9_Wrap(var_filter, 0.50, -0.25, False) ; light
local smoothing
. . .
plot_var_filter = gsn_csm_hov(wks, var_filter_smth, cres)
See the attached modified script and its resultant PNG. You can set the
third parameter of smth9_Wrap to vary the smoothing. See the documentation
for more info:
http://www.ncl.ucar.edu/Document/Functions/Contributed/smth9_Wrap.shtml
--Mary
On Wed, Sep 7, 2016 at 6:47 AM, Andy Penny <andybpenny at hotmail.com> wrote:
> Hi there,
>
> I'm trying to make a hovmoller plot with shading and contours. However,
> when I set "cres at cnSmoothingOn = True" for the contours, the script will
> hang when it tries to draw the plot- it doesn't reach the "RIGHT AFTER DRAW
> PLOT" print statement. The script works fine when "cres at cnSmoothingOn =
> False". I'm using NCL version 6.3.0 (ncl_ncarg-6.3.0.Linux_RHEL6.4_x86_64_nodap_gcc447.tar.gz).
> I've pasted the script below, and have attached the script and data file.
>
> Thanks in advance for any help,
> Andy
>
> -------------
>
> begin
>
> a = addfile("./test_data.nc","r")
> var = a->var
> var_filter = a->var_filter
>
> ;#### Create Workstation ####
> plotname = "test"
> wks = gsn_open_wks("png", plotname)
>
> ;#### Define Color Map ####
> gsn_define_colormap(wks, "ncl_default")
>
> ;#### Shading Resources ####
> res = True
> res at cnFillOn = True
> res at cnLinesOn = False
> res at cnLineLabelsOn = False
> res at cnSmoothingOn = True
> res at gsnDraw = False
> res at gsnFrame = False
> res at gsnSpreadColors = True
>
> ;#### Contour Resources ####
> cres = res
> cres at cnFillOn = False
> cres at gsnContourNegLineDashPattern = 1
> cres at cnLinesOn = True
> cres at cnSmoothingOn = True ; if set to
> True, plot will not draw
> cres at cnLineLabelsOn = False
> cres at cnLevelSelectionMode = "ExplicitLevels"
> cres at cnLineColor = "black"
> cres at cnInfoLabelOn = False
> cres at cnLineThicknessF = 3.0
>
> ;#### Create Plot ####
> plot_var = gsn_csm_hov(wks, var, res)
> plot_var_filter = gsn_csm_hov(wks, var_filter, cres)
> overlay(plot_var,plot_var_filter)
>
> print("RIGHT BEFORE DRAW PLOT")
> draw(plot_var)
> print("RIGHT AFTER DRAW PLOT")
>
> frame(wks)
> delete(wks)
>
> end
>
>
> _______________________________________________
> 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/20160907/d16fc790/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 583172 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160907/d16fc790/attachment-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_plot_work_around.ncl
Type: application/octet-stream
Size: 1562 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160907/d16fc790/attachment-0001.obj
More information about the ncl-talk
mailing list