[ncl-talk] Reproducible gsn_add_poylline draw error [bug report]

Alan Brammer abrammer at albany.edu
Mon May 22 15:36:59 MDT 2017


Hey NCL devs,

I’ve come across a sometimes avoidable but easily reproducible bug, that seems to still exist in 6.4.0 

Basically when a polyline is added to a plot with an axis on the order of time units (e.g. "hours since 1800”  or  > 1e6 ) and extends beyond the x limits of the plot,  it looks like the polyline function truncates the end of the lines erroneously.  
And then I just kind of broke it completely with the last plot.  

Couldn’t work out if the error is occurring in NhlAddPrimitive or in the create polytype section. 

Simple example script inline below with the output plots attached. 


Alan

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

wks = gsn_open_wks("png","polyline_error")

times := fspan(1881552, 1881984, 73)
times at units = "hours since 1800-01-01"

stime = times(8)
ltime = times(50)

res := True
res at gsnDraw = False
res at gsnFrame = False
res at trXMinF = stime
res at trXMaxF = ltime

x := times
y := sin(x) +4.
res at trYMaxF = max(y)
res at trYMinF = min(y)

;;;; .000001.png
plot = gsn_csm_blank_plot(wks, res)
line = gsn_add_polyline(wks, plot, x, y, False)
draw(plot)
frame(wks)

;;;; .000002.png
res at trXMinF = stime
res at trXMaxF = times(15)
plot = gsn_csm_blank_plot(wks, res)
line = gsn_add_polyline(wks, plot, x, y, False)
draw(plot)
frame(wks)


; oh jeez,   it gets worse. 
;;;; .000003.png
res at trYMinF = min(y)+0.00001    ;; trim just the very very bottom off the plot and watch all hell break lose. 
plot = gsn_csm_blank_plot(wks, res)
line = gsn_add_polyline(wks, plot, x, y, False)
draw(plot)
frame(wks)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;








-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/e4d28c1d/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: polyline_error.000001.png
Type: image/png
Size: 27477 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/e4d28c1d/attachment.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: polyline_error.000002.png
Type: image/png
Size: 22851 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/e4d28c1d/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: polyline_error.000003.png
Type: image/png
Size: 23258 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/e4d28c1d/attachment-0002.png 


More information about the ncl-talk mailing list